Ray Tracing Assignment Goal is to reproduce the following So You - - PDF document

ray tracing assignment
SMART_READER_LITE
LIVE PREVIEW

Ray Tracing Assignment Goal is to reproduce the following So You - - PDF document

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


slide-1
SLIDE 1

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

Seven checkpoints

  Setting the Scene  Camera Modeling  Basic Shading   Procedural Shading  Recursive Ray Tracing – Reflection  Recursive Ray Tracing – Transmission   Tone Reproduction

Ray Tracing Assignment

Seven checkpoints

  Setting the Scene  Camera Modeling  Basic Shading   Procedural Shading  Recursive Ray Tracing – Reflection  Recursive Ray Tracing – Transmission   Tone Reproduction

Checkpoint 7

 Goal is to take this from CG units to real units!

Tone Reproduction

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

slide-2
SLIDE 2

2 The framework

color management compression

Capture Response Display

Image Appearance Device

HDR Image Output device

The framework

color management compression

Capture Response Display

Image Appearance Device

HDR Image (10-8 - 108 cd/m2) RESULTS OF RAY TRACER Output device

Compression

 You will implement two different tone

reproduction operators:

 Perceptual: Ward’s from Graphics Gems IV  Photographic: Reinhard, et al. in 2002  Target Device: maximum output luminance of

new parameter Ldmax. Assume standard sRGB color space.

The framework

color management compression

Capture Response Display

Image Appearance Device

HDR Image (10-8 - 108 cd/m2) RESULTS OF RAY TRACER Output device (0 - Ldmax)

Color Management

 For sake of the checkpoint

 You can ignore Color Appearance Modeling

(assume target viewing conditions is the same as the actual viewing condition)

 Assume a simple actual device that has a

maximum output of Ldmax and a gamma of 1 with standard sRGB color space.

 Simple linear scaling of target image by Ldmax

The framework

color management compression

Capture Response Display

Image Appearance Device

HDR Image (10-8 - 108 cd/m2) RESULTS OF RAY TRACER Output device (0 - Ldmax) (0 - 1)

slide-3
SLIDE 3

3 Steps to modifying the ray tracer

 New parameters:

 Lmax = maximum illuminance from the

scene

 Ldmax = maximum display illuminance.  whichTR = which tone reproduction

  • perator to use.

Step 1: Prepare your HDR image

 The values in each image pixel will

represent illuminance at that pixel from the scene.

 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

Step 2: Calculate overall luminance

 For both tone reproduction operators,

you will need absolute luminance at each pixel (in addition to luminance on an RGB basis).

 L (x,y) = absolute luminance at pixel x,y

Step 2: Calculate overall illuminance

 Like in photography, the operators deal

in luminances and not radiances.

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

illuminance given R, G, B:

 Based on standard CRT color space.

L(x,y) = 0.27R(x,y)+0.67G(x,y) +0.06B(x,y)

 Note: L is in the range [0, Lmax]

Step 2: Calculate overall illuminance

Step 3: Perform compression

 You will implement two different tone

reproduction operators:

 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]

slide-4
SLIDE 4

4 Step 4: Apply device model

 Assume a simple actual device that has a

maximum output of Ldmax and a gamma of 1 with standard sRGB color space.

 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

Questions so far? Let’s talk about the compression (step 3)

 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 Tone Reproduction

Ward’s TR Operator defines a scale factor:

Ld = sf Lw

Where

Lwa = adaptation luminance (can use log-average luminance in scene)

sf = 1.219 + (Ld max /2)0.4 1.219 + Lwa

0.4

  • 2.5

 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

infinity)

Log Average Luminance

L = exp 1 N log( + L(x,y))

x,y

 Calculate sf by setting Lwa = L   Final display colors (Rtarget, Gtarget,

Btarget) are the results of applying the sf to the R, G, B.

Ward Tone Reproduction

sf = 1.219 + (Ld max /2)0.4 1.219 + Lwa

0.4

  • 2.5
slide-5
SLIDE 5

5 Let’s talk about the compression (step 3)

 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

 Basic idea:

 Define the “key” value to the average

scene luminance and map that to Zone 5.

 You’ll need log average luminance as caculated

for Ward

 Map remaining luminances based on

“photographic-like” response.

 Step 1

 Create scaled luminance values Rs, Gs, Bs by mapping

the key value to Zone V (18% gray)

where

 = 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.,

L

Reinhard Tone Reproduction

Rs = a L R(x,y) Gs = a L G(x,y)

Bs = a L B(x,y)

 Step 2

 Find the reflectance for Rr, Gr, Br, based on film-like

response

where

 Rs, Gs, Bs(x,y) = scaled luminance  Rr, Gr, Br (x,y)= reflectance (range 0-1)

Reinhard Tone Reproduction

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

where

 Rtarget, Gtarget, Btarget(x,y) = target display luminance  Rr, Gr, Br(x,y) = reflectance (range 0-1)

Reinhard Tone Reproduction

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

slide-6
SLIDE 6

6 Reinhard’s Results

[Reinhard,2002]

Linear scaling Loss of detail Using TR Operator

Checkpoint 7

 To be posted to Web site

 Six images produced by running your raytracer

with three different values of Lmax for EACH tone reproduction operator:

 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.

Extra Extra

 For 5 points

 Modify the Reinhard operator so that you

can specify what luminance is to be used as the key value.

 Constant value  Value at a pixel

 Experiment with different illuminant in

Reinhard model.

Checkpoint 7

 Due dates:

 Images to be posted to Web site

 Midnight Nov 1st .

 Final raytracer code to be posted on

mycourses (dropboxes set up)

 Midnight Nov 2nd  Code must be submitted to receive credit!  Include README with details to build

 Questions?