1 |
|
#!/bin/csh -f |
2 |
< |
# SCCSid "$SunId$ SGI" |
2 |
> |
# RCSid: $Id$ |
3 |
|
# |
4 |
|
# Compute best ambient value for a scene and append to rad input file |
5 |
|
# |
27 |
|
rad -n -s -V $argv[1] \ |
28 |
|
| rpict @$tf.opt -av 0 0 0 -aw 16 -dv- -S 1 -x 16 -y 16 -ps 1 $oct \ |
29 |
|
| ra_rgbe - '\!pvalue -h -H -d' > $tf.dat |
30 |
+ |
echo \# Rad input file modified by $0 `date` >> $argv[1] |
31 |
|
if ( $?doexpos ) then |
32 |
|
(echo -n 'EXPOSURE= '; \ |
33 |
< |
total -u $tf.dat | rcalc -e '$1=1/(.265*$1+.670*$2+.065*$3)') \ |
33 |
> |
total -u $tf.dat | rcalc -e '$1=2/(.265*$1+.670*$2+.065*$3)') \ |
34 |
|
>> $argv[1] |
35 |
|
endif |
36 |
|
lookamb -h -d $tf.amb | rcalc -e '$1=$10;$2=$11;$3=$12' >> $tf.dat |
37 |
< |
set lavg=`rcalc -e 'lum=.265*$1+.670*$2+.065*$3;cond=lum-1e-5' $tf.dat | total -m -p` |
37 |
> |
set lavg=`rcalc -e '$1=lum;lum=.265*$1+.670*$2+.065*$3;cond=lum-1e-5' $tf.dat | total -m -p` |
38 |
|
if ( $?docolor ) then |
39 |
|
set cavg=(`total -m $tf.dat`) |
40 |
|
set av=(`rcalc -n -e "r=$cavg[1];g=$cavg[2];b=$cavg[3];sf=$lavg/(.265*r+.670*g+.065*b)" -e '$1=sf*r;$2=sf*g;$3=sf*b'`) |