Ray Tracing Assignment • Goal is to reproduce the following So You Want to Write a Ray Tracer Checkpoint 7 – Tone Reproduction Whitted, 1980 Ray Tracing Assignment Ray Tracing Assignment • Seven checkpoints • Seven checkpoints 1. Setting the Scene 1. Setting the Scene 2. Camera Modeling 2. Camera Modeling 3. Basic Shading 3. Basic Shading 4. Procedural Shading 4. Procedural Shading 5. Recursive Ray Tracing – Reflection 5. Recursive Ray Tracing – Reflection 6. Recursive Ray Tracing – Transmission 6. Recursive Ray Tracing – Transmission 7. Tone Reproduction 7. Tone Reproduction Tone Reproduction Checkpoint 7 • Goal is to take this from CG units to real units! • Change your ray tracer so that it: 1. Maps lighting units (0-1) to real lighting units 2. Applies a tone reproduction operator to compress these simulated radiances to display radiances 1
Tone Reproduction Tone Reproduction • The L max argument • So, instead of converting 0-1 to 0 – 255 for – Will be used as the maximum luminance in the scene. java or using 0-1 directly for openGL, you will – In other words, all lighting units are multiplied by Lmax – Multiply illumination color values by L max to get • A CG lighting value of 1 will be mapped to this maximum physical lighting value (unit is nits). illuminances -> [0, L max ] • Other lighting values will be scaled linearly. – Then, apply a tone reproduction operator to get • Note: You will now have illumination values that exceed 1. • The L dmax argument pixel values. – Maximum luminance of the display device. – Use value of 100 nits. • I.e., we are post-processing the results of the rendering pipeline. Two Tone Reproduction Operators Ward Tone Reproduction • You will implement two different tone reproduction operators: – Perceptual: Ward’s from Graphics Gems IV • Ward’s TR Operator defines a scale factor: – Photographic: Reinhard, et al. in 2002 – L d = sf L w • Where – L wa = adaptation luminance • Average luminance in scene. Applying to RGB Luminance • One problem with tone reproduction is that it is • Like in photography, the operators deal in tone reproduction and not color reproduction luminances and not radiances. – Thus, we will apply the same operator to each of the R, 120 G, B components, while in reality we should do a 100 separate calculation for each component. % Efficiency 80 – Related to this tone reproduction operator, you will 60 • Calculate sf using a calculated luminance based on a 40 combination of R, G, B components at each pixel 20 • Then, we will apply sf to each R,G,B component. 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 7 0 2 5 7 0 2 5 7 0 2 5 7 0 2 5 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 Wavelength 2
Log Average Luminance Luminance • quick and dirty approximation to pixel • To find the log-average luminance of scene luminance given R, G, B : ⎛ ⎞ 1 ∑ ⎜ ⎟ = δ + L exp log( L ( x , y )) ⎜ ⎟ w w ⎝ ⎠ N x , y L w (x,y) = 0.27 R (x,y)+0.67 G (x,y) +0.06 B (x,y) • where – L w (x,y) = luminance at pixel x,y • Note: L w is in the range [0, L max ] – N = number of pixels – δ = some small number (to prevent log going to infinity) Ward Tone Reproduction Reinhard Tone Reproduction 1. Scale R, G, B values by L max for each pixel 2. Calculate log-avg luminance ( L w ) 3. Calculate sf by setting L wa = L w 4. Final display colors (L d ) are the results of applying the sf calculated in step 2 to the R, G, B values from step 1. • Mimics Ansel Adam’s Zone System – http://photography.cicada.com/zs/emulator/ Reinhard Tone Reproduction Reinhard Tone Reproduction • Basic idea: • Step 1 – Map the average scene luminance to Zone 5. – Obtain luminance values – Map remaining luminances based on – Scale R, G, B values by L max for each pixel “photographic-like” response. • Step 2 – Calculate log-avg luminance ( L w ) • Hey, you already did this for Ward. 3
Reinhard Tone Reproduction Reinhard Tone Reproduction • Step 3 • Step 4 – scale the luminance values R s , G s , B s by mapping the key – Find the display luminances for R d , G d , and B d , based on value to Zone V (18% gray) film-like response = a L s ( x , y ) L ( x , y ) L s ( x , y ) = L L ( x , y ) * L dmax w + d where 1 L s ( x , y ) L – = the key value w where – L(x,y) = scene luminance at pixel x,y , i.e., your calculated R,G,B values scaled by L max – L s (x,y) = scaled luminance,i.e., R s , G s , B s – L d = display luminances, R d , G d , B d – a = % gray for zone V; use a = 0.18 – L s (x,y) = scaled luminance, i.e., R s , G s , B s • L d is in the range [0, L dmax ] Reinhard Tone Reproduction Tone Reproduction • Step 5 • Gamma – Final pixel colors are determined by scaling L d found d = γ in step 3 by L dmax L ( L max V ) d • In final step, for this assignment, we are assuming a gamma of 1. Reinhard’s Results Tone Reproduction • Gamma – If gamma was not assumed as 1.0 1/γ L V = d L d max Using TR Operator Linear scaling Loss of detail [ Reinhard,2002] 4
Checkpoint 7 Checkpoint 7 • To be posted to Web site • Due dates: – Six images produced by running your raytracer with – Images to be posted to Web site three different values of L max for EACH tone • Midnight Nov 8 th . reproduction operator: – Final raytracer code to be submitted via e-mail or • Lo-Range Lighting: L max = 1 nit mycourses (zip or tar file please) • Mid-Range Lighting: L max = 100 nits • Midnight Nov 10 th ( note change in schedule ) • Hi-Range Lighting: L max = 1000 nits • Code must be submitted to receive credit! – Tone Reproduction: • If zip, name rit_raytracer.zip. • Ward’s Model • Include README with details to build • Reinhard’s Model • Please label which is which. • Questions? 5
Recommend
More recommend