ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/ferwerda.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 1 month ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R5, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 {
2 Tone Mapping Operator due to Ferwerda, Pattanaik, Shirley and Greenberg
3 (Siggraph 1996, pp. 249-258). Equilibrium adaptation version.
4
5 Greg Ward August 30, 1996
6
7 We assume that the input picture has already been adjusted with
8 a reasonable exposure value, which gives the adaptation level
9 implicitly. The visual acuity function should also be applied
10 if desired separately prior to applying this mapping. We're
11 also assuming that the picture is in standard RGB Radiance format,
12 not CIE XYZ format.
13
14 Don't use the -o option of pcomb, just execute like so:
15
16 % pcomb -f ferwerda.cal exposed.pic > mapped.pic
17 }
18
19 sL(r,g,b) = .062*r + .608*g + .330*b; { approx. scotopic brightness }
20 Lwa : WE*.5/le(1); { world adaptation luminance }
21 lLwa : log10(Lwa);
22 Ldmax : 100; { maximum display luminance (cd/m^2) }
23 Lda : Ldmax/2; { display adaptation luminance }
24 lLda : log10(Lda);
25
26 { log10 of cone threshold luminance }
27 ltp(lLa) : if(-2.6 - lLa, -.72, if(lLa - 1.9, lLa - 1.255,
28 (.249*lLa + .65)^2.7 - .72));
29
30 { log10 of rod threshold luminance }
31 lts(lLa) : if(-3.94 - lLa, -2.86, if(lLa - -1.44, lLa - .395,
32 (.405*lLa + 1.6)^2.18 - 2.86));
33
34 { photopic multiplier }
35 mp : 10^(ltp(lLda) - ltp(lLwa));
36
37 { scotopic multiplier }
38 ms : 10^(lts(lLda) - lts(lLwa)) *
39 if(-2.5 - lLwa, 1, if(lLwa - .8, 0, (.8 - lLwa)/(.8 - -2.5)));
40
41 { display calibration factor }
42 df : WE/Ldmax/le(1);
43 { adjusted scotopic luminance }
44 msl = ms*df * sL(ri(1),gi(1),bi(1));
45 { compute output pixel }
46 ro = msl + mp*df * ri(1);
47 go = msl + mp*df * gi(1);
48 bo = msl + mp*df * bi(1);