Skip to content

Commit

Permalink
feat(vwrays,rtpict): Added support for -pd option to sample depth-of-…
Browse files Browse the repository at this point in the history
…field
  • Loading branch information
Gregungory committed Dec 4, 2021
1 parent 7309df8 commit 5ecc77d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
11 changes: 8 additions & 3 deletions doc/man/man1/vwrays.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions doc/notes/ReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -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.
6 changes: 3 additions & 3 deletions src/util/rtpict.pl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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');
Expand Down
10 changes: 7 additions & 3 deletions src/util/vwrays.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -27,6 +27,8 @@ double pa = 1.;

double pj = 0.;

double pd = 0.;

int zfd = -1;

int fromstdin = 0;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5ecc77d

Please sign in to comment.