From 5ecc77d262ef9cc9ca137e8ea67f9b7766922201 Mon Sep 17 00:00:00 2001 From: "Gregory J. Ward" Date: Sat, 4 Dec 2021 16:29:29 +0000 Subject: [PATCH] feat(vwrays,rtpict): Added support for -pd option to sample depth-of-field --- doc/man/man1/vwrays.1 | 11 ++++++++--- doc/notes/ReleaseNotes | 5 +++++ src/util/rtpict.pl | 6 +++--- src/util/vwrays.c | 10 +++++++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/doc/man/man1/vwrays.1 b/doc/man/man1/vwrays.1 index 33ff7d9b3..8d543ae9f 100644 --- a/doc/man/man1/vwrays.1 +++ b/doc/man/man1/vwrays.1 @@ -1,4 +1,4 @@ -.\" RCSid "$Id: vwrays.1,v 1.11 2019/11/07 23:20:28 greg Exp $" +.\" RCSid "$Id: vwrays.1,v 1.12 2021/12/04 16:29:29 greg Exp $" .TH VWRAYS 1 1/15/99 RADIANCE .SH NAME vwrays - compute rays for a given picture or view @@ -47,7 +47,9 @@ with the same setting, providing a much faster way to average pixels over image sets. The .I \-pj -option should be used to jitter sample postions in most cases. +and/or +.I \-pd +options should be used to jitter sample postions in most cases. .PP View options may be any combination of standard view parameters described in the @@ -70,7 +72,10 @@ aspect ratio, unless this ratio is set to zero. The .I \-pj option may be used to jitter samples. -The default value of 0 turns off ray jittering. +The +.I \-pd +option specifies a world-diameter aperture for depth-of-field jittering. +The default value of 0 for both options turns off all ray jittering. .PP If the .I \-d diff --git a/doc/notes/ReleaseNotes b/doc/notes/ReleaseNotes index 7076c7ae7..cac1a8060 100644 --- a/doc/notes/ReleaseNotes +++ b/doc/notes/ReleaseNotes @@ -2489,3 +2489,8 @@ fixes the following problems: geometry; approximations are substituted and warning messages issued. Unfortunately, this code is not tested, since I don't have any IES files that use these shapes. + +Added support for depth-of-field blurring in vwrays using -pd option. +Also, made -c count work with vwrays -i, producing multiple samples +per indicated pixel position. At the same time, support for the -pd +option was added to rtpict, which calls on vwrays for its samples. diff --git a/src/util/rtpict.pl b/src/util/rtpict.pl index 60b90b61f..885561429 100644 --- a/src/util/rtpict.pl +++ b/src/util/rtpict.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: rtpict.pl,v 2.18 2020/04/08 16:20:00 greg Exp $ +# RCSid $Id: rtpict.pl,v 2.19 2021/12/04 16:29:29 greg Exp $ # # Run rtrace in parallel mode to simulate rpict -n option # May also be used to render layered images with -o* option @@ -21,9 +21,9 @@ # view options and the associated number of arguments my %vwraysC = ('-vf',1, '-vtv',0, '-vtl',0, '-vth',0, '-vta',0, '-vts',0, '-vtc',0, '-x',1, '-y',1, '-vp',3, '-vd',3, '-vu',3, '-vh',1, '-vv',1, - '-vo',1, '-va',1, '-vs',1, '-vl',1, '-pa',1, '-pj',1); + '-vo',1, '-va',1, '-vs',1, '-vl',1, '-pa',1, '-pj',1, '-pd',1); # options we need to silently ignore -my %ignoreC = ('-t',1, '-ps',1, '-pt',1, '-pm',1, '-pd',1); +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'); diff --git a/src/util/vwrays.c b/src/util/vwrays.c index 9172e4359..3b6163083 100644 --- a/src/util/vwrays.c +++ b/src/util/vwrays.c @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: vwrays.c,v 3.22 2021/12/03 17:22:28 greg Exp $"; +static const char RCSid[] = "$Id: vwrays.c,v 3.23 2021/12/04 16:29:29 greg Exp $"; #endif /* * Compute rays corresponding to a given picture or view. @@ -27,6 +27,8 @@ double pa = 1.; double pj = 0.; +double pd = 0.; + int zfd = -1; int fromstdin = 0; @@ -113,6 +115,8 @@ main( pa = atof(argv[++i]); else if (argv[i][2] == 'j') pj = atof(argv[++i]); + else if (argv[i][2] == 'd') + pd = atof(argv[++i]); else goto userr; break; @@ -212,7 +216,7 @@ pix2rays( for (c = repeatcnt; c-- > 0; ) { jitterloc(loc); d = viewray(rorg, rdir, &vw, loc[0], loc[1]); - if (d < -FTINY) + if (d < -FTINY || !jitteraperture(rorg, rdir, &vw, pd)) rorg[0] = rorg[1] = rorg[2] = rdir[0] = rdir[1] = rdir[2] = 0.; else if (zfd >= 0) @@ -269,7 +273,7 @@ putrays(void) pix2loc(loc, &rs, si, sc); jitterloc(loc); d = viewray(rorg, rdir, &vw, loc[0], loc[1]); - if (d < -FTINY) + if (d < -FTINY || !jitteraperture(rorg, rdir, &vw, pd)) rorg[0] = rorg[1] = rorg[2] = rdir[0] = rdir[1] = rdir[2] = 0.; else if (zfd >= 0)