ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/man/man1/rtrace.1
Revision: 1.18
Committed: Sat Dec 12 19:00:59 2009 UTC (15 years, 4 months ago) by greg
Branch: MAIN
Changes since 1.17: +21 -1 lines
Log Message:
Added -n option to rtrace and moved quit() funciton out of raypcalls

File Contents

# User Rev Content
1 greg 1.18 .\" RCSid "$Id: rtrace.1,v 1.17 2009/03/11 02:27:26 greg Exp $"
2 greg 1.1 .TH RTRACE 1 10/17/97 RADIANCE
3     .SH NAME
4     rtrace - trace rays in RADIANCE scene
5     .SH SYNOPSIS
6     .B rtrace
7     [
8     .B options
9     ]
10     [
11     .B $EVAR
12     ]
13     [
14     .B @file
15     ]
16     .B octree
17     .br
18     .B "rtrace [ options ] \-defaults"
19     .SH DESCRIPTION
20     .I Rtrace
21     traces rays from the standard input through the RADIANCE scene given by
22     .I octree
23     and sends the results to the standard output.
24     (The octree may be given as the output of a command enclosed in quotes
25     and preceded by a `!'.)\0
26     Input for each ray is:
27    
28     xorg yorg zorg xdir ydir zdir
29    
30     If the direction vector is (0,0,0), a bogus record
31     is printed and the output is flushed if the
32     .I -x
33     value is unset or zero.
34     (See the notes on this option below.)\0
35     This may be useful for programs that run
36     .I rtrace
37     as a separate process.
38     In the second form, the default values
39     for the options (modified by those options present)
40     are printed with a brief explanation.
41     .PP
42     Options may be given on the command line and/or read from the
43     environment and/or read from a file.
44     A command argument beginning with a dollar sign ('$') is immediately
45     replaced by the contents of the given environment variable.
46     A command argument beginning with an at sign ('@') is immediately
47     replaced by the contents of the given file.
48     Most options are followed by one or more arguments, which must be
49     separated from the option and each other by white space.
50     The exceptions to this rule are the boolean options.
51     Normally, the appearance of a boolean option causes a feature to
52     be "toggled", that is switched from off to on or on to off
53     depending on its previous state.
54     Boolean options may also be set
55     explicitly by following them immediately with a '+' or '-', meaning
56     on or off, respectively.
57     Synonyms for '+' are any of the characters "yYtT1", and synonyms
58     for '-' are any of the characters "nNfF0".
59     All other characters will generate an error.
60     .TP 10n
61     .BI -f io
62     Format input according to the character
63     .I i
64     and output according to the character
65     .I o.
66     .I Rtrace
67     understands the following input and output formats: 'a' for
68     ascii, 'f' for single-precision floating point,
69     and 'd' for double-precision floating point.
70     In addition to these three choices, the character 'c' may be used
71     to denote 4-byte floating point (Radiance) color format
72     for the output of values only
73     .I (\-ov
74     option, below).
75     If the output character is missing, the input format is used.
76     .IP
77     Note that there is no space between this option and its argument.
78     .TP
79     .BI -o spec
80     Produce output fields according to
81     .I spec.
82     Characters are interpreted as follows:
83     .IP
84     o origin (input)
85     .IP
86     d direction (normalized)
87     .IP
88     v value (radiance)
89     .IP
90 greg 1.14 V contribution (radiance)
91     .IP
92 greg 1.1 w weight
93     .IP
94 greg 1.10 W color coefficient
95 greg 1.7 .IP
96 greg 1.1 l effective length of ray
97     .IP
98     L first intersection distance
99     .IP
100 greg 1.2 c local (u,v) coordinates
101     .IP
102 greg 1.1 p point of intersection
103     .IP
104     n normal at intersection (perturbed)
105     .IP
106     N normal at intersection (unperturbed)
107     .IP
108     s surface name
109     .IP
110     m modifier name
111     .IP
112 greg 1.6 M material name
113     .IP
114 greg 1.9 ~ tilde (end of trace marker)
115 greg 1.8 .IP
116 greg 1.1 If the letter 't' appears in
117     .I spec,
118     then the fields following will be printed for every ray traced,
119     not just the final result.
120 greg 1.7 If the capital letter 'T' is given instead of 't', then all rays will
121     be reported, including shadow testing rays to light sources.
122 greg 1.1 Spawned rays are indented one tab for each level.
123 greg 1.9 The tilde marker ('~') is a handy way of differentiating the final ray
124     value from daughter values in a traced ray tree, and usually appears
125     right before the 't' or 'T' output flags.
126 greg 1.8 E.g.,
127 greg 1.9 .I \-ov~TmW
128     will emit a tilde followed by a tab at the end of each trace,
129     which can be easily distinguished even in binary output.
130 greg 1.1 .IP
131     Note that there is no space between this option and its argument.
132     .TP
133 greg 1.6 .BI -te \ mod
134 greg 1.1 Append
135 greg 1.6 .I mod
136 greg 1.1 to the trace exclude list,
137     so that it will not be reported by the trace option
138     .I (\-o*t*).
139     Any ray striking an object having
140 greg 1.6 .I mod
141 greg 1.1 as its modifier will not be reported to the standard output with
142     the rest of the rays being traced.
143 greg 1.7 This option has no effect unless either the 't' or 'T'
144     option has been given as part of the output specifier.
145 greg 1.6 Any number of excluded modifiers may be given, but each
146 greg 1.1 must appear in a separate option.
147     .TP
148 greg 1.6 .BI -ti \ mod
149 greg 1.1 Add
150 greg 1.6 .I mod
151 greg 1.1 to the trace include list,
152 greg 1.8 so that it will be reported by the trace option.
153 greg 1.1 The program can use either an include list or an exclude
154     list, but not both.
155     .TP
156     .BI -tE \ file
157     Same as
158     .I \-te,
159 greg 1.6 except read modifiers to be excluded from
160 greg 1.1 .I file.
161     The RAYPATH environment variable determines which directories are
162     searched for this file.
163 greg 1.6 The modifier names are separated by white space in the file.
164 greg 1.1 .TP
165     .BI -tI \ file
166     Same as
167     .I \-ti,
168 greg 1.6 except read modifiers to be included from
169 greg 1.1 .I file.
170     .TP
171     .BR \-i
172     Boolean switch to compute irradiance rather than radiance values.
173     This only affects the final result, substituting a Lambertian
174     surface and multiplying the radiance by pi.
175     Glass and other transparent surfaces are ignored during this stage.
176     Light sources still appear with their original radiance values,
177     though the
178     .I \-dv
179     option (below) may be used to override this.
180     This option is especially useful in
181     conjunction with ximage(1) for computing illuminance at scene points.
182     .TP
183 greg 1.13 .BR \-u
184     Boolean switch to control uncorrelated random sampling.
185 greg 1.12 When "off", a low-discrepancy sequence is used, which reduces
186     variance but can result in a brushed appearance in specular highlights.
187     When "on", pure Monte Carlo sampling is used in all calculations.
188     .TP
189 greg 1.1 .BR \-I
190     Boolean switch to compute irradiance rather than radiance,
191     with the input origin and direction interpreted instead
192     as measurement point and orientation.
193     .TP
194     .BR \-h
195     Boolean switch for information header on output.
196     .TP
197     .BI -x \ res
198     Set the x resolution to
199     .I res.
200     The output will be flushed after every
201     .I res
202     input rays.
203     A value of zero means that no output flushing will take place.
204     .TP
205     .BI -y \ res
206     Set the y resolution to
207     .I res.
208     The program will exit after
209     .I res
210     scanlines have been processed, where a scanline is the number of rays
211     given by the
212     .I \-x
213     option, or 1 if
214     .I \-x
215     is zero.
216     A value of zero means the program will not halt until the end
217     of file is reached.
218     .IP
219     If both
220     .I \-x
221     and
222     .I \-y
223     options are given, a resolution string is printed at the beginning
224     of the output.
225     This is mostly useful for recovering image dimensions with
226     .I pvalue(1),
227     and for creating valid Radiance picture files using the color output
228     format.
229     (See the
230     .I \-f
231     option, above.)
232     .TP
233 greg 1.18 .BI -n \ nproc
234     Execute in parallel on
235     .I nproc
236     local processes.
237     This option is incompatible with
238     .I \-P
239     and
240     .I \-PP,
241     and is not currently supported with the
242     .I \-I
243     option.
244     Multiple processes also do not work properly with ray tree output
245     using any of the
246     .I \-o*t*
247     options.
248     There is no benefit from specifying more processes than there are
249     cores available on the system or the
250     .I \-x
251     setting, which forces a wait at each flush.
252     .TP
253 greg 1.1 .BI -dj \ frac
254     Set the direct jittering to
255     .I frac.
256     A value of zero samples each source at specific sample points
257     (see the
258     .I \-ds
259     option below), giving a smoother but somewhat less accurate
260     rendering.
261     A positive value causes rays to be distributed over each
262     source sample according to its size, resulting in more accurate
263     penumbras.
264     This option should never be greater than 1, and may even
265     cause problems (such as speckle) when the value is smaller.
266     A warning about aiming failure will issued if
267     .I frac
268     is too large.
269     .TP
270     .BI -ds \ frac
271     Set the direct sampling ratio to
272     .I frac.
273     A light source will be subdivided until
274     the width of each sample area divided by the distance
275     to the illuminated point is below this ratio.
276     This assures accuracy in regions close to large area sources
277     at a slight computational expense.
278     A value of zero turns source subdivision off, sending at most one
279     shadow ray to each light source.
280     .TP
281     .BI -dt \ frac
282     Set the direct threshold to
283     .I frac.
284     Shadow testing will stop when the potential contribution of at least
285     the next and at most all remaining light sources is less than
286     this fraction of the accumulated value.
287     (See the
288     .I \-dc
289     option below.)
290     The remaining light source contributions are approximated
291     statistically.
292     A value of zero means that all light sources will be tested for shadow.
293     .TP
294     .BI \-dc \ frac
295     Set the direct certainty to
296     .I frac.
297     A value of one guarantees that the absolute accuracy of the direct calculation
298     will be equal to or better than that given in the
299     .I \-dt
300     specification.
301     A value of zero only insures that all shadow lines resulting in a contrast
302     change greater than the
303     .I \-dt
304     specification will be calculated.
305     .TP
306     .BI -dr \ N
307     Set the number of relays for secondary sources to
308     .I N.
309     A value of 0 means that secondary sources will be ignored.
310     A value of 1 means that sources will be made into first generation
311     secondary sources; a value of 2 means that first generation
312     secondary sources will also be made into second generation secondary
313     sources, and so on.
314     .TP
315     .BI -dp \ D
316     Set the secondary source presampling density to D.
317     This is the number of samples per steradian
318     that will be used to determine ahead of time whether or not
319     it is worth following shadow rays through all the reflections and/or
320     transmissions associated with a secondary source path.
321     A value of 0 means that the full secondary source path will always
322     be tested for shadows if it is tested at all.
323     .TP
324     .BR \-dv
325     Boolean switch for light source visibility.
326     With this switch off, sources will be black when viewed directly
327     although they will still participate in the direct calculation.
328     This option is mostly for the program
329     .I mkillum(1)
330     to avoid inappropriate counting of light sources, but it
331     may also be desirable in conjunction with the
332     .I \-i
333     option.
334     .TP
335     .BI -sj \ frac
336     Set the specular sampling jitter to
337     .I frac.
338     This is the degree to which the highlights are sampled
339     for rough specular materials.
340     A value of one means that all highlights will be fully sampled
341     using distributed ray tracing.
342     A value of zero means that no jittering will take place, and all
343     reflections will appear sharp even when they should be diffuse.
344     .TP
345     .BI -st \ frac
346     Set the specular sampling threshold to
347     .I frac.
348     This is the minimum fraction of reflection or transmission, under which
349     no specular sampling is performed.
350     A value of zero means that highlights will always be sampled by
351     tracing reflected or transmitted rays.
352     A value of one means that specular sampling is never used.
353     Highlights from light sources will always be correct, but
354     reflections from other surfaces will be approximated using an
355     ambient value.
356     A sampling threshold between zero and one offers a compromise between image
357     accuracy and rendering time.
358     .TP
359     .BR -bv
360     Boolean switch for back face visibility.
361     With this switch off, back faces of opaque objects will be invisible
362     to all rays.
363     This is dangerous unless the model was constructed such that
364     all surface normals on opaque objects face outward.
365     Although turning off back face visibility does not save much
366     computation time under most circumstances, it may be useful as a
367     tool for scene debugging, or for seeing through one-sided walls from
368     the outside.
369     This option has no effect on transparent or translucent materials.
370     .TP
371     .BI -av " red grn blu"
372     Set the ambient value to a radiance of
373     .I "red grn blu".
374     This is the final value used in place of an
375     indirect light calculation.
376     If the number of ambient bounces is one or greater and the ambient
377     value weight is non-zero (see
378     .I -aw
379     and
380     .I -ab
381     below), this value may be modified by the computed indirect values
382     to improve overall accuracy.
383     .TP
384     .BI -aw \ N
385     Set the relative weight of the ambient value given with the
386     .I -av
387     option to
388     .I N.
389     As new indirect irradiances are computed, they will modify the
390     default ambient value in a moving average, with the specified weight
391     assigned to the initial value given on the command and all other
392     weights set to 1.
393     If a value of 0 is given with this option, then the initial ambient
394     value is never modified.
395     This is the safest value for scenes with large differences in
396     indirect contributions, such as when both indoor and outdoor
397     (daylight) areas are visible.
398     .TP
399     .BI -ab \ N
400     Set the number of ambient bounces to
401     .I N.
402     This is the maximum number of diffuse bounces
403     computed by the indirect calculation.
404     A value of zero implies no indirect calculation.
405     .TP
406     .BI -ar \ res
407     Set the ambient resolution to
408     .I res.
409     This number will determine the maximum density of ambient values
410     used in interpolation.
411     Error will start to increase on surfaces spaced closer than
412     the scene size divided by the ambient resolution.
413     The maximum ambient value density is the scene size times the
414     ambient accuracy (see the
415     .I \-aa
416     option below) divided by the ambient resolution.
417     The scene size can be determined using
418     .I getinfo(1)
419     with the
420     .I \-d
421     option on the input octree.
422     .TP
423     .BI -aa \ acc
424     Set the ambient accuracy to
425     .I acc.
426     This value will approximately equal the error
427     from indirect illuminance interpolation.
428     A value of zero implies no interpolation.
429     .TP
430     .BI -ad \ N
431     Set the number of ambient divisions to
432     .I N.
433     The error in the Monte Carlo calculation of indirect
434     illuminance will be inversely proportional to the square
435     root of this number.
436     A value of zero implies no indirect calculation.
437     .TP
438     .BI -as \ N
439     Set the number of ambient super-samples to
440     .I N.
441     Super-samples are applied only to the ambient divisions which
442     show a significant change.
443     .TP
444     .BI -af \ fname
445     Set the ambient file to
446     .I fname.
447     This is where indirect illuminance will be stored and retrieved.
448     Normally, indirect illuminance values are kept in memory and
449     lost when the program finishes or dies.
450     By using a file, different invocations can share illuminance
451     values, saving time in the computation.
452     The ambient file is in a machine-independent binary format
453     which can be examined with
454     .I lookamb(1).
455     .IP
456     The ambient file may also be used as a means of communication and
457     data sharing between simultaneously executing processes.
458     The same file may be used by multiple processes, possibly running on
459     different machines and accessing the file via the network (ie.
460     .I nfs(4)).
461     The network lock manager
462     .I lockd(8)
463     is used to insure that this information is used consistently.
464     .IP
465     If any calculation parameters are changed or the scene
466     is modified, the old ambient file should be removed so that
467     the calculation can start over from scratch.
468     For convenience, the original ambient parameters are listed in the
469     header of the ambient file.
470     .I Getinfo(1)
471     may be used to print out this information.
472     .TP
473 greg 1.6 .BI -ae \ mod
474 greg 1.1 Append
475 greg 1.6 .I mod
476 greg 1.1 to the ambient exclude list,
477     so that it will not be considered during the indirect calculation.
478     This is a hack for speeding the indirect computation by
479     ignoring certain objects.
480     Any object having
481 greg 1.6 .I mod
482 greg 1.1 as its modifier will get the default ambient
483     level rather than a calculated value.
484 greg 1.6 Any number of excluded modifiers may be given, but each
485 greg 1.1 must appear in a separate option.
486     .TP
487 greg 1.6 .BI -ai \ mod
488 greg 1.1 Add
489 greg 1.6 .I mod
490 greg 1.1 to the ambient include list,
491     so that it will be considered during the indirect calculation.
492     The program can use either an include list or an exclude
493     list, but not both.
494     .TP
495     .BI -aE \ file
496     Same as
497     .I \-ae,
498 greg 1.6 except read modifiers to be excluded from
499 greg 1.1 .I file.
500     The RAYPATH environment variable determines which directories are
501     searched for this file.
502 greg 1.6 The modifier names are separated by white space in the file.
503 greg 1.1 .TP
504     .BI -aI \ file
505     Same as
506     .I \-ai,
507 greg 1.6 except read modifiers to be included from
508 greg 1.1 .I file.
509     .TP
510     .BI -me " rext gext bext"
511     Set the global medium extinction coefficient to the indicated color,
512     in units of 1/distance (distance in world coordinates).
513     Light will be scattered or absorbed over distance according to
514     this value.
515     The ratio of scattering to total scattering plus absorption is set
516     by the albedo parameter, described below.
517     .TP
518     .BI -ma " ralb galb balb"
519     Set the global medium albedo to the given value between 0\00\00
520     and 1\01\01.
521     A zero value means that all light not transmitted by the medium
522     is absorbed.
523     A unitary value means that all light not transmitted by the medium
524     is scattered in some new direction.
525     The isotropy of scattering is determined by the Heyney-Greenstein
526     parameter, described below.
527     .TP
528     .BI \-mg \ gecc
529     Set the medium Heyney-Greenstein eccentricity parameter to
530     .I gecc.
531     This parameter determines how strongly scattering favors the forward
532     direction.
533     A value of 0 indicates perfectly isotropic scattering.
534     As this parameter approaches 1, scattering tends to prefer the
535     forward direction.
536     .TP
537     .BI \-ms \ sampdist
538     Set the medium sampling distance to
539     .I sampdist,
540     in world coordinate units.
541     During source scattering, this will be the average distance between
542     adjacent samples.
543     A value of 0 means that only one sample will be taken per light
544     source within a given scattering volume.
545     .TP
546     .BI -lr \ N
547     Limit reflections to a maximum of
548     .I N.
549 greg 1.11 If
550     .I N
551     is zero or negative, then Russian roulette is used for ray
552     termination, and the
553     .I -lw
554     setting (below) must be positive.
555     If N is a negative integer, then this sets the upper limit
556     of reflections past which Russian roulette will not be used.
557     In scenes with dielectrics and total internal reflection,
558     a setting of 0 (no limit) may cause a stack overflow.
559 greg 1.1 .TP
560     .BI -lw \ frac
561     Limit the weight of each ray to a minimum of
562     .I frac.
563 greg 1.11 During ray-tracing, a record is kept of the estimated contribution
564     (weight) a ray would have in the image.
565     If this weight is less than the specified minimum and the
566     .I -lr
567     setting (above) is positive, the ray is not traced.
568     Otherwise, Russian roulette is used to
569     continue rays with a probability equal to the ray weight
570     divided by the given
571     .I frac.
572 greg 1.1 .TP
573     .BR -ld
574     Boolean switch to limit ray distance.
575     If this option is set, then rays will only be traced as far as the
576     magnitude of each direction vector.
577     Otherwise, vector magnitude is ignored and rays are traced to infinity.
578     .TP
579     .BI -e \ efile
580     Send error messages and progress reports to
581     .I efile
582     instead of the standard error.
583     .TP
584     .BR \-w
585     Boolean switch to suppress warning messages.
586     .TP
587     .BI \-P \ pfile
588     Execute in a persistent mode, using
589     .I pfile
590     as the control file.
591     Persistent execution means that after reaching end-of-file on
592     its input,
593     .I rtrace
594     will fork a child process that will wait for another
595     .I rtrace
596     command with the same
597     .I \-P
598     option to attach to it.
599     (Note that since the rest of the command line options will be those
600     of the original invocation, it is not necessary to give any arguments
601     besides
602     .I \-P
603     for subsequent calls.)
604     Killing the process is achieved with the
605     .I kill(1)
606     command.
607     (The process ID in the first line of
608     .I pfile
609     may be used to identify the waiting
610     .I rtrace
611     process.)
612     This option may be used with the
613     .I \-fr
614     option of
615     .I pinterp(1)
616     to avoid the cost of starting up
617     .I rtrace
618     many times.
619     .TP
620     .BI \-PP \ pfile
621     Execute in continuous-forking persistent mode, using
622     .I pfile
623     as the control file.
624     The difference between this option and the
625     .I \-P
626     option described above is the creation of multiple duplicate
627     processes to handle any number of attaches.
628     This provides a simple and reliable mechanism of memory sharing
629     on most multiprocessing platforms, since the
630     .I fork(2)
631     system call will share memory on a copy-on-write basis.
632     .SH EXAMPLES
633     To compute radiance values for the rays listed in samples.inp:
634     .IP "" .2i
635 greg 1.15 rtrace \-ov scene.oct < samples.inp > radiance.out
636 greg 1.1 .PP
637     To compute illuminance values at locations selected with the 't'
638     command of
639     .I ximage(1):
640     .IP "" .2i
641 greg 1.16 ximage scene.hdr | rtrace \-h \-x 1 \-i scene.oct | rcalc \-e '$1=47.4*$1+120*$2+11.6*$3'
642 greg 1.1 .PP
643     To record the object identifier corresponding to each pixel in an image:
644     .IP "" .2i
645 greg 1.16 vwrays \-fd scene.hdr | rtrace \-fda `vwrays \-d scene.hdr` \-os scene.oct
646 greg 1.1 .PP
647     To compute an image with an unusual view mapping:
648     .IP "" .2i
649 greg 1.17 cnt 480 640 | rcalc \-e 'xr:640;yr:480' \-f unusual_view.cal | rtrace
650 greg 1.16 \-x 640 \-y 480 \-fac scene.oct > unusual.hdr
651 greg 1.1 .SH ENVIRONMENT
652     RAYPATH the directories to check for auxiliary files.
653     .SH FILES
654 greg 1.5 /tmp/rtXXXXXX common header information for picture sequence
655 greg 1.1 .SH DIAGNOSTICS
656     If the program terminates from an input related error, the exit status
657     will be 1.
658     A system related error results in an exit status of 2.
659     If the program receives a signal that is caught, it will exit with a status
660     of 3.
661     In each case, an error message will be printed to the standard error, or
662     to the file designated by the
663     .I \-e
664     option.
665     .SH AUTHOR
666     Greg Ward
667     .SH "SEE ALSO"
668     getinfo(1), lookamb(1), oconv(1), pfilt(1), pinterp(1),
669 greg 1.9 pvalue(1), rpict(1), rtcontrib(1), rvu(1), vwrays(1), ximage(1)