Extracting Linear HDR (AKA scene-referred values) From Camera RAW files. Wee!
Much is made of the overexposure latitude contained within RAW images created by higher-end digital cameras such as DSLRs. The truth is, there can be extra data up there, but it may be hard to artfully extract. For the same reason we put the magenta filter on the Viper, the over-range values in a RAW file may be monochromatic and otherwise discontinuous from those in the sweet spot of the chip's sensitivity.
However, Adobe Camera RAW does a mighty fine job of milking every last bit of usable picture data out of a RAW file, and it is now included with After Effects 7.0. If you underexpose your RAW shots enough so that the highlights aren't clipping, you can effectively create single-exposure HDR images for use in your 32bpc projects.*
First, set up your project for a linear floating point workflow. This means switching the bit depth to 32bpc and selecting a linear (gamma 1.0) profile as your Project Working Space.
Then import your RAW file. Here's what one .NEF from my Nikon D70 looks like in the Camera RAW window:
Notice that the clouds are almost clipping, but Camera RAW is rounding into the clip nicely. That's lovely for photography, but for visual effects I'd like to get a more accurate representation of the actual light values present in the scene. I need to remove all the artful tweakings of the tone curve that Camera RAW has suggested.
To do this, set Shadows, Brightness, Contrast and Saturation all to zero. Then go into the Curve tab and select the Linear preset for the curve.
Feel free to adjust other settings to taste, such as those found in the Detail and Lens tabs. Remember, there is always subjective processing involved when making a viewable image from a RAW file, so don't shy away from these controls. You should also select a White Balance setting that makes your image look the most neutral (if you want it to have a color cast, better to do that later in float).
Your final step is to adjust the Exposure slider until no highlights are clipping. Use the histogram and the Highlights checkbox in the upper right to guide you. Find a setting just below the point at which you begin to clip.
Here's what my image looks like after following these steps:
Now hit OK (twice) and you are returned to After Effects. Select the footage item in the Project pane and you'll see that the profile it is importing via appears next to the thumbnail. Since our Project Working Space doesn't match any of the four export profiles supported by Camera RAW, our image defaults to the sRGB space. Which means that once we add it to a comp, it requires the same conversion to our project's working profile as any sRGB image would — the same one we went over in Part 1:
Now that we've got a comp that contains our linear and underexposed scene-referred pixels, we can simply add an exposure effect and boost it up until our image "looks right." In doing so, we'll push the brighter pixels into the overbright range, effectively creating an HDR image. Here's my image exposed up by a stop:
Photographers may be distressed by the clipped clouds in this image. Speaking for myself, when I shoot stills, I'm trying to artfully compress the broad dynamic range of the world into a viewable range. In other words, I'm trying to take a High Dynamic Range world and squeeze it onto a Low Dynamic Range print. But what we just did is the opposite — we took a LDR image and made it HDR. Why do such a thing? Images that visual effects artists shoot are often used not as standalone works of art but as ingredients in a final composite. Our HDR sky, blown out as it may appear, will react very realistically to subsequent compositing. If we blur it or composite transparent things in front of it, we will see the detail in those clouds come back in a photographic way.
Or we can play with other ways besides just tone curves to create a more pleasing final image. For example, we could take an image like this:
...and multiply it over our shot, for this result:
Happy RAW shooting!
* In other words, it's more your RAW format's ability to handle underexposure than overexposure that allows it to capture HDR imagery!