ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/veil.cal
Revision: 1.2
Committed: Wed Nov 21 18:10:45 2018 UTC (5 years, 6 months ago) by greg
Branch: MAIN
Changes since 1.1: +1 -0 lines
Log Message:
Added missing RCSid tag

File Contents

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