--- ray/src/util/rtpict.pl 2022/04/11 04:03:36 2.22 +++ ray/src/util/rtpict.pl 2022/04/12 00:30:58 2.25 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: rtpict.pl,v 2.22 2022/04/11 04:03:36 greg Exp $ +# RCSid $Id: rtpict.pl,v 2.25 2022/04/12 00:30:58 greg Exp $ # # Run rtrace in parallel mode to simulate rpict -n option # May also be used to render layered images with -o* option @@ -153,26 +153,25 @@ 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 - system "cnt $res[1] $res[3] | sort -R > /tmp/ord$$.txt"; - die "sort error\n" if ( $? ); + # 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 " . "| @rtraceA -ffa -ov '$oct' > /tmp/pix$$.txt"; die "Error running rtrace\n" if ( $? ); - system "( getinfo < /tmp/pix$$.txt ; getinfo - < /tmp/pix$$.txt " . - "| rlam /tmp/ord$$.txt - | sort -k2rn -k1n ) " . - "| pvalue -r -Y $res[3] +X $res[1] | getinfo -a 'VIEW=$view'"; + 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]"; 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"; }