/usr/bin/optics2rad is in radiance 4R0+20110410-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/bin/csh -f
# RCSid $Id: optics2rad.csh,v 2.3 2008/08/25 04:50:31 greg Exp $
#
# Convert Optics 5 output to correct Radiance input
#
if ($#argv < 1) then
echo "Usage: $0 optics.mat .."
exit 1
endif
set optf=`mktemp /tmp/optfmt.XXXXXXX`
cat > $optf << '_EOF_'
void glass $(name)_glass
0
0
3 ${Rtn} ${Gtn} ${Btn}
void BRTDfunc $(name)_front
10
${fRrho} ${fGrho} ${fBrho}
${Rtau} ${Gtau} ${Btau}
0 0 0
.
0
9 0 0 0 0 0 0 0 0 0
void BRTDfunc $(name)_back
10
${bRrho} ${bGrho} ${bBrho}
${Rtau} ${Gtau} ${Btau}
0 0 0
.
0
9 0 0 0 0 0 0 0 0 0
'_EOF_'
echo "# Output generated by $0 from $*"
sed -e '/^[^#]/d' -e '/^$/d' $*
set outf=`mktemp /tmp/outfmt.XXXXXX`
cat > $outf << '_EOF_'
void glass $(name)
0
0
3 ${Rtn} ${Gtn} ${Btn}
'_EOF_'
rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \
-e 'lum(r,g,b):.265*r+.670*g+.065*b' \
-e 'trans=lum(Rtau,Gtau,Btau)' \
-e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \
-e 'cond=0.005-abs(rfront-rback)' \
-i $optf -o $outf $*
cat > $outf << '_EOF_'
void BRTDfunc $(name)
10
rR_clear rG_clear rB_clear
${Rtau}*tR_clear ${Gtau}*tG_clear ${Btau}*tB_clear
0 0 0
window.cal
0
15 0 0 0 0 0 0 0 0 0
${fRrho} ${fGrho} ${fBrho}
${bRrho} ${bGrho} ${bBrho}
'_EOF_'
rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \
-e 'lum(r,g,b):.265*r+.670*g+.065*b' \
-e 'trans=lum(Rtau,Gtau,Btau)' \
-e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \
-e 'cond=and(trans-.645, not(0.005-abs(rfront-rback)))' \
-i $optf -o $outf $*
cat > $outf << '_EOF_'
void BRTDfunc $(name)
10
rR_bronze rG_bronze rB_bronze
${Rtau}*tR_bronze ${Gtau}*tG_bronze ${Btau}*tB_bronze
0 0 0
window.cal
0
15 0 0 0 0 0 0 0 0 0
${fRrho} ${fGrho} ${fBrho}
${bRrho} ${bGrho} ${bBrho}
'_EOF_'
rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \
-e 'lum(r,g,b):.265*r+.670*g+.065*b' \
-e 'trans=lum(Rtau,Gtau,Btau)' \
-e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \
-e 'cond=and(not(trans-.645), not(0.005-abs(rfront-rback)))' \
-i $optf -o $outf $*
rm -f $optf $outf
|