ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pveil.csh
Revision: 3.2
Committed: Sat Feb 22 02:07:27 2003 UTC (21 years, 8 months ago) by greg
Content type: application/x-csh
Branch: MAIN
CVS Tags: rad3R5, rad3R6, rad3R6P1
Changes since 3.1: +1 -1 lines
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

# User Rev Content
1 greg 3.1 #!/bin/csh -f
2 greg 3.2 # RCSid: $Id$
3 greg 3.1 #
4     # Add veiling glare to picture
5     #
6     if ($#argv != 1) then
7     echo "Usage: $0 input.pic > output.pic"
8     exit 1
9     endif
10     set ifile=$1
11     set td=/usr/tmp
12     set gf=$td/av$$.gs
13     set cf=$td/av$$.cal
14     set tf=($gf $cf)
15     onintr quit
16     findglare -r 400 -c -p $ifile \
17     | sed -e '1,/^BEGIN glare source$/d' -e '/^END glare source$/,$d' \
18     > $gf
19     if ( -z $gf ) then
20     cat $ifile
21     goto quit
22     endif
23     ( rcalc -e '$1=recno;$2=$1;$3=$2;$4=$3;$5=$4*$5' $gf \
24     | tabfunc SDx SDy SDz I ; cat ) > $cf << '_EOF_'
25     N : I(0);
26     K : 9.2; { should be 9.6e-3/PI*(180/PI)^2 == 10.03 ? }
27     bound(a,x,b) : if(a-x, a, if(x-b, b, x));
28     Acos(x) : acos(bound(-1,x,1));
29     sq(x) : x*x;
30     mul(ct) : if(ct-cos(.5*PI/180), K/sq(.5), K/sq(180/PI)*ct/sq(Acos(ct)));
31     Dx1 = Dx(1); Dy1 = Dy(1); Dz1 = Dz(1); { minor optimization }
32     cosa(i) = SDx(i)*Dx1 + SDy(i)*Dy1 + SDz(i)*Dz1;
33     sum(i) = if(i-.5, mul(cosa(i))*I(i)+sum(i-1), 0);
34     veil = le(1)/WE * sum(N);
35     ro = ri(1) + veil;
36     go = gi(1) + veil;
37     bo = bi(1) + veil;
38     '_EOF_'
39     getinfo < $ifile | egrep '^((VIEW|EXPOSURE|PIXASPECT|PRIMARIES|COLORCORR)=|[^ ]*(rpict|rview|pinterp) )'
40     pcomb -f $cf $ifile
41     quit:
42     rm -f $tf