HDR with Luminance - LuxRender Wiki
Luxrender GPL Physically Based Renderer

HDR with Luminance

Personal tools

From LuxRender Wiki

Jump to: navigation, search

Luminance HDR, formerly known as qtpfsgui, is a GPL program for working with high-dynamic-range (HDR) images, such as bracketed-exposure photographs or 3D renders. LuxRender always produces HDR images, simply by the nature of its rendering process. While LuxRender includes a few simpler tone mapping operators, most are limited in capability, and can have trouble dealing with high-contrast renders, or when you want a more stylistic effect. This is where Luminance comes in.

Contents

Background on HDR

Cameras, computer monitors, and many digital sensors lack the ability to see the range of light levels that our eyes can see. Computer monitors and digital cameras normally deal with 8bit images. (meaning each color channel uses 8 bits to store its data). These are usually integer images as well, meaning you get a value from 0-255 to describe your color.

In photography, HDR is used to allow more dynamic range than the camera could produce normally, by taking multiple photos at increasing exposures, then merging them together. This is called "bracketing". (On a side note, Luminance can do this part too, if you are into HDR photography, or want to get into it. But that is beyond the scope of this guide.) Bracketing actually predates digital photography, going back to photos of nuclear tests. Photographers would take multiple exposures of the fireball to get a more accurate photo, then combine them in the darkroom.

Obviously, combining the exposures doesn't happen with 8bit integers, or else it would be a little pointless. Instead, it is done with 32bit floating point numbers. This means each channel in the image is instead a value from 0.0 to 1.0, and there are 32 bits worth of zeros. This allows for a vast increase in the range of brightness and color that you can store.

3D renderers often render their data using 32bit floats as well. LuxRender does not use RGB at all during the rendering, but instead use wavelengths and power values to trace the ray. This is then stored on the film in the CIE XYZ color space. Normally, Lux's tonemapping process converts this into an 8bit integer image for your monitor, but it is possible to get a 32bit floating point RGB image instead. This image can then be fed to HDR software such as Luminance to allow you to work with your render as you would a bracketed HDR photo.

Getting the HDR render

Step one is to get ahold of an HDR copy of your render. It's possible to have LuxRender save this at regular intervals using the write_exr flag, but in case your exporter doesn't support that, or you just neglected to turn it on, you can get an HDR copy of your render at any time via the LuxRender GUI:

Lux save hdr.jpg

Below this in the menu is an option to enable tonemapping for your HDR image. If this is disabled, the resulting OpenEXR file will skip LuxRender imaging pipeline completely. It will simply convert the film to RGB and save the result. At first, this seems like the behavior we're after. After all, we are planning to tonemap elsewhere, right?

Not quite. This option will not apply the imaging pipeline completely like it would for a PNG or TGA output. Gamma correction is always skipped for OpenEXR files (as the spec dictates they should always be linear gamma), and the image is never "clamped" to a lower bit depth, since you still have a 32bit image to work with. While some of the tonemappers in LuxRender, such as Reinhard, will reduce the dynamic range of the image, Linear and Auto-linear will not. They simply scale the image. So if you "apply" the Linear or Auto-linear tonemapper, your image will still have the full dynamic range. In addition, applying the imaging pipeline will allow you to preserve LuxRender's bloom and glare filters, which work on the HDR data.

So, in short, you should go ahead and enable tonemapping on the HDR output, but make sure your tonemapper in the LuxRender GUI is set to Linear or Auto-linear first!

Once you click on the File > Export to Image > High Dynamic Range.. and select a location to save your EXR file, you will be presented with LuxRender's EXR saving dialog. Choose the following options and click Ok:

Exr options.jpg

Importing your image to Luminance

If you haven't already installed Luminance, you can go download it from its project site at http://qtpfsgui.sourceforge.net/?page_id=10

Fire it up, and click Open HDR Image in the top toolbar, and select your saved EXR file. It will open up the main viewer. By default, this is set in "Gamma 2.2" mode, which will give you a similar view to what you would see in LuxRender with the Linear tonemapper. In the Histogram (upper left, just below the toolbar) you can drag around the blue area to see your render at different exposure levels.

Luminance viewer.jpg

When you are done looking at your render, click the "Tonemap HDR image" button to enter the tonemapping view. You should have a blank grey window right now (since you haven't tonemapped anything yet) and a floating controls window. You can click "Tonemapping controls" to show or hide this. Click it if the controls don't come up by default for you.

Lum blank tonemap.jpg

The tonemapping controls window has the settings for the current tonemapping operator at the top, and below that some options for adjusting resolution and saving a set of tonemapping settings. It's best to leave pre-gamma at 1, and work off the original HDR, so leave those settings as is. You can adjust resolution to taste, larger sizes may take some time (20-30 seconds or more) to finish processing, so a smaller size helps when working with the thumbnails.

Tonemapping

Now let's get to work. The default tonemapper in Luminance is Mantiuk 06, which is probably the most useful one that it comes with. Mantiuk 06 works by isolating contrasting areas in the image and making them more even. It's main setting is the "contrast factor" slider, which is essentially the "strength" of the tonemapper. 1.0 means the tonemapper won't even off the contrast at all, lower values make the effect more intense. The default is 0.1, which is a bit on the strong side. (yes, lower values are "higher". This is because contrast factor is a value in an equation used to generate the final image). Saturation simply controls the saturation of the image, and detail factor allows an extra effect to help the tonemapper find more detail in the image.

While the default settings for Manituk 06 are a little bit strong, go ahead and try them just to see what happens.

First tonemap.jpg

The thumbnail of your results will pop up on one side of the window. You can expand this window full size by clicking the expand/fullscreen button on the window, like you would any other window. As you tonemap more versions, they will all appear in this window so you can easily compare different settings.

Here's the resulting image:

Coffee.Scene.00120 pregamma 1 mantiuk06 contrast mapping 0.1 saturation factor 0.8 detail factor 1.jpg

Pretty "dreamlike". We can put the contrast factor closer to 1.0 (such as 0.5) to reduce this effect, plus we can set saturation back to 1.0:

Coffee.Scene.00120 pregamma 1 mantiuk06 contrast mapping 0.5 saturation factor 1 detail factor 1.jpg

That's better. It looks more realistic now, but we have still prevented any areas of the image from clipping out. To make it a bit more surreal, we can drop contrast factor back down a bit, to 0.35:

Coffee.Scene.00120 pregamma 1 mantiuk06 contrast mapping 0.35 saturation factor 1 detail factor 1.jpg

Ok, that was fun. But what if we want something REALLY crazy? In the Tonemapping settings, at the top, open the "operator" menu and select "Fattal". If you run with the defaults, you will probably see this:

Fattal size.jpg

So, to see what we are doing, we have to set our resolution up to max:

Coffee.Scene.00120 pregamma 1 fattal alpha 1 beta 0.9 saturation 0.8 noiseredux 0.jpg

WHOA.

Saving and Combining Tonemappings

Often you will find there isn't any particular setting you like best. You might find you get the best results if you save a couple of different tonemappings and stack them together in a image editor, where you can adjust the opacity of each one to get the desired result.

To save a particular tonemapping, select its window then hit "Save As" in top toolbar. I normally like to save tonemappings as a PNG file, you can always convert it to a JPG later to post online or send to people, but a PNG keeps the full quality around in your working copy.

This image was made by combining the Fattal and Mantiuk (with contrast factor = 0.35) images with the result from LuxRender's Linear tonemapper:

Final.jpg