ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/veil.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 2 months 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 Add veiling glare caused by bright sources to an image.
3 Input is direction and illuminances of sources as may
4 be determined with the Radiance program, findglare(1).
5
6 N : Number of glaring sources
7 SDx(i) : x component of normalized direction to source i
8 SDy(i) : y component of same
9 SDz(i) : z component of same
10 I(i) : illuminance (lux) due to i in source's direction
11 (multiply the luminance by the solid angle)
12
13 An automated way to get this is to send the output of findglare
14 into tabfunc, i.e.:
15
16 findglare [options] | sed -e '1,/^BEGIN glare source$/d' \
17 -e '/^END glare source$/,$d' \
18 | rcalc -e '$1=recno;$2=$1;$3=$2;$4=$3;$5=$4*$5' \
19 | tabfunc SDx SDy SDz I > glrsrc.cal
20
21 Then, simply define N with "N:I(0)" either with a -e option to
22 pcomb or as an additional line in glrsrc.cal, i.e.:
23
24 pcomb -f glrsrc.cal -e 'N:I(0)' -f veil.cal orig.pic > veil.pic
25 }
26
27 bound(a,x,b) : if(a-x, a, if(x-b, b, x));
28 Acos(x) : acos(bound(-1,x,1));
29
30 { mul(t) : if(.5*PI/180-t, 9.2/.5^2, 9.2/(180/PI)^2/(t*t)); }
31
32 mul(t) : if(1.58724464*PI/180-t, 9.2/((if(t-.00291,t,.00291)*(180/PI))^3.44),
33 9.2/((180/PI*t)*(1.5+180/PI*t)));
34
35 Dx1 = Dx(1); Dy1 = Dy(1); Dz1 = Dz(1); { minor optimization }
36
37 angle(i) = Acos(SDx(i)*Dx1+SDy(i)*Dy1+SDz(i)*Dz1);
38
39 sum(i) = if(i-.5, mul(angle(i))*I(i)+sum(i-1), 0);
40
41 veil = le(1)/WE * sum(N);
42
43 ro = ri(1) + veil;
44 go = gi(1) + veil;
45 bo = bi(1) + veil;