1
So You Want to Write a Ray Tracer
Checkpoint 7 – Tone Reproduction
Ray Tracing Assignment
Goal is to reproduce the following Whitted, 1980
Ray Tracing Assignment Goal is to reproduce the following Whitted, - - PDF document
So You Want to Write a Ray Tracer Checkpoint 7 Tone Reproduction Ray Tracing Assignment Goal is to reproduce the following Whitted, 1980 1 Ray Tracing Assignment Seven checkpoints Setting the Scene Camera Modeling
Goal is to reproduce the following Whitted, 1980
Setting the Scene Camera Modeling Basic Shading Procedural Shading Recursive Ray Tracing – Reflection Recursive Ray Tracing – Transmission Tone Reproduction
Setting the Scene Camera Modeling Basic Shading Procedural Shading Recursive Ray Tracing – Reflection Recursive Ray Tracing – Transmission Tone Reproduction
Goal is to take this from CG units to real units!
Maps lighting units (0-1) to real lighting
Applies a tone reproduction operator to
color management compression
Image Appearance Device
HDR Image Output device
color management compression
Image Appearance Device
HDR Image (10-8 - 108 cd/m2) RESULTS OF RAY TRACER Output device
You will implement two different tone
Perceptual: Ward’s from Graphics Gems IV Photographic: Reinhard, et al. in 2002 Target Device: maximum output luminance of
color management compression
Image Appearance Device
HDR Image (10-8 - 108 cd/m2) RESULTS OF RAY TRACER Output device (0 - Ldmax)
For sake of the checkpoint
You can ignore Color Appearance Modeling
Assume a simple actual device that has a
Simple linear scaling of target image by Ldmax
color management compression
Image Appearance Device
HDR Image (10-8 - 108 cd/m2) RESULTS OF RAY TRACER Output device (0 - Ldmax) (0 - 1)
New parameters:
Lmax = maximum illuminance from the
Ldmax = maximum display illuminance. whichTR = which tone reproduction
The values in each image pixel will
Currently in range of 0-1. Multiply each channel of each pixel by Lmax Call the result
R (x,y) -- illuminance of red channel G (x,y) -- illuimanance of green channel B (x,y) -- illuminance of blue channel
For both tone reproduction operators,
L (x,y) = absolute luminance at pixel x,y
Like in photography, the operators deal
20 40 60 80 100 120 3 7 5 4 4 2 5 4 5 4 7 5 5 5 2 5 5 5 5 7 5 6 6 2 5 6 5 6 7 5 7 7 2 5 7 5 Wavelength % Efficiency
Quick and dirty approximation to pixel
Based on standard CRT color space.
Note: L is in the range [0, Lmax]
You will implement two different tone
Perceptual: Ward’s from Graphics Gems IV Photographic: Reinhard, et al. in 2002
More on that later. Compression:
will be applied on R(x,y), G(x,y), B(x,y) defines Rtarget(x,y), Gtarget (x,y), Btarget (x,y) In range [0, Ldmax]
Assume a simple actual device that has a
Simple linear scaling of target image by Ldmax Rfinal (x,y) = Rtarget (x,y) / Ldmax Gfinal (x,y) = Gtarget (x,y) / Ldmax Bfinal (x,y) = Btarget (x,y) / Ldmax
Operators
Perceptual: Ward’s from Graphics Gems IV Photographic: Reinhard, et al. in 2002
Ward model:
Simple heuristic based on perceptual tests. Includes some visual adaptation. Easy to implement Gets the job done!!!
Ward’s TR Operator defines a scale factor:
Ld = sf Lw
Where
Lwa = adaptation luminance
(can use log-average luminance in scene)
0.4
To find the log-average luminance of scene where
L (x,y) = absolute luminance at pixel x,y N = number of pixels δ = some small number (to prevent log going to
x,y
Calculate sf by setting Lwa = L Final display colors (Rtarget, Gtarget,
0.4
Operators
Perceptual: Ward’s from Graphics Gems IV Photographic: Reinhard, et al. in 2002
Reinhard model:
Simple heuristic based on photographic systems. Models photographic-like response. Easy to implement Gets the job done!!!
Mimics Ansel Adam’s Zone System
http://photography.cicada.com/zs/emulator/
Basic idea:
Define the “key” value to the average
You’ll need log average luminance as caculated
Map remaining luminances based on
Step 1
Create scaled luminance values Rs, Gs, Bs by mapping
= the key value R/G/B(x,y) = scene luminance at pixel x,y a = % gray for zone V; use a = 0.18
Rs, Gs, Bs(x,y) = scaled luminance, i.e.,
Step 2
Find the reflectance for Rr, Gr, Br, based on film-like
Rs, Gs, Bs(x,y) = scaled luminance Rr, Gr, Br (x,y)= reflectance (range 0-1)
Rr(x,y) = Rs(x,y) 1+ Rs(x,y) Gr(x,y) = Gs(x,y) 1+ Gs(x,y) Br(x,y) = Bs(x,y) 1+ Bs(x,y)
Step 3
Calculate target display luminance by simulating illumination. Assume that illuminant is “white” with luminance Ldmax
Rtarget, Gtarget, Btarget(x,y) = target display luminance Rr, Gr, Br(x,y) = reflectance (range 0-1)
Rt arget(x,y) = Rr(x,y)Ld max Gt arget(x,y) = Gr(x,y)Ld max Bt arget(x,y) = B r(x,y)Ld max
[Reinhard,2002]
To be posted to Web site
Six images produced by running your raytracer
Lo-Range Lighting: Lmax = 1 nit Mid-Range Lighting: Lmax = 1000 nits Hi-Range Lighting: Lmax = 10,000 nits
Tone Reproduction:
Ward’s Model Reinhard’s Model
Please label which is which.
For 5 points
Modify the Reinhard operator so that you
Constant value Value at a pixel
Implement vignetting.
Due dates:
Images to be posted to Web site
Wednesday, Feb 13th .
Final raytracer code to be posted on
Feb 15th. Code must be submitted to receive credit! Include README with details to build
Questions?