| 23 |  | my $nproc = 1; | 
| 24 |  | my $doforw = 0; | 
| 25 |  | my $doback = 1; | 
| 26 | < | my $pctcull = 95; | 
| 27 | < | my $gunit = "Meter"; | 
| 26 | > | my $pctcull = 90; | 
| 27 | > | my $gunit = "meter"; | 
| 28 |  | my @dim; | 
| 29 |  | # Get options | 
| 30 |  | while ($#ARGV >= 0) { | 
| 45 |  | } elsif ("$ARGV[0]" =~ /^[-+]b/) { | 
| 46 |  | $doback = ("$ARGV[0]" =~ /^\+/); | 
| 47 |  | } elsif ("$ARGV[0]" eq "-t") { | 
| 48 | + | # Use value < 0 for rttree_reduce bypass | 
| 49 |  | $pctcull = $ARGV[1]; | 
| 50 |  | shift @ARGV; | 
| 51 |  | } elsif ("$ARGV[0]" =~ /^-t[34]$/) { | 
| 71 |  | } | 
| 72 |  | # Check that we're actually being asked to do something | 
| 73 |  | die "Must have at least one of +forward or +backward\n" if (!$doforw && !$doback); | 
| 73 | – | # Name our own persist file? | 
| 74 | – | my $persistfile; | 
| 75 | – | if ( $tensortree && $nproc > 1 && "$rtargs" !~ /-PP /) { | 
| 76 | – | $persistfile = "$td/pfile.txt"; | 
| 77 | – | $rtargs = "-PP $persistfile $rtargs"; | 
| 78 | – | } | 
| 74 |  | # Get scene description and dimensions | 
| 75 |  | my $radscn = "$td/device.rad"; | 
| 76 |  | my $mgfscn = "$td/device.mgf"; | 
| 108 |  | print "<!-- File produced by: genBSDF @savedARGV -->\n"; | 
| 109 |  | print | 
| 110 |  | '<WindowElementType>System</WindowElementType> | 
| 111 | + | <FileType>BSDF</FileType> | 
| 112 |  | <Optical> | 
| 113 |  | <Layer> | 
| 114 |  | <Material> | 
| 118 |  | printf "\t\t<Thickness unit=\"$gunit\">%.3f</Thickness>\n", $dim[5] - $dim[4]; | 
| 119 |  | printf "\t\t<Width unit=\"$gunit\">%.3f</Width>\n", $dim[1] - $dim[0]; | 
| 120 |  | printf "\t\t<Height unit=\"$gunit\">%.3f</Height>\n", $dim[3] - $dim[2]; | 
| 121 | < | print "\t\t<DeviceType>Integral</DeviceType>\n"; | 
| 121 | > | print "\t\t<DeviceType>Other</DeviceType>\n"; | 
| 122 | > | print " </Material>\n"; | 
| 123 |  | # Output MGF description if requested | 
| 124 |  | if ( $geout ) { | 
| 125 | < | print "\t\t<Geometry format=\"MGF\" unit=\"$gunit\">\n"; | 
| 125 | > | print "\t<Geometry format=\"MGF\">\n"; | 
| 126 | > | print "<MGFblock unit=\"$gunit\">\n"; | 
| 127 |  | printf "xf -t %.6f %.6f 0\n", -($dim[0]+$dim[1])/2, -($dim[2]+$dim[3])/2; | 
| 128 |  | open(MGFSCN, "< $mgfscn"); | 
| 129 |  | while (<MGFSCN>) { print $_; } | 
| 130 |  | close MGFSCN; | 
| 131 |  | print "xf\n"; | 
| 132 | < | print "\t\t</Geometry>\n"; | 
| 132 | > | print "\t\t</MGFblock>\n"; | 
| 133 | > | print "\t</Geometry>\n"; | 
| 134 |  | } | 
| 136 | – | print " </Material>\n"; | 
| 135 |  | # Set up surface sampling | 
| 136 |  | my $nx = int(sqrt($nsamp*($dim[1]-$dim[0])/($dim[3]-$dim[2])) + .5); | 
| 137 |  | my $ny = int($nsamp/$nx + .5); | 
| 155 |  |  | 
| 156 |  | #-------------- End of main program segment --------------# | 
| 157 |  |  | 
| 160 | – | #++++++++++++++ Kill persistent rtrace +++++++++++++++++++# | 
| 161 | – | sub persist_end { | 
| 162 | – | if ( $persistfile && open(PFI, "< $persistfile") ) { | 
| 163 | – | while (<PFI>) { | 
| 164 | – | s/^[^ ]* //; | 
| 165 | – | kill('ALRM', $_); | 
| 166 | – | last; | 
| 167 | – | } | 
| 168 | – | close PFI; | 
| 169 | – | } | 
| 170 | – | } | 
| 171 | – |  | 
| 158 |  | #++++++++++++++ Tensor tree BSDF generation ++++++++++++++# | 
| 159 |  | sub do_tree_bsdf { | 
| 174 | – | # Get sampling rate and subdivide task | 
| 175 | – | my $ns2 = $ns; | 
| 176 | – | $ns2 /= 2 if ( $tensortree == 3 ); | 
| 177 | – | my $nsplice = $nproc; | 
| 178 | – | $nsplice *= 10 if ($nproc > 1); | 
| 179 | – | $nsplice = $ns2 if ($nsplice > $ns2); | 
| 180 | – | $nsplice = 999 if ($nsplice > 999); | 
| 181 | – | @pdiv = (0, int($ns2/$nsplice)); | 
| 182 | – | my $nrem = $ns2 % $nsplice; | 
| 183 | – | for (my $i = 1; $i < $nsplice; $i++) { | 
| 184 | – | my $nv = $pdiv[$i] + $pdiv[1]; | 
| 185 | – | ++$nv if ( $nrem-- > 0 ); | 
| 186 | – | push @pdiv, $nv; | 
| 187 | – | } | 
| 188 | – | die "Script error 1" if ($pdiv[-1] != $ns2); | 
| 160 |  | # Shirley-Chiu mapping from unit square to disk | 
| 161 |  | $sq2disk = ' | 
| 162 |  | in_square_a = 2*in_square_x - 1; | 
| 199 |  | print "\t<DataDefinition>\n"; | 
| 200 |  | print "\t\t<IncidentDataStructure>TensorTree$tensortree</IncidentDataStructure>\n"; | 
| 201 |  | print "\t</DataDefinition>\n"; | 
| 202 | < | # Fork parallel rtcontrib processes to compute each side | 
| 203 | < | my $npleft = $nproc; | 
| 204 | < | if ( $doback ) { | 
| 205 | < | for (my $splice = 0; $splice < $nsplice; $splice++) { | 
| 206 | < | if (! $npleft ) { | 
| 236 | < | wait(); | 
| 237 | < | die "rtcontrib process reported error" if ( $? ); | 
| 238 | < | $npleft++; | 
| 239 | < | } | 
| 240 | < | bg_tree_rtcontrib(0, $splice); | 
| 241 | < | $npleft--; | 
| 242 | < | } | 
| 243 | < | while (wait() >= 0) { | 
| 244 | < | die "rtcontrib process reported error" if ( $? ); | 
| 245 | < | $npleft++; | 
| 246 | < | } | 
| 247 | < | persist_end(); | 
| 248 | < | ttree_out(0); | 
| 249 | < | } | 
| 250 | < | if ( $doforw ) { | 
| 251 | < | for (my $splice = 0; $splice < $nsplice; $splice++) { | 
| 252 | < | if (! $npleft ) { | 
| 253 | < | wait(); | 
| 254 | < | die "rtcontrib process reported error" if ( $? ); | 
| 255 | < | $npleft++; | 
| 256 | < | } | 
| 257 | < | bg_tree_rtcontrib(1, $splice); | 
| 258 | < | $npleft--; | 
| 259 | < | } | 
| 260 | < | while (wait() >= 0) { | 
| 261 | < | die "rtcontrib process reported error" if ( $? ); | 
| 262 | < | $npleft++; | 
| 263 | < | } | 
| 264 | < | persist_end(); | 
| 265 | < | ttree_out(1); | 
| 266 | < | } | 
| 202 | > |  | 
| 203 | > | # Start rcontrib processes for compute each side | 
| 204 | > | do_tree_rtcontrib(0) if ( $doback ); | 
| 205 | > | do_tree_rtcontrib(1) if ( $doforw ); | 
| 206 | > |  | 
| 207 |  | }       # end of sub do_tree_bsdf() | 
| 208 |  |  | 
| 209 | < | # Run rtcontrib process in background to generate tensor tree samples | 
| 210 | < | sub bg_tree_rtcontrib { | 
| 271 | < | my $pid = fork(); | 
| 272 | < | die "Cannot fork new process" unless defined $pid; | 
| 273 | < | if ($pid > 0) { return $pid; } | 
| 209 | > | # Run rcontrib process to generate tensor tree samples | 
| 210 | > | sub do_tree_rtcontrib { | 
| 211 |  | my $forw = shift; | 
| 275 | – | my $pn = shift; | 
| 276 | – | my $pbeg = $pdiv[$pn]; | 
| 277 | – | my $plen = $pdiv[$pn+1] - $pbeg; | 
| 212 |  | my $matargs = "-m $bmodnm"; | 
| 213 | < | if ( !$forw || !$doback ) { $matargs .= " -m $fmodnm"; } | 
| 214 | < | my $cmd = "rtcontrib $rtargs -h -ff -fo -c $nsamp " . | 
| 213 | > | if ( !$forw || !$doback || $tensortree==3 ) { $matargs .= " -m $fmodnm"; } | 
| 214 | > | my $cmd = "rcontrib $rtargs -h -ff -fo -n $nproc -c $nsamp " . | 
| 215 |  | "-e '$disk2sq' -bn '$ns*$ns' " . | 
| 216 |  | "-b '$ns*floor(out_square_x*$ns)+floor(out_square_y*$ns)' " . | 
| 217 | < | "-o $td/%s_" . sprintf("%03d", $pn) . ".flt $matargs $octree"; | 
| 217 | > | "-o $td/%s.flt $matargs $octree"; | 
| 218 |  | if ( $tensortree == 3 ) { | 
| 219 |  | # Isotropic BSDF | 
| 220 | < | $cmd = "cnt $plen $ny $nx " . | 
| 221 | < | "| rcalc -e 'r1=rand(($pn+.8681)*recno-.673892)' " . | 
| 222 | < | "-e 'r2=rand(($pn-5.37138)*recno+67.1737811)' " . | 
| 223 | < | "-e 'r3=rand(($pn+3.17603772)*recno+83.766771)' " . | 
| 224 | < | "-e 'Dx=1-2*($pbeg+\$1+r1)/$ns;Dy:0;Dz=sqrt(1-Dx*Dx)' " . | 
| 220 | > | my $ns2 = $ns / 2; | 
| 221 | > | $cmd = "cnt $ns2 $ny $nx " . | 
| 222 | > | "| rcalc -e 'r1=rand(.8681*recno-.673892)' " . | 
| 223 | > | "-e 'r2=rand(-5.37138*recno+67.1737811)' " . | 
| 224 | > | "-e 'r3=rand(+3.17603772*recno+83.766771)' " . | 
| 225 | > | "-e 'Dx=1-2*(\$1+r1)/$ns;Dy:0;Dz=sqrt(1-Dx*Dx)' " . | 
| 226 |  | "-e 'xp=(\$3+r2)*(($dim[1]-$dim[0])/$nx)+$dim[0]' " . | 
| 227 |  | "-e 'yp=(\$2+r3)*(($dim[3]-$dim[2])/$ny)+$dim[2]' " . | 
| 228 |  | "-e 'zp=$dim[5-$forw]' -e 'myDz=Dz*($forw*2-1)' " . | 
| 233 |  | # Anisotropic BSDF | 
| 234 |  | # Sample area vertically to improve load balance, since | 
| 235 |  | # shading systems usually have bilateral symmetry (L-R) | 
| 236 | < | $cmd = "cnt $plen $ns $ny $nx " . | 
| 237 | < | "| rcalc -e 'r1=rand(($pn+.8681)*recno-.673892)' " . | 
| 238 | < | "-e 'r2=rand(($pn-5.37138)*recno+67.1737811)' " . | 
| 239 | < | "-e 'r3=rand(($pn+3.17603772)*recno+83.766771)' " . | 
| 240 | < | "-e 'r4=rand(($pn-2.3857833)*recno-964.72738)' " . | 
| 241 | < | "-e 'in_square_x=($pbeg+\$1+r1)/$ns' " . | 
| 236 | > | $cmd = "cnt $ns $ns $ny $nx " . | 
| 237 | > | "| rcalc -e 'r1=rand(.8681*recno-.673892)' " . | 
| 238 | > | "-e 'r2=rand(-5.37138*recno+67.1737811)' " . | 
| 239 | > | "-e 'r3=rand(3.17603772*recno+83.766771)' " . | 
| 240 | > | "-e 'r4=rand(-2.3857833*recno-964.72738)' " . | 
| 241 | > | "-e 'in_square_x=(\$1+r1)/$ns' " . | 
| 242 |  | "-e 'in_square_y=(\$2+r2)/$ns' -e '$sq2disk' " . | 
| 243 |  | "-e 'xp=(\$4+r3)*(($dim[1]-$dim[0])/$nx)+$dim[0]' " . | 
| 244 |  | "-e 'yp=(\$3+r4)*(($dim[3]-$dim[2])/$ny)+$dim[2]' " . | 
| 248 |  | "| $cmd"; | 
| 249 |  | } | 
| 250 |  | # print STDERR "Starting: $cmd\n"; | 
| 251 | < | exec($cmd);             # no return; status report to parent via wait | 
| 252 | < | die "Cannot exec: $cmd\n"; | 
| 253 | < | }       # end of bg_tree_rtcontrib() | 
| 251 | > | system "$cmd" || die "Failure running rcontrib"; | 
| 252 | > | ttree_out($forw); | 
| 253 | > | }       # end of do_tree_rtcontrib() | 
| 254 |  |  | 
| 255 |  | # Simplify and output tensor tree results | 
| 256 |  | sub ttree_out { | 
| 257 |  | my $forw = shift; | 
| 258 |  | my $side = ("Back","Front")[$forw]; | 
| 259 | < | # Only output one transmitted distribution, preferring backwards | 
| 260 | < | if ( !$forw || !$doback ) { | 
| 259 | > | my $cmd; | 
| 260 | > | # Only output one transmitted anisotropic distribution, preferring backwards | 
| 261 | > | if ( !$forw || !$doback || $tensortree==3 ) { | 
| 262 |  | print | 
| 263 |  | '       <WavelengthData> | 
| 264 |  | <LayerNumber>System</LayerNumber> | 
| 266 |  | <SourceSpectrum>CIE Illuminant D65 1nm.ssp</SourceSpectrum> | 
| 267 |  | <DetectorSpectrum>ASTM E308 1931 Y.dsp</DetectorSpectrum> | 
| 268 |  | <WavelengthDataBlock> | 
| 269 | < | <WavelengthDataDirection>Transmission</WavelengthDataDirection> | 
| 270 | < | <AngleBasis>LBNL/Shirley-Chiu</AngleBasis> | 
| 269 | > | '; | 
| 270 | > | print "\t\t\t<WavelengthDataDirection>Transmission $side</WavelengthDataDirection>\n"; | 
| 271 | > | print | 
| 272 | > | '                       <AngleBasis>LBNL/Shirley-Chiu</AngleBasis> | 
| 273 |  | <ScatteringDataType>BTDF</ScatteringDataType> | 
| 274 |  | <ScatteringData> | 
| 275 |  | '; | 
| 276 | < | system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " . | 
| 277 | < | q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } . | 
| 278 | < | "$td/" . ($bmodnm,$fmodnm)[$forw] . "_???.flt " . | 
| 276 | > | $cmd = "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " . | 
| 277 | > | q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' }; | 
| 278 | > | if ($pctcull >= 0) { | 
| 279 | > | $cmd .= "-of $td/" . ($bmodnm,$fmodnm)[$forw] . ".flt " . | 
| 280 |  | "| rttree_reduce -a -h -ff -t $pctcull -r $tensortree -g $ttlog2"; | 
| 281 | < | die "Failure running rttree_reduce" if ( $? ); | 
| 281 | > | system "$cmd" || die "Failure running rttree_reduce"; | 
| 282 | > | } else { | 
| 283 | > | $cmd .= "$td/" . ($bmodnm,$fmodnm)[$forw] . ".flt"; | 
| 284 | > | print "{\n"; | 
| 285 | > | system "$cmd" || die "Failure running rcalc"; | 
| 286 | > | for (my $i = ($tensortree==3)*$ns*$ns*$ns/2; $i-- > 0; ) { | 
| 287 | > | print "0\n"; | 
| 288 | > | } | 
| 289 | > | print "}\n"; | 
| 290 | > | } | 
| 291 |  | print | 
| 292 |  | '                       </ScatteringData> | 
| 293 |  | </WavelengthDataBlock> | 
| 306 |  | print "\t\t\t<WavelengthDataDirection>Reflection $side</WavelengthDataDirection>\n"; | 
| 307 |  | print | 
| 308 |  | '                       <AngleBasis>LBNL/Shirley-Chiu</AngleBasis> | 
| 309 | < | <ScatteringDataType>BRDF</ScatteringDataType> | 
| 309 | > | <ScatteringDataType>BTDF</ScatteringDataType> | 
| 310 |  | <ScatteringData> | 
| 311 |  | '; | 
| 312 | < | system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " . | 
| 313 | < | q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } . | 
| 314 | < | "$td/" . ($fmodnm,$bmodnm)[$forw] . "_???.flt " . | 
| 312 | > | $cmd = "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " . | 
| 313 | > | q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' }; | 
| 314 | > | if ($pctcull >= 0) { | 
| 315 | > | $cmd .= "-of $td/" . ($fmodnm,$bmodnm)[$forw] . ".flt " . | 
| 316 |  | "| rttree_reduce -a -h -ff -t $pctcull -r $tensortree -g $ttlog2"; | 
| 317 | < | die "Failure running rttree_reduce" if ( $? ); | 
| 317 | > | system "$cmd" || die "Failure running rttree_reduce"; | 
| 318 | > | } else { | 
| 319 | > | $cmd .= "$td/" . ($fmodnm,$bmodnm)[$forw] . ".flt"; | 
| 320 | > | print "{\n"; | 
| 321 | > | system "$cmd" || die "Failure running rcalc"; | 
| 322 | > | for (my $i = ($tensortree==3)*$ns*$ns*$ns/2; $i-- > 0; ) { | 
| 323 | > | print "0\n"; | 
| 324 | > | } | 
| 325 | > | print "}\n"; | 
| 326 | > | } | 
| 327 |  | print | 
| 328 |  | '                       </ScatteringData> | 
| 329 |  | </WavelengthDataBlock> | 
| 340 |  | $tcal = ' | 
| 341 |  | DEGREE : PI/180; | 
| 342 |  | sq(x) : x*x; | 
| 343 | < | Kpola(r) : select(r+1, -5, 5, 15, 25, 35, 45, 55, 65, 75, 90); | 
| 343 | > | Kpola(r) : select(r+1, 0, 5, 15, 25, 35, 45, 55, 65, 75, 90); | 
| 344 |  | Knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12); | 
| 345 |  | Kaccum(r) : if(r-.5, Knaz(r) + Kaccum(r-1), 0); | 
| 346 |  | Kmax : Kaccum(Knaz(0)); | 
| 384 |  | kbin = kbin2(Acos(abs(Dz)),Atan2(Dy,Dx)); | 
| 385 |  | '; | 
| 386 |  | my $ndiv = 145; | 
| 387 | < | # Compute scattering data using rtcontrib | 
| 387 | > | # Compute scattering data using rcontrib | 
| 388 |  | my @tfarr; | 
| 389 |  | my @rfarr; | 
| 390 |  | my @tbarr; | 
| 391 |  | my @rbarr; | 
| 392 |  | my $cmd; | 
| 393 | < | my $rtcmd = "rtcontrib $rtargs -h -ff -fo -n $nproc -c $nsamp " . | 
| 393 | > | my $rtcmd = "rcontrib $rtargs -h -ff -fo -n $nproc -c $nsamp " . | 
| 394 |  | "-e '$kcal' -b kbin -bn $ndiv " . | 
| 395 |  | "-o '$td/%s.flt' -m $fmodnm -m $bmodnm $octree"; | 
| 396 |  | my $rccmd = "rcalc -e '$tcal' " . | 
| 407 |  | system "$cmd" || die "Failure running: $cmd\n"; | 
| 408 |  | @tfarr = `$rccmd $td/$fmodnm.flt`; | 
| 409 |  | die "Failure running: $rccmd $td/$fmodnm.flt\n" if ( $? ); | 
| 410 | + | chomp(@tfarr); | 
| 411 |  | @rfarr = `$rccmd $td/$bmodnm.flt`; | 
| 412 |  | die "Failure running: $rccmd $td/$bmodnm.flt\n" if ( $? ); | 
| 413 | + | chomp(@rfarr); | 
| 414 |  | } | 
| 415 |  | if ( $doback ) { | 
| 416 |  | $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " . | 
| 435 |  | <AngleBasis> | 
| 436 |  | <AngleBasisName>LBNL/Klems Full</AngleBasisName> | 
| 437 |  | <AngleBasisBlock> | 
| 438 | < | <Theta>0</Theta> | 
| 439 | < | <nPhis>1</nPhis> | 
| 440 | < | <ThetaBounds> | 
| 441 | < | <LowerTheta>0</LowerTheta> | 
| 442 | < | <UpperTheta>5</UpperTheta> | 
| 443 | < | </ThetaBounds> | 
| 484 | < | </AngleBasisBlock> | 
| 485 | < | <AngleBasisBlock> | 
| 486 | < | <Theta>10</Theta> | 
| 487 | < | <nPhis>8</nPhis> | 
| 488 | < | <ThetaBounds> | 
| 489 | < | <LowerTheta>5</LowerTheta> | 
| 490 | < | <UpperTheta>15</UpperTheta> | 
| 491 | < | </ThetaBounds> | 
| 492 | < | </AngleBasisBlock> | 
| 493 | < | <AngleBasisBlock> | 
| 494 | < | <Theta>20</Theta> | 
| 495 | < | <nPhis>16</nPhis> | 
| 496 | < | <ThetaBounds> | 
| 497 | < | <LowerTheta>15</LowerTheta> | 
| 498 | < | <UpperTheta>25</UpperTheta> | 
| 499 | < | </ThetaBounds> | 
| 500 | < | </AngleBasisBlock> | 
| 501 | < | <AngleBasisBlock> | 
| 502 | < | <Theta>30</Theta> | 
| 503 | < | <nPhis>20</nPhis> | 
| 504 | < | <ThetaBounds> | 
| 505 | < | <LowerTheta>25</LowerTheta> | 
| 506 | < | <UpperTheta>35</UpperTheta> | 
| 507 | < | </ThetaBounds> | 
| 508 | < | </AngleBasisBlock> | 
| 509 | < | <AngleBasisBlock> | 
| 510 | < | <Theta>40</Theta> | 
| 511 | < | <nPhis>24</nPhis> | 
| 512 | < | <ThetaBounds> | 
| 513 | < | <LowerTheta>35</LowerTheta> | 
| 514 | < | <UpperTheta>45</UpperTheta> | 
| 515 | < | </ThetaBounds> | 
| 516 | < | </AngleBasisBlock> | 
| 517 | < | <AngleBasisBlock> | 
| 518 | < | <Theta>50</Theta> | 
| 519 | < | <nPhis>24</nPhis> | 
| 520 | < | <ThetaBounds> | 
| 521 | < | <LowerTheta>45</LowerTheta> | 
| 522 | < | <UpperTheta>55</UpperTheta> | 
| 523 | < | </ThetaBounds> | 
| 524 | < | </AngleBasisBlock> | 
| 525 | < | <AngleBasisBlock> | 
| 526 | < | <Theta>60</Theta> | 
| 527 | < | <nPhis>24</nPhis> | 
| 528 | < | <ThetaBounds> | 
| 529 | < | <LowerTheta>55</LowerTheta> | 
| 530 | < | <UpperTheta>65</UpperTheta> | 
| 531 | < | </ThetaBounds> | 
| 532 | < | </AngleBasisBlock> | 
| 533 | < | <AngleBasisBlock> | 
| 534 | < | <Theta>70</Theta> | 
| 535 | < | <nPhis>16</nPhis> | 
| 536 | < | <ThetaBounds> | 
| 537 | < | <LowerTheta>65</LowerTheta> | 
| 538 | < | <UpperTheta>75</UpperTheta> | 
| 539 | < | </ThetaBounds> | 
| 540 | < | </AngleBasisBlock> | 
| 541 | < | <AngleBasisBlock> | 
| 542 | < | <Theta>82.5</Theta> | 
| 543 | < | <nPhis>12</nPhis> | 
| 544 | < | <ThetaBounds> | 
| 545 | < | <LowerTheta>75</LowerTheta> | 
| 546 | < | <UpperTheta>90</UpperTheta> | 
| 547 | < | </ThetaBounds> | 
| 438 | > | <Theta>0</Theta> | 
| 439 | > | <nPhis>1</nPhis> | 
| 440 | > | <ThetaBounds> | 
| 441 | > | <LowerTheta>0</LowerTheta> | 
| 442 | > | <UpperTheta>5</UpperTheta> | 
| 443 | > | </ThetaBounds> | 
| 444 |  | </AngleBasisBlock> | 
| 445 | + | <AngleBasisBlock> | 
| 446 | + | <Theta>10</Theta> | 
| 447 | + | <nPhis>8</nPhis> | 
| 448 | + | <ThetaBounds> | 
| 449 | + | <LowerTheta>5</LowerTheta> | 
| 450 | + | <UpperTheta>15</UpperTheta> | 
| 451 | + | </ThetaBounds> | 
| 452 | + | </AngleBasisBlock> | 
| 453 | + | <AngleBasisBlock> | 
| 454 | + | <Theta>20</Theta> | 
| 455 | + | <nPhis>16</nPhis> | 
| 456 | + | <ThetaBounds> | 
| 457 | + | <LowerTheta>15</LowerTheta> | 
| 458 | + | <UpperTheta>25</UpperTheta> | 
| 459 | + | </ThetaBounds> | 
| 460 | + | </AngleBasisBlock> | 
| 461 | + | <AngleBasisBlock> | 
| 462 | + | <Theta>30</Theta> | 
| 463 | + | <nPhis>20</nPhis> | 
| 464 | + | <ThetaBounds> | 
| 465 | + | <LowerTheta>25</LowerTheta> | 
| 466 | + | <UpperTheta>35</UpperTheta> | 
| 467 | + | </ThetaBounds> | 
| 468 | + | </AngleBasisBlock> | 
| 469 | + | <AngleBasisBlock> | 
| 470 | + | <Theta>40</Theta> | 
| 471 | + | <nPhis>24</nPhis> | 
| 472 | + | <ThetaBounds> | 
| 473 | + | <LowerTheta>35</LowerTheta> | 
| 474 | + | <UpperTheta>45</UpperTheta> | 
| 475 | + | </ThetaBounds> | 
| 476 | + | </AngleBasisBlock> | 
| 477 | + | <AngleBasisBlock> | 
| 478 | + | <Theta>50</Theta> | 
| 479 | + | <nPhis>24</nPhis> | 
| 480 | + | <ThetaBounds> | 
| 481 | + | <LowerTheta>45</LowerTheta> | 
| 482 | + | <UpperTheta>55</UpperTheta> | 
| 483 | + | </ThetaBounds> | 
| 484 | + | </AngleBasisBlock> | 
| 485 | + | <AngleBasisBlock> | 
| 486 | + | <Theta>60</Theta> | 
| 487 | + | <nPhis>24</nPhis> | 
| 488 | + | <ThetaBounds> | 
| 489 | + | <LowerTheta>55</LowerTheta> | 
| 490 | + | <UpperTheta>65</UpperTheta> | 
| 491 | + | </ThetaBounds> | 
| 492 | + | </AngleBasisBlock> | 
| 493 | + | <AngleBasisBlock> | 
| 494 | + | <Theta>70</Theta> | 
| 495 | + | <nPhis>16</nPhis> | 
| 496 | + | <ThetaBounds> | 
| 497 | + | <LowerTheta>65</LowerTheta> | 
| 498 | + | <UpperTheta>75</UpperTheta> | 
| 499 | + | </ThetaBounds> | 
| 500 | + | </AngleBasisBlock> | 
| 501 | + | <AngleBasisBlock> | 
| 502 | + | <Theta>82.5</Theta> | 
| 503 | + | <nPhis>12</nPhis> | 
| 504 | + | <ThetaBounds> | 
| 505 | + | <LowerTheta>75</LowerTheta> | 
| 506 | + | <UpperTheta>90</UpperTheta> | 
| 507 | + | </ThetaBounds> | 
| 508 | + | </AngleBasisBlock> | 
| 509 |  | </AngleBasis> | 
| 510 |  | </DataDefinition> | 
| 511 |  | '; | 
| 543 |  | <WavelengthDataDirection>Reflection Front</WavelengthDataDirection> | 
| 544 |  | <ColumnAngleBasis>LBNL/Klems Full</ColumnAngleBasis> | 
| 545 |  | <RowAngleBasis>LBNL/Klems Full</RowAngleBasis> | 
| 546 | < | <ScatteringDataType>BRDF</ScatteringDataType> | 
| 546 | > | <ScatteringDataType>BTDF</ScatteringDataType> | 
| 547 |  | <ScatteringData> | 
| 548 |  | '; | 
| 549 |  | # Output front reflection (transposed order) | 
| 593 |  | <WavelengthDataDirection>Reflection Back</WavelengthDataDirection> | 
| 594 |  | <ColumnAngleBasis>LBNL/Klems Full</ColumnAngleBasis> | 
| 595 |  | <RowAngleBasis>LBNL/Klems Full</RowAngleBasis> | 
| 596 | < | <ScatteringDataType>BRDF</ScatteringDataType> | 
| 596 | > | <ScatteringDataType>BTDF</ScatteringDataType> | 
| 597 |  | <ScatteringData> | 
| 598 |  | '; | 
| 599 | < | # Output back reflection (reciprocity averaging) | 
| 599 | > | # Output back reflection (transposed order) | 
| 600 |  | for (my $od = 0; $od < $ndiv; $od++) { | 
| 601 |  | for (my $id = 0; $id < $ndiv; $id++) { | 
| 602 |  | print $rbarr[$ndiv*$id + $od], ",\n"; |