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 Setting the Scene Setting the Scene Camera Modeling Camera Modeling Basic Shading Basic Shading Procedural Shading Procedural Shading Recursive Ray Tracing – Reflection Recursive Ray Tracing – Reflection Recursive Ray Tracing – Transmission Recursive Ray Tracing – Transmission Tone Reproduction Tone Reproduction Checkpoint 7 Tone Reproduction Goal is to take this from CG units to real units! Change your ray tracer so that it: Maps lighting units (0-1) to real lighting units Applies a tone reproduction operator to compress these simulated radiances to display radiances 1
The framework The framework HDR HDR Image Image (10 -8 - 10 8 cd/m 2 ) RESULTS OF RAY TRACER Capture Response Display Capture Response Display compression compression Output Output device device Image Device Image Device Appearance Appearance color management color management The framework Compression HDR You will implement two different tone Image (10 -8 - 10 8 cd/m 2 ) reproduction operators: RESULTS OF RAY TRACER Perceptual: Ward’s from Graphics Gems IV Capture Response Display Photographic: Reinhard, et al. in 2002 Target Device: maximum output luminance of compression new parameter L dmax. Assume standard sRGB Output color space. device Image Device Appearance (0 - Ldmax) color management Color Management The framework For sake of the checkpoint HDR Image You can ignore Color Appearance Modeling (10 -8 - 10 8 cd/m 2 ) (assume target viewing conditions is the same as RESULTS OF RAY TRACER the actual viewing condition) Capture Response Display Assume a simple actual device that has a maximum output of L dmax and a gamma of 1 with standard sRGB color space. compression Output Simple linear scaling of target image by L dmax device Image Device Appearance (0 - 1) (0 - Ldmax) color management 2
Steps to modifying the ray tracer Step 1: Prepare your HDR image The values in each image pixel will New parameters: represent illuminance at that pixel from L max = maximum illuminance from the the scene. scene Currently in range of 0-1. L dmax = maximum display illuminance. Multiply each channel of each pixel by L max whichTR = which tone reproduction Call the result operator to use. R (x,y) -- illuminance of red channel G (x,y) -- illuimanance of green channel B (x,y) -- illuminance of blue channel Step 2: Calculate overall luminance Step 2: Calculate overall illuminance For both tone reproduction operators, Like in photography, the operators deal you will need absolute luminance at in luminances and not radiances. each pixel (in addition to luminance on 120 an RGB basis). 100 % Efficiency 80 L (x,y) = absolute luminance at pixel x,y 60 40 20 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 Step 3: Perform compression Step 2: Calculate overall illuminance Quick and dirty approximation to pixel You will implement two different tone reproduction operators: illuminance given R, G, B : Perceptual: Ward’s from Graphics Gems IV Based on standard CRT color space. Photographic: Reinhard, et al. in 2002 More on that later. L (x,y) = 0.27 R (x,y)+0.67 G (x,y) +0.06 B (x,y) Compression: Note: L is in the range [0, L max ] will be applied on R(x,y), G(x,y), B(x,y) defines R target (x,y), G target (x,y), B target (x,y) In range [0, L dmax ] 3
Step 4: Apply device model Questions so far? Assume a simple actual device that has a maximum output of L dmax and a gamma of 1 with standard sRGB color space. Simple linear scaling of target image by L dmax R final (x,y) = R target (x,y) / L dmax G final (x,y) = G target (x,y) / L dmax B final (x,y) = B target (x,y) / L dmax Let’s talk about the compression (step 3) Ward Tone Reproduction Operators 2.5 � � sf = 1.219 + ( L d max /2) 0.4 Perceptual: Ward’s from Graphics Gems IV � � 0.4 Photographic: Reinhard, et al. in 2002 1.219 + L wa � � Ward model: Ward’s TR Operator defines a scale Simple heuristic based on perceptual tests. factor: L d = sf L w Includes some visual adaptation. Easy to implement Where Gets the job done!!! L wa = adaptation luminance (can use log-average luminance in scene) Ward Tone Reproduction Log Average Luminance 2.5 � � sf = 1.219 + ( L d max /2) 0.4 � � 0.4 To find the log-average luminance of scene 1.219 + L wa � � Calculate sf by setting L wa = L � � L = exp 1 � � log( � + L ( x , y )) � Final display colors (R target , G target , � � N � � x , y B target ) are the results of applying where the sf to the R, G, B . L (x,y) = absolute luminance at pixel x,y N = number of pixels δ = some small number (to prevent log going to infinity) 4
Let’s talk about the compression (step 3) Reinhard Tone Reproduction 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/ Reinhard Tone Reproduction Reinhard Tone Reproduction Step 1 Basic idea: Create scaled luminance values R s , G s , B s by mapping Define the “key” value to the average the key value to Zone V (18% gray) scene luminance and map that to Zone 5. B s = a R s = a G s = a L B ( x , y ) L R ( x , y ) L G ( x , y ) You’ll need log average luminance as caculated for Ward where Map remaining luminances based on L = the key value “photographic-like” response. R/G/B(x,y) = scene luminance at pixel x,y a = % gray for zone V; use a = 0.18 R s , G s , B s (x,y) = scaled luminance, i.e., Reinhard Tone Reproduction Reinhard Tone Reproduction Step 2 Step 3 Calculate target display luminance by simulating illumination. Find the reflectance for R r , G r , B r , based on film-like Assume that illuminant is “white” with luminance L dmax response R s ( x , y ) G s ( x , y ) B s ( x , y ) G t arg et ( x , y ) = G r ( x , y ) L d max B t arg et ( x , y ) = B r ( x , y ) L d max R r ( x , y ) = G r ( x , y ) = B r ( x , y ) = R t arg et ( x , y ) = R r ( x , y ) L d max 1 + R s ( x , y ) 1 + G s ( x , y ) 1 + B s ( x , y ) where where R target , G target , B target (x,y) = target display luminance R r , G r , B r (x,y) = reflectance (range 0-1) R s , G s , B s (x,y) = scaled luminance R r , G r , B r (x,y)= reflectance (range 0-1) 5
Reinhard’s Results Checkpoint 7 To be posted to Web site Six images produced by running your raytracer with three different values of L max for EACH tone reproduction operator: Lo-Range Lighting: L max = 1 nit Mid-Range Lighting: L max = 1000 nits Hi-Range Lighting: L max = 10,000 nits Tone Reproduction: Ward’s Model Reinhard’s Model Using TR Operator Linear scaling Please label which is which. Loss of detail [Reinhard,2002] Extra Extra Checkpoint 7 Due dates: For 5 points Images to be posted to Web site Modify the Reinhard operator so that you Midnight Nov 1st . can specify what luminance is to be used Final raytracer code to be posted on as the key value. mycourses (dropboxes set up) Constant value Midnight Nov 2nd Value at a pixel Code must be submitted to receive credit! Experiment with different illuminant in Include README with details to build Reinhard model. Questions? 6
Recommend
More recommend