--- ray/src/util/rtpict.pl 2022/04/11 18:08:19 2.24 +++ ray/src/util/rtpict.pl 2023/11/17 23:30:07 2.28 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: rtpict.pl,v 2.24 2022/04/11 18:08:19 greg Exp $ +# RCSid $Id: rtpict.pl,v 2.28 2023/11/17 23:30:07 greg Exp $ # # Run rtrace in parallel mode to simulate rpict -n option # May also be used to render layered images with -o* option @@ -15,7 +15,8 @@ my %rtraceC = ('-dt',1, '-dc',1, '-dj',1, '-ds',1, '-d '-ab',1, '-af',1, '-ai',1, '-aI',1, '-ae',1, '-aE',1, '-av',3, '-aw',1, '-aa',1, '-ar',1, '-ad',1, '-as',1, '-me',3, '-ma',3, '-mg',1, '-ms',1, '-lr',1, '-lw',1, - '-ap',2, '-am',1, '-ac',1, '-aC',1); + '-ap',2, '-am',1, '-ac',1, '-aC',1, + '-cs',1, '-cw',2, '-pc',8, '-pXYZ',0); # boolean rtrace options my @boolO = ('-w', '-bv', '-dv', '-i', '-u'); # view options and the associated number of arguments @@ -26,10 +27,11 @@ my %vwraysC = ('-vf',1, '-vtv',0, '-vtl',0, '-vth',0, my %ignoreC = ('-t',1, '-ps',1, '-pt',1, '-pm',1,); # Starting options for rtrace (rpict values) my @rtraceA = split(' ', 'rtrace -u- -dt .05 -dc .5 -ds .25 -dr 1 ' . - '-aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-03'); + '-aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-04'); my @vwraysA = ('vwrays', '-pj', '.67'); my @vwrightA = ('vwright', '-vtv'); my @rpictA = ('rpict', '-ps', '1'); +my @pvalueA = ('pvalue', '-r'); my $outpatt = '^-o[vrxlLRXnNsmM]+'; my $refDepth = ""; my $irrad = 0; @@ -88,6 +90,11 @@ while ($#ARGV >= 0 && "$ARGV[0]" =~ /^[-\@]/) { $ambcache = ($ARGV[1] > 0.0); } elsif ("$ARGV[0]" eq '-af') { $ambfile = "$ARGV[1]"; + } elsif ("$ARGV[0]" eq '-pXYZ') { + push @pvalueA, $ARGV[0]; + } elsif ("$ARGV[0]" eq '-pc') { + push @pvalueA, '-p'; + push @pvalueA, @ARGV[1..8]; } push @rtraceA, $ARGV[0]; push @rpictA, shift(@ARGV); @@ -153,7 +160,7 @@ my @res = split(/\s/, `@vwraysA -d`); ##### Resort pixels to reduce ambient cache collisions? if ($nprocs > 1 && $ambounce > 0 && $ambcache && defined($ambfile)) { if (!defined($outzbf) && !defined($outdir)) { - # Straight picture output, so just randomize sample order + # Straight picture output, so just shuffle sample order system "cnt -s $res[1] $res[3] > /tmp/ord$$.txt"; die "cnt error\n" if ( $? ); system "@vwraysA -ff -i < /tmp/ord$$.txt " . @@ -161,18 +168,17 @@ if ($nprocs > 1 && $ambounce > 0 && $ambcache && defin die "Error running rtrace\n" if ( $? ); system "( getinfo < /tmp/pix$$.txt | getinfo -a 'VIEW=$view'; " . "getinfo - < /tmp/pix$$.txt | rlam /tmp/ord$$.txt - " . - "| sort -k2rn -k1n ) | pvalue -r -Y $res[3] +X $res[1]"; + "| sort -k2rn -k1n ) | @pvalueA -Y $res[3] +X $res[1]"; die "rlam error\n" if ( $? ); unlink ("/tmp/ord$$.txt", "/tmp/pix$$.txt"); exit 0; } # Else randomize overture calculation to prime ambient cache - my $oxres = int($res[1]/6); - my $oyres = int($res[3]/6); - print STDERR "Running $oxres by $oyres overture calculation " . + my @ores = (int($res[1]/6), int($res[3]/6)); + print STDERR "Running $ores[0] by $ores[1] overture calculation " . "to populate '$ambfile'...\n"; - system "@vwraysA -x $oxres -y $oyres -pj 0 " . - "| sort -R | @rtraceA -faf -ov '$oct' > /dev/null"; + system "cnt -s @ores | @vwraysA -i -ff -x $ores[0] -y $ores[1] -pj 0 " . + "| @rtraceA -ff -ov '$oct' > /dev/null"; die "Failure running overture\n" if ( $? ); print STDERR "Finished overture.\n"; } @@ -181,7 +187,7 @@ if ($nprocs > 1 && $ambounce > 0 && $ambcache && defin if (defined $outzbf) { exec "@vwraysA -ff | @rtraceA -fff -olv @res '$oct' | " . "rsplit -ih -iH -f -of '$outzbf' -oh -oH -of3 - | " . - "pvalue -r -df | getinfo -a 'VIEW=$view'"; + "@pvalueA -df | getinfo -a 'VIEW=$view'"; } ##################################################################### ##### Base case with output picture only? @@ -208,7 +214,7 @@ my %rtoutC = ( ); # Arguments for rsplit based on output file type my %rcodeC = ( - '.hdr', ['-of3', '!pvalue -r -df -u'], + '.hdr', ['-of3', "!@pvalueA -df -u"], '.dpt', ['-of', "!rcode_depth$refDepth -ff"], '.nrm', ['-of3', '!rcode_norm -ff'], '.idx', ['-oa', '!rcode_ident "-t "']