18
$\begingroup$

Is there a way to create an HDR map from a rendered scene in blender? I'm asking because I'm working to optimize an indoor scene that will be used multiple times for rendering scenes in a comic, and it has open windows which look out to a cityscape. I would like to cut the cityscape out and replace it with an HDR version of it, so that it doesn't have to calculate as many bounces and (by extension) renders faster.

$\endgroup$
16
$\begingroup$

Yes, there is in cycles. To begin select your camera. You will need to make changes to its settings. In the camera tab under lens, set it to Panoramic, and the type to Equirectangular. enter image description here Now, to make it more HDR friendly head into the color management section of the Scene tab. enter image description here I would select raw, since it will save the most color data. depending on the amount of dynamic range you want, you can make more or less images at different exposures.

You image is HDR strait out of blender, as long as you choose a format that supports HDR images, like .EXR, your image should be good.

$\endgroup$
  • 6
    $\begingroup$ A few incorrect statements in this post. First, "Raw" will not preserve any more data than any of the other formats as your file format and bit depth control that. That is purely the display transform by default. Second, Blender is already an HDR scene referred rendering system if one renders with Cycles, so Luminance could be entirely unnecessary here. Simply save the render as an EXR. $\endgroup$ – troy_s Nov 24 '14 at 18:10
  • $\begingroup$ @TroySobotka Good point, could you add that as an edit. Thanks! $\endgroup$ – GiantCowFilms Nov 24 '14 at 18:19
  • 3
    $\begingroup$ For completeness Blender now supports the export of the .hdr filetype. $\endgroup$ – VRM Nov 20 '15 at 12:32
  • $\begingroup$ @GiantCowFilms I am trying to save my rendering results in 16-bit PNG files. After loading the PNG files in Python I noticed that the highest number for all pixels is never more than 255 (8-bits). I posted a question here.I would appreciate if you can take a look and tell me if I'm doing anything wrong.I may note that I wanted to initially save my rendering results in OpenEXR but due to this issue,I cannot do this as of now. So I decided to continue with PNG to get some preliminary results until Blender people fix the OpenEXR bug $\endgroup$ – Amir Mar 31 '18 at 1:50
20
$\begingroup$

The Short Answer

I'll post a new answer here because it seems that there is a good deal of confusion, and editing the existing accepted answer isn't the most optimal way to deal with this.

The answer is that Blender is already scene-referred enabled by default. In fact, the entire Blender architecture leans this way, it is just that many learning artists are unaware of the division between a scene referred and display referred working model.

TL; DR If you select Cycles as the default renderer, and save as an EXR, your saved file will already be high dynamic range.

The Longer Answer

So what is High Dynamic Range imaging?

If we explode what we think we know about imaging, we can probably get a good handle on what HDR is, it becomes clear why Cycles renders its data in accordance with scene referred models.

In the physical world, light is a strictly linear phenomenon. If you use a spot meter and measure a point in your frame at 100 units, something in the frame that is twice as illuminated will read 200 units. There is no white. There is no black. Just ratios of light from zero to infinity.

That's right... our values go from 0 all the way up to whatever our highest and brightest value is. This is a scene referred model.

Blender and Cycles and Scene Referred Models

The same holds true in Blender. If you take a default cube and render it in Cycles with 30 point lights in close, the rendered output window might look odd and show the cube as blown out white. But in the internal model, nothing is further from the truth.

If we use the swatch to measure the values on the cube, we can see that the values in the information bar that show up extend well off into the crazy zone. The values to the left of the CM information show the internal model, and the values to the right show the values after the CM transformation. On the left then, are the internal scene referred values, and on the right we see the display referred transformation. So when we flip the various output transforms listed in the color management panel, we are changing the display output transform, and not, in fact, changing the underlying scene referred data at all. Raw, sRGB, or otherwise.

By default, Blender uses a blind and ignorant clip cut that shaves off all of the excess values above the display referred value of 1.0. This means that if you save to an inappropriate file type such as JPEG, PNG, etc., the values on the right side of the CM information bar will be plopped into the file.

If however you save into a data-preserving file format such as EXR, the scene referred data values will be preserved in the file format.

In Closing

So the short answer to how to get HDR values out of Blender is... don't do anything, it already is! No need for Luminance. No need for software magic. Just render via Cycles.

The slightly longer answer involves understanding the differences between a scene referred linear model and a low dynamic range display referred non-linear model, and why the two are vastly different. It also involves understanding why each model is different, and what important things each bring to the table regarding needs.

Phew... a longer explanation than likely wanted, but one that only barely does justice to the complexities of these two models and the science of pixels and light. If anyone reading this finds it at all interesting and want to further their craft, I would strongly suggest you go read the Visual Effects Society Handbook available at CinematicColor.com.

$\endgroup$
6
$\begingroup$
  1. Hide everything except the parts of your scene you want to put in the environment hdr (or put them on separate layers).

  2. (this step isn't necessary, but it makes things easier)
    Add a new your camera at the same location as your current camera, but with the rotation aligned to the axes. Then make it the active camera (CtrlNumpad 0)

    enter image description here

  3. With the new camera selected, set the lens of the camera to Panoramic and the type to Equirectangular in Properties > Object data:

    enter image description here

  4. Set the output format to OpenEXR in Render settings > Output:

    enter image description here

    OpenEXR is a hdr format which can store values as 32bit floats the amount of light (brightness) per pixel as floating point values.

  5. Render and save (F3) the panorama.

  6. Load the hdr into the world node setup in an Environment texture node, and rotate it 180° around the Z (for some reason it always seems to come out reversed):

    enter image description here

Now you can hide/remove your environment objects (including the extra camera), and unhide the rest of your scene.

Result:

Rendered with hdr image background:
Time: 2:41 (12:08 to render the background at 1920x1080)

enter image description here

Rendered with actual geometry for the outside environment
Time: 6:32

enter image description here

Note that replacing a 3D environment with a 2D image will not work with animations where there is parallax motion (translation of the camera).

$\endgroup$
  • $\begingroup$ I am trying to save my rendering results in 16-bit PNG files. After loading the PNG files in Python I noticed that the highest number for all pixels is never more than 255 (8-bits). I posted a question here. I would appreciate if you can take a look and tell me if I'm doing anything wrong. I may note that I wanted to initially save my rendering results in OpenEXR but due to this issue, I cannot do this as of now. So I decided to continue with PNG to get some preliminary results until Blender people fix the OpenEXR bug. $\endgroup$ – Amir Mar 31 '18 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.