Raytracing   • Raytracing •

< Raytracing

< IBL and HDRI


> Intro

> Overview

> Correction

• HDRI and Gamma


 

— IBL and HDRI: HDRI for IBL, HDRI and Gamma —

Making an HDRI

Conventional pictures have a dynamic range of 1:256 for each of the colours red, green and blue — at least for the 16 million colours a computer monitor can display. Pictures with a high dynamic range (HDRI) can save a dynamic range of 1:4 billion (4,000 millions) for each of the three colours.

To create an HDRI, the same view has to be photographed several times with different f-stop settings and/or shutter speeds. The picture taken with a high number f-stop and a fast shutter speed shows the bright parts in the right light while the darker parts are just black. Those with a smaller f-stop number and a longer exposition time have the bright parts hopelessly burned out but the dark parts are nicely lit. The picture below demonstrates what is meant.

exp

With a dedicated program, the individual pictures in the series are combined to an HDRI that includes the combined dynamic range. If the sun is to be shown on the picture, you should start with the highest f-stop number to close the lens as much as possible, and with the highest shutter speed, i.e. the shortest exposition time.

The opening of the aperture of the iris by a full f-stop or the doubling of the exposition time double the light that hits the camera. For a series of exposures for an HDRI, one f-stop position or shutter speed setting may be skipped. This means that the light that enters the camera can be quadrupled from shot to shot.

If an HDRI is to be made in a raytracing program, the scene has to be rendered several times with different light intensities illuminating the scene. It is good to now that the Intensity Amount in Bryce works linear. This means that doubling the Intensity Amount also doubles the light output (25 - 50 - 100 - 200 - …).

Unfortunately, this is not the whole truth.
Digital cameras equipped with a CCD chip collect the light in a linear fashion, they do not save the picture that way, though, to simulate the behavior of chemical film emulsion. Cameras with a CMOS chip collect the light in a logarithmic manner, but they save the picture taken again in a fashion to emulate conventional film.

The curves in the graph below that run from top left to bottom right show what you would expect and what you actually get.

HDRI programs «know» about this and compensate for this gamma correction of usually 2.2 (if you don't tell them otherwise) when combining the pictures of a series to an HDRI. In some programs, the camera curve can be assessed and stored in the program for a more accurate compensation.

To calculate the light intensity, rise the pixel value to the power of the gamma value.
Example: Pixel value 92, Gamma value 2.2, Light Intensity = 92^2.2 = 20,909.

Gamma

The values shown in the graph were determined as follows. A series of pictures was taken from a sheet of white paper with the digital camera using different shutter speeds. These photographs were applied as material on a 2D-face in Bryce. The 2D-face was set into a pitch black cube and lit by a radial light. The intensity of the radial light was adjusted until the screen brightness was just saturated.

The curves from top right to the lower left are the values needed to light an uniformly grey surface. These experiments did not yield scientifically accurate results but are enough to show how the Bryce lights behave.


Photograph Example

Below a series of pictures taken with a digital camera from a mirror ball. As can be seen, the f-stop remains set while the exposition time was doubled for each subsequent exposure.

1/4000 s   1/2000 s   1/1000 s   1/0500 s
f 8 - 1/4000 s   f 8 - 1/2000 s   f 8 - 1/1000 s   f 8 - 1/5000 s
 
1/4000 s   1/2000 s   1/1000 s   1/0500 s
f 8 - 1/250 s   f 8 - 1/125 s   f 8 - 1/60 s   f 8 - 1/30 s

As HDRI, this picture has got a dynamic range of 1:3,667 and a Radiosity of 59 at 8 f-stops.


Render Example

As example «Dragonland» was used. At the place of the camera, a small mirror ball was positioned.

DL 1   DL 2   DL 3
Second Sun: -40,
Sky Color: 25/3/38,
Haze: black;
f-stop: 32,
Shutter: 1/4000 s.
  Second Sun: -10,
Sky Color: 50/64/76,
Haze: grey;
f-stop: 16,
Shutter: 1/1000 s.
  Second Sun: 0,
Sky Color: 63/127/155,
Haze: grey;
f-stop: 8,
Shutter: 1/250 s.
 
DL 4   DL 5   DL 6
Second Sun: +10,
Sky Color: 63/127/155,
Haze: white;
f-stop: 4,
Shutter: 1/60 s.
  Second Sun: +20,
Sky Color: 150/19/255,
Haze: white;
f-stop: 2,
Shutter: 1/30 s.
  Second Sun: +40,
Sky Color: 19/255/255,
Haze: white;
f-stop: 2,
Shutter: 1/8.s

The f-stop and shutter values are the ones that were entered into the HDRI program. The HDRI was calculated without exposure correction. The HDRI has a dynamic range of 1:1,782,312 and a Radiosity of 128,000 at 17 f-stops.


Cheat Example

Of course, we can always cheat. The sky dome was rendered only once. Contrast, brightness and gamma was adjusted in a graphics application. The series of pictures of a mirror ball shown below resulted from these manipulations.

Dom 1     Dom 1     Dom 1     Dom 1     Dom 1
Gamma: 0.5
Brightness: 255
f-stop: 32,
Shutter: 1/4000 s.
    Gamma: 1.0
Brightness: 255
f-stop: 16,
Shutter: 1/1000 s.
    Gamma: 2.0
Brightness: 255
f-stop: 8,
Shutter: 1/250 s. 
    Gamma: 4.0
Brightness: 128
f-stop: 4,
Shutter: 1/60 s.  
    Gamma: 4.0
Brightness: 255
f-stop: 2,
Shutter: 1/30 s.

The f-stop and shutter values are the ones that were entered into the HDRI program.The HDRI was calculated without exposure correction. The HDRI has a dynamic range of 1:135,510 and a Radiosity of 34,099 at 15 f-stops.


Calibration Curves

As a rule of thumb you can assume a gamma of 2.2 for a photograph taken with a digital camera. Bryce Radial Lights have a gamma of 1. The graph «f-stop Relationships» above was empirically determined using a white picture. If you need it more accurate, the camera gamma response can be determined. The program HDRShop can do that. The procedures can be used to determine the gamma of a Bryce radial light as well, of course.

Gamma Curve of a Digital Camera.
A series of photographs were taken with a Nikon D50 camera. Each photograph was different by the equivalent of one f-stop. The series of photographs was loaded into HDR Shop to have the gamma calibration curve calculated (10,000 iterations, regularized).

D50 photograph and curve

Calibration curve for the camera based on the picture at left as a series of differently exposed pictures. The curve is not linear.

Gamma curve of a Bryce Radial Light which illuminates a photograph.
The photograph shown above was applied as material to a 2D-Face. The 2D-Face was put into a pitch black sphere and recorded by the Bryce camera. At the same place as the camera, a Radial Light with Linear Falloff was set. The Amount of Intensity was increased in the sequence 4 - 8 - 16 - 32 - 64 - 128 and in each light, an image was rendered. The series of pictures was loaded into HDRShop and the gamma curve of the Radial Light determined.

Bryce picture and curve

Calibration curve for the Radial Light based on the picture at left as a series of differently illuminated pictures in front of a black sphere. The curve is almost linear.

Gamma curve of a Bryce Radial Light which illuminates a synthetic picture
To be sure there were no errors introduced by the photograph, the same experiment was repeated with a picture created in a graphics application.

Bryce picture and curve

Calibration curve for the Radial Light based on the picture at left as a series of differently illuminated pictures in front of a black sphere. The curve is very nearly linear.

Gamma corrected curve of a Bryce Radial Light.
Here, the Gamma Correction in the Render Options was ticked. The Radial Light still works the same but the rendered picture is gamma corrected and this can be seen in the calibration curve.

Bryce picture and gamma curve

Calibration curve for the Radial Light based on the picture at left as a series of differently illuminated pictures in front of a black sphere; with Gamma Correction engaged!

Is all this labour necessary?
The gamma calibration curve for a camera is only needed if it is intended to create an HDRI from a series of photographs and measure the light intensities; for example for astronomical pictures from stars and nebulae. If the HDRI is used as panorama for IBL in a raytracing program, accuracy is no issue. In fact, you get a higher dynamic range if you combine a series of rendered pictures with a gamma of 2.2 to an HDRI.

 
  © 2004 - 2018 by Horo Wernli.