ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/genBSDF.pl
(Generate patch)

Comparing ray/src/util/genBSDF.pl (file contents):
Revision 2.24 by greg, Tue Aug 23 14:02:41 2011 UTC vs.
Revision 2.46 by greg, Mon Apr 7 21:33:25 2014 UTC

# Line 8 | Line 8
8   use strict;
9   use File::Temp qw/ :mktemp  /;
10   sub userror {
11 <        print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-t{3|4} Nlog2][-r \"ropts\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom] [input ..]\n";
11 >        print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-t{3|4} Nlog2][-r \"ropts\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom units] [input ..]\n";
12          exit 1;
13   }
14   my $td = mkdtemp("/tmp/genBSDF.XXXXXX");
# Line 16 | Line 16 | chomp $td;
16   my @savedARGV = @ARGV;
17   my $tensortree = 0;
18   my $ttlog2 = 4;
19 < my $nsamp = 10000;
19 > my $nsamp = 2000;
20   my $rtargs = "-w -ab 5 -ad 700 -lw 3e-6";
21   my $mgfin = 0;
22   my $geout = 1;
23   my $nproc = 1;
24   my $doforw = 0;
25   my $doback = 1;
26 < my $gunit = "Meter";
26 > my $pctcull = 90;
27 > my $gunit = "meter";
28   my @dim;
29   # Get options
30   while ($#ARGV >= 0) {
# Line 43 | Line 44 | while ($#ARGV >= 0) {
44                  $doforw = ("$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]$/) {
52                  $tensortree = substr($ARGV[0], 2, 1);
53                  $ttlog2 = $ARGV[1];
# Line 66 | Line 71 | while ($#ARGV >= 0) {
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);
69 # Name our own persist file?
70 my $persistfile;
71 if ( $tensortree && $nproc > 1 && "$rtargs" !~ /-PP /) {
72        $persistfile = "$td/pfile.txt";
73        $rtargs = "-PP $persistfile $rtargs";
74 }
74   # Get scene description and dimensions
75   my $radscn = "$td/device.rad";
76   my $mgfscn = "$td/device.mgf";
# Line 109 | Line 108 | print
108   print "<!-- File produced by: genBSDF @savedARGV -->\n";
109   print
110   '<WindowElementType>System</WindowElementType>
111 + <FileType>BSDF</FileType>
112   <Optical>
113   <Layer>
114          <Material>
# Line 118 | Line 118 | print
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 "\t\t<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 "</MGFblock>\n";
133 >        print "\t</Geometry>\n";
134   }
132 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);
136 > my $nx = int(sqrt($nsamp*($dim[1]-$dim[0])/($dim[3]-$dim[2])) + 1);
137 > my $ny = int($nsamp/$nx + 1);
138   $nsamp = $nx * $ny;
139   my $ns = 2**$ttlog2;
140   my (@pdiv, $disk2sq, $sq2disk, $tcal, $kcal);
# Line 149 | Line 151 | print
151   </WindowElement>
152   ';
153   # Clean up temporary files and exit
152 if ( $persistfile && open(PFI, "< $persistfile") ) {
153        while (<PFI>) {
154                s/^[^ ]* //;
155                kill('ALRM', $_);
156                last;
157        }
158        close PFI;
159 }
154   exec("rm -rf $td");
155  
156   #-------------- End of main program segment --------------#
157  
158   #++++++++++++++ Tensor tree BSDF generation ++++++++++++++#
159   sub do_tree_bsdf {
166 # Get sampling rate and subdivide task
167 my $ns2 = $ns;
168 $ns2 /= 2 if ( $tensortree == 3 );
169 my $nsplice = $nproc;
170 $nsplice *= 10 if ($nproc > 1);
171 $nsplice = $ns2 if ($nsplice > $ns2);
172 $nsplice = 999 if ($nsplice > 999);
173 @pdiv = (0, int($ns2/$nsplice));
174 my $nrem = $ns2 % $nsplice;
175 for (my $i = 1; $i < $nsplice; $i++) {
176        my $nv = $pdiv[$i] + $pdiv[1];
177        ++$nv if ( $nrem-- > 0 );
178        push @pdiv, $nv;
179 }
180 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;
# Line 202 | Line 181 | $disk2sq = '
181   norm_radians(p) : if(-p - PI/4, p + 2*PI, p);
182   in_disk_r = .999995*sqrt(Dx*Dx + Dy*Dy);
183   in_disk_phi = norm_radians(atan2(Dy, Dx));
184 < in_disk_rgn = floor((in_disk_phi + PI/4)/(PI/2)) + 1;
184 > in_disk_rgn = floor((.999995*in_disk_phi + PI/4)/(PI/2)) + 1;
185   out_square_a = select(in_disk_rgn,
186                          in_disk_r,
187                          (PI/2 - in_disk_phi)*in_disk_r/(PI/4),
# Line 220 | Line 199 | out_square_y = (out_square_b + 1)/2;
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 ) {
228 <                        wait();
229 <                        die "rtcontrib process reported error" if ( $? );
230 <                        $npleft++;
231 <                }
232 <                bg_tree_rtcontrib(0, $splice);
233 <                $npleft--;
234 <        }
235 <        while (wait() >= 0) {
236 <                die "rtcontrib process reported error" if ( $? );
237 <                $npleft++;
238 <        }
239 <        ttree_out(0);
240 < }
241 < if ( $doforw ) {
242 <        for (my $splice = 0; $splice < $nsplice; $splice++) {
243 <                if (! $npleft ) {
244 <                        wait();
245 <                        die "rtcontrib process reported error" if ( $? );
246 <                        $npleft++;
247 <                }
248 <                bg_tree_rtcontrib(1, $splice);
249 <                $npleft--;
250 <        }
251 <        while (wait() >= 0) {
252 <                die "rtcontrib process reported error" if ( $? );
253 <                $npleft++;
254 <        }
255 <        ttree_out(1);
256 < }
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 {
261 <        my $pid = fork();
262 <        die "Cannot fork new process" unless defined $pid;
263 <        if ($pid > 0) { return $pid; }
209 > # Run rcontrib process to generate tensor tree samples
210 > sub do_tree_rtcontrib {
211          my $forw = shift;
265        my $pn = shift;
266        my $pbeg = $pdiv[$pn];
267        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)' " .
# Line 288 | Line 233 | sub bg_tree_rtcontrib {
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]' " .
# Line 303 | Line 248 | sub bg_tree_rtcontrib {
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>
# Line 320 | Line 266 | print
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 " .
279 <        "| rttree_reduce -h -ff -r $tensortree -g $ttlog2";
280 < die "Failure running rttree_reduce" if ( $? );
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 -h -ff -t $pctcull -r $tensortree -g $ttlog2";
281 >        $cmd .= " -a" if ($tensortree == 3);
282 >        system "$cmd" || die "Failure running rttree_reduce";
283 > } else {
284 >        $cmd .= "$td/" . ($bmodnm,$fmodnm)[$forw] . ".flt";
285 >        print "{\n";
286 >        system "$cmd" || die "Failure running rcalc";
287 >        for (my $i = ($tensortree==3)*$ns*$ns*$ns/2; $i-- > 0; ) {
288 >                print "0\n";
289 >        }
290 >        print "}\n";
291 > }
292   print
293   '                       </ScatteringData>
294                  </WavelengthDataBlock>
# Line 348 | Line 307 | print
307   print "\t\t\t<WavelengthDataDirection>Reflection $side</WavelengthDataDirection>\n";
308   print
309   '                       <AngleBasis>LBNL/Shirley-Chiu</AngleBasis>
310 <                        <ScatteringDataType>BRDF</ScatteringDataType>
310 >                        <ScatteringDataType>BTDF</ScatteringDataType>
311                          <ScatteringData>
312   ';
313 < system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
314 <        q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } .
315 <        "$td/" . ($fmodnm,$bmodnm)[$forw] . "_???.flt " .
316 <        "| rttree_reduce -h -ff -r $tensortree -g $ttlog2";
317 < die "Failure running rttree_reduce" if ( $? );
313 > $cmd = "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
314 >        q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' };
315 > if ($pctcull >= 0) {
316 >        $cmd .= "-of $td/" . ($fmodnm,$bmodnm)[$forw] . ".flt " .
317 >        "| rttree_reduce -a -h -ff -t $pctcull -r $tensortree -g $ttlog2";
318 >        system "$cmd" || die "Failure running rttree_reduce";
319 > } else {
320 >        $cmd .= "$td/" . ($fmodnm,$bmodnm)[$forw] . ".flt";
321 >        print "{\n";
322 >        system "$cmd" || die "Failure running rcalc";
323 >        for (my $i = ($tensortree==3)*$ns*$ns*$ns/2; $i-- > 0; ) {
324 >                print "0\n";
325 >        }
326 >        print "}\n";
327 > }
328   print
329   '                       </ScatteringData>
330                  </WavelengthDataBlock>
# Line 372 | Line 341 | sub do_matrix_bsdf {
341   $tcal = '
342   DEGREE : PI/180;
343   sq(x) : x*x;
344 < Kpola(r) : select(r+1, -5, 5, 15, 25, 35, 45, 55, 65, 75, 90);
344 > Kpola(r) : select(r+1, 0, 5, 15, 25, 35, 45, 55, 65, 75, 90);
345   Knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12);
346   Kaccum(r) : if(r-.5, Knaz(r) + Kaccum(r-1), 0);
347   Kmax : Kaccum(Knaz(0));
# Line 393 | Line 362 | KprojOmega = PI * if(Kbin-.5,
362   $kcal = '
363   DEGREE : PI/180;
364   abs(x) : if(x, x, -x);
365 < Acos(x) : 1/DEGREE * if(x-1, 0, if(-1-x, 0, acos(x)));
365 > Acos(x) : if(x-1, 0, if(-1-x, PI, acos(x))) / DEGREE;
366   posangle(a) : if(-a, a + 2*PI, a);
367 < Atan2(y,x) : 1/DEGREE * posangle(atan2(y,x));
367 > Atan2(y,x) : posangle(atan2(y,x)) / DEGREE;
368   kpola(r) : select(r, 5, 15, 25, 35, 45, 55, 65, 75, 90);
369   knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12);
370   kaccum(r) : if(r-.5, knaz(r) + kaccum(r-1), 0);
# Line 416 | Line 385 | kbin2(pol,azi) = select(kfindrow(1, pol),
385   kbin = kbin2(Acos(abs(Dz)),Atan2(Dy,Dx));
386   ';
387   my $ndiv = 145;
388 < # Compute scattering data using rtcontrib
388 > # Compute scattering data using rcontrib
389   my @tfarr;
390   my @rfarr;
391   my @tbarr;
392   my @rbarr;
393   my $cmd;
394 < my $rtcmd = "rtcontrib $rtargs -h -ff -fo -n $nproc -c $nsamp " .
394 > my $rtcmd = "rcontrib $rtargs -h -ff -fo -n $nproc -c $nsamp " .
395          "-e '$kcal' -b kbin -bn $ndiv " .
396          "-o '$td/%s.flt' -m $fmodnm -m $bmodnm $octree";
397   my $rccmd = "rcalc -e '$tcal' " .
398          "-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-.999,$ndiv)' " .
399 <        q{-if3 -e 'oval=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega' } .
431 <        q[-o '${  oval  },'];
399 >        q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega' };
400   if ( $doforw ) {
401   $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " .
402          "-e 'xp=(\$3+rand(.12*recno+288))*(($dim[1]-$dim[0])/$nx)+$dim[0]' " .
# Line 440 | Line 408 | $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " .
408   system "$cmd" || die "Failure running: $cmd\n";
409   @tfarr = `$rccmd $td/$fmodnm.flt`;
410   die "Failure running: $rccmd $td/$fmodnm.flt\n" if ( $? );
411 + chomp(@tfarr);
412   @rfarr = `$rccmd $td/$bmodnm.flt`;
413   die "Failure running: $rccmd $td/$bmodnm.flt\n" if ( $? );
414 + chomp(@rfarr);
415   }
416   if ( $doback ) {
417   $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " .
# Line 454 | Line 424 | $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " .
424   system "$cmd" || die "Failure running: $cmd\n";
425   @tbarr = `$rccmd $td/$bmodnm.flt`;
426   die "Failure running: $rccmd $td/$bmodnm.flt\n" if ( $? );
427 + chomp(@tbarr);
428   @rbarr = `$rccmd $td/$fmodnm.flt`;
429   die "Failure running: $rccmd $td/$fmodnm.flt\n" if ( $? );
430 + chomp(@rbarr);
431   }
432   # Output angle basis
433   print
# Line 464 | Line 436 | print
436                  <AngleBasis>
437                          <AngleBasisName>LBNL/Klems Full</AngleBasisName>
438                          <AngleBasisBlock>
439 <                                <Theta>0</Theta>
440 <                                <nPhis>1</nPhis>
441 <                                <ThetaBounds>
442 <                                        <LowerTheta>0</LowerTheta>
443 <                                        <UpperTheta>5</UpperTheta>
444 <                                </ThetaBounds>
473 <                                </AngleBasisBlock>
474 <                                <AngleBasisBlock>
475 <                                <Theta>10</Theta>
476 <                                <nPhis>8</nPhis>
477 <                                <ThetaBounds>
478 <                                        <LowerTheta>5</LowerTheta>
479 <                                        <UpperTheta>15</UpperTheta>
480 <                                </ThetaBounds>
481 <                                </AngleBasisBlock>
482 <                                <AngleBasisBlock>
483 <                                <Theta>20</Theta>
484 <                                <nPhis>16</nPhis>
485 <                                <ThetaBounds>
486 <                                        <LowerTheta>15</LowerTheta>
487 <                                        <UpperTheta>25</UpperTheta>
488 <                                </ThetaBounds>
489 <                                </AngleBasisBlock>
490 <                                <AngleBasisBlock>
491 <                                <Theta>30</Theta>
492 <                                <nPhis>20</nPhis>
493 <                                <ThetaBounds>
494 <                                        <LowerTheta>25</LowerTheta>
495 <                                        <UpperTheta>35</UpperTheta>
496 <                                </ThetaBounds>
497 <                                </AngleBasisBlock>
498 <                                <AngleBasisBlock>
499 <                                <Theta>40</Theta>
500 <                                <nPhis>24</nPhis>
501 <                                <ThetaBounds>
502 <                                        <LowerTheta>35</LowerTheta>
503 <                                        <UpperTheta>45</UpperTheta>
504 <                                </ThetaBounds>
505 <                                </AngleBasisBlock>
506 <                                <AngleBasisBlock>
507 <                                <Theta>50</Theta>
508 <                                <nPhis>24</nPhis>
509 <                                <ThetaBounds>
510 <                                        <LowerTheta>45</LowerTheta>
511 <                                        <UpperTheta>55</UpperTheta>
512 <                                </ThetaBounds>
513 <                                </AngleBasisBlock>
514 <                                <AngleBasisBlock>
515 <                                <Theta>60</Theta>
516 <                                <nPhis>24</nPhis>
517 <                                <ThetaBounds>
518 <                                        <LowerTheta>55</LowerTheta>
519 <                                        <UpperTheta>65</UpperTheta>
520 <                                </ThetaBounds>
521 <                                </AngleBasisBlock>
522 <                                <AngleBasisBlock>
523 <                                <Theta>70</Theta>
524 <                                <nPhis>16</nPhis>
525 <                                <ThetaBounds>
526 <                                        <LowerTheta>65</LowerTheta>
527 <                                        <UpperTheta>75</UpperTheta>
528 <                                </ThetaBounds>
529 <                                </AngleBasisBlock>
530 <                                <AngleBasisBlock>
531 <                                <Theta>82.5</Theta>
532 <                                <nPhis>12</nPhis>
533 <                                <ThetaBounds>
534 <                                        <LowerTheta>75</LowerTheta>
535 <                                        <UpperTheta>90</UpperTheta>
536 <                                </ThetaBounds>
439 >                        <Theta>0</Theta>
440 >                        <nPhis>1</nPhis>
441 >                        <ThetaBounds>
442 >                                <LowerTheta>0</LowerTheta>
443 >                                <UpperTheta>5</UpperTheta>
444 >                        </ThetaBounds>
445                          </AngleBasisBlock>
446 +                        <AngleBasisBlock>
447 +                        <Theta>10</Theta>
448 +                        <nPhis>8</nPhis>
449 +                        <ThetaBounds>
450 +                                <LowerTheta>5</LowerTheta>
451 +                                <UpperTheta>15</UpperTheta>
452 +                        </ThetaBounds>
453 +                        </AngleBasisBlock>
454 +                        <AngleBasisBlock>
455 +                        <Theta>20</Theta>
456 +                        <nPhis>16</nPhis>
457 +                        <ThetaBounds>
458 +                                <LowerTheta>15</LowerTheta>
459 +                                <UpperTheta>25</UpperTheta>
460 +                        </ThetaBounds>
461 +                        </AngleBasisBlock>
462 +                        <AngleBasisBlock>
463 +                        <Theta>30</Theta>
464 +                        <nPhis>20</nPhis>
465 +                        <ThetaBounds>
466 +                                <LowerTheta>25</LowerTheta>
467 +                                <UpperTheta>35</UpperTheta>
468 +                        </ThetaBounds>
469 +                        </AngleBasisBlock>
470 +                        <AngleBasisBlock>
471 +                        <Theta>40</Theta>
472 +                        <nPhis>24</nPhis>
473 +                        <ThetaBounds>
474 +                                <LowerTheta>35</LowerTheta>
475 +                                <UpperTheta>45</UpperTheta>
476 +                        </ThetaBounds>
477 +                        </AngleBasisBlock>
478 +                        <AngleBasisBlock>
479 +                        <Theta>50</Theta>
480 +                        <nPhis>24</nPhis>
481 +                        <ThetaBounds>
482 +                                <LowerTheta>45</LowerTheta>
483 +                                <UpperTheta>55</UpperTheta>
484 +                        </ThetaBounds>
485 +                        </AngleBasisBlock>
486 +                        <AngleBasisBlock>
487 +                        <Theta>60</Theta>
488 +                        <nPhis>24</nPhis>
489 +                        <ThetaBounds>
490 +                                <LowerTheta>55</LowerTheta>
491 +                                <UpperTheta>65</UpperTheta>
492 +                        </ThetaBounds>
493 +                        </AngleBasisBlock>
494 +                        <AngleBasisBlock>
495 +                        <Theta>70</Theta>
496 +                        <nPhis>16</nPhis>
497 +                        <ThetaBounds>
498 +                                <LowerTheta>65</LowerTheta>
499 +                                <UpperTheta>75</UpperTheta>
500 +                        </ThetaBounds>
501 +                        </AngleBasisBlock>
502 +                        <AngleBasisBlock>
503 +                        <Theta>82.5</Theta>
504 +                        <nPhis>12</nPhis>
505 +                        <ThetaBounds>
506 +                                <LowerTheta>75</LowerTheta>
507 +                                <UpperTheta>90</UpperTheta>
508 +                        </ThetaBounds>
509 +                        </AngleBasisBlock>
510                  </AngleBasis>
511          </DataDefinition>
512   ';
# Line 555 | Line 527 | print
527   # Output front transmission (transposed order)
528   for (my $od = 0; $od < $ndiv; $od++) {
529          for (my $id = 0; $id < $ndiv; $id++) {
530 <                print $tfarr[$ndiv*$id + $od];
530 >                print $tfarr[$ndiv*$id + $od], ",\n";
531          }
532          print "\n";
533   }
# Line 572 | Line 544 | print
544                          <WavelengthDataDirection>Reflection Front</WavelengthDataDirection>
545                          <ColumnAngleBasis>LBNL/Klems Full</ColumnAngleBasis>
546                          <RowAngleBasis>LBNL/Klems Full</RowAngleBasis>
547 <                        <ScatteringDataType>BRDF</ScatteringDataType>
547 >                        <ScatteringDataType>BTDF</ScatteringDataType>
548                          <ScatteringData>
549   ';
550   # Output front reflection (transposed order)
551   for (my $od = 0; $od < $ndiv; $od++) {
552          for (my $id = 0; $id < $ndiv; $id++) {
553 <                print $rfarr[$ndiv*$id + $od];
553 >                print $rfarr[$ndiv*$id + $od], ",\n";
554          }
555          print "\n";
556   }
# Line 605 | Line 577 | print
577   # Output back transmission (transposed order)
578   for (my $od = 0; $od < $ndiv; $od++) {
579          for (my $id = 0; $id < $ndiv; $id++) {
580 <                print $tbarr[$ndiv*$id + $od];
580 >                print $tbarr[$ndiv*$id + $od], ",\n";
581          }
582          print "\n";
583   }
# Line 622 | Line 594 | print
594                          <WavelengthDataDirection>Reflection Back</WavelengthDataDirection>
595                          <ColumnAngleBasis>LBNL/Klems Full</ColumnAngleBasis>
596                          <RowAngleBasis>LBNL/Klems Full</RowAngleBasis>
597 <                        <ScatteringDataType>BRDF</ScatteringDataType>
597 >                        <ScatteringDataType>BTDF</ScatteringDataType>
598                          <ScatteringData>
599   ';
600   # Output back reflection (transposed order)
601   for (my $od = 0; $od < $ndiv; $od++) {
602          for (my $id = 0; $id < $ndiv; $id++) {
603 <                print $rbarr[$ndiv*$id + $od];
603 >                print $rbarr[$ndiv*$id + $od], ",\n";
604          }
605          print "\n";
606   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines