1 |
.\" RCSid "$Id: rcontrib.1,v 1.25 2025/03/27 01:26:55 greg Exp $" |
2 |
.TH RCONTRIB 1 5/25/05 RADIANCE |
3 |
.SH NAME |
4 |
rcontrib - compute contribution coefficients in a RADIANCE scene |
5 |
.SH SYNOPSIS |
6 |
.B rcontrib |
7 |
[ |
8 |
.B "\-n nprocs" |
9 |
][ |
10 |
.B \-V |
11 |
][ |
12 |
.B "\-t secs" |
13 |
][ |
14 |
.B "\-c count" |
15 |
][ |
16 |
.B \-fo |
17 |
| |
18 |
.B \-r |
19 |
][ |
20 |
.B "\-e expr" |
21 |
][ |
22 |
.B "\-f source" |
23 |
][ |
24 |
.B "\-o ospec" |
25 |
][ |
26 |
.B "\-p p1=V1,p2=V2" |
27 |
][ |
28 |
.B "\-b binv" |
29 |
][ |
30 |
.B "\-bn nbins" |
31 |
] |
32 |
{ |
33 |
.B "\-m mod | \-M file" |
34 |
} |
35 |
.. |
36 |
[ |
37 |
.B $EVAR |
38 |
] |
39 |
[ |
40 |
.B @file |
41 |
] |
42 |
[ |
43 |
rtrace options |
44 |
] |
45 |
.B octree |
46 |
.br |
47 |
.B "rcontrib [ options ] \-defaults" |
48 |
.br |
49 |
.B "rcontrib \-features [feat1 ..]" |
50 |
.SH DESCRIPTION |
51 |
.I Rcontrib |
52 |
computes ray coefficients |
53 |
for objects whose modifiers are named in one or more |
54 |
.I \-m |
55 |
settings. |
56 |
These modifiers are usually materials associated with |
57 |
light sources or sky domes, and must directly modify some geometric |
58 |
primitives to be considered in the output. |
59 |
A modifier list may also be read from a file using the |
60 |
.I \-M |
61 |
option. |
62 |
The RAYPATH environment variable determines directories to search for |
63 |
this file. |
64 |
(No search takes place if a file name begins with a '.', '/' or '~' |
65 |
character.)\0 |
66 |
.PP |
67 |
If the |
68 |
.I \-n |
69 |
option is specified with a value greater than 1, multiple |
70 |
processes will be used to accelerate computation on a shared |
71 |
memory machine. |
72 |
Note that there is no benefit to using more processes |
73 |
than there are local CPUs available to do the work, and the |
74 |
.I rcontrib |
75 |
process itself may use a considerable amount of CPU time. |
76 |
.PP |
77 |
By setting the boolean |
78 |
.I \-V |
79 |
option, you may instruct |
80 |
.I rcontrib |
81 |
to report the contribution from each material rather than the ray |
82 |
coefficient. |
83 |
This is particularly useful for light sources with directional output |
84 |
distributions, whose value would otherwise be lost in the shuffle. |
85 |
With the default |
86 |
.I -V- |
87 |
setting, the output of rcontrib is a coefficient that must be multiplied |
88 |
by the radiance of each material to arrive at a final contribution. |
89 |
This is more convenient for computing daylight coefficeints, or cases |
90 |
where the actual radiance is not desired. |
91 |
Use the |
92 |
.I -V+ |
93 |
setting when you wish to simply sum together contributions |
94 |
(with possible adjustment factors) to obtain a final radiance value. |
95 |
Combined with the |
96 |
.I \-i |
97 |
or |
98 |
.I \-I |
99 |
option, irradiance contributions are reported by |
100 |
.I \-V+ |
101 |
rather than radiance, and |
102 |
.I \-V- |
103 |
coefficients contain an additonal factor of PI. |
104 |
.PP |
105 |
The |
106 |
.I \-c |
107 |
option tells |
108 |
.I rcontrib |
109 |
how many rays to accumulate for each record. |
110 |
The default value is one, meaning a full record will be produced for |
111 |
each input ray. |
112 |
For values greater than one, contributions will be averaged together |
113 |
over the given number of input rays. |
114 |
If set to zero, only a single record will be produced at the very |
115 |
end, corresponding to the sum of all rays given on the input |
116 |
(rather than the average). |
117 |
This is equivalent to passing all the output records through a program like |
118 |
.I total(1) |
119 |
to sum RGB values together, but is much more efficient. |
120 |
Using this option, it is possible to reverse sampling, sending rays from |
121 |
a parallel source such as the sun to a diffuse surface, for example. |
122 |
Note that output flushing via zero-direction rays is disabled with |
123 |
.I \-c |
124 |
set to zero. |
125 |
.PP |
126 |
Output flushing at fixed intervals may be enabled with the |
127 |
.I \-x |
128 |
option, which specifies the number of records |
129 |
(-c accumulations) before each flush. |
130 |
If the |
131 |
.I \-y |
132 |
option is also set, then periodic flushing is disabled and the |
133 |
output size for an RGB image is the taken from the x and y dimensions. |
134 |
In lieu of periodic flushing, a flush may be forced as mentioned above |
135 |
by sending a sample with a zero direction vector, although you |
136 |
must still send a full record of rays before output occurs. |
137 |
.PP |
138 |
If progress reports are desired, the |
139 |
.I \-t |
140 |
option specifies a time interval in seconds for reports sent to |
141 |
standard error. |
142 |
This requires that the number of input samples is known, meaning a |
143 |
.I \-y |
144 |
parameter has been specified. |
145 |
.PP |
146 |
The output of |
147 |
.I rcontrib |
148 |
has many potential uses. |
149 |
Source contributions can be used as components in linear combination to |
150 |
reproduce any desired variation, e.g., simulating lighting controls or |
151 |
changing sky conditions via daylight coefficients. |
152 |
More generally, |
153 |
.I rcontrib |
154 |
can be used to compute arbitrary input-output relationships in optical |
155 |
systems, such as luminaires, light pipes, and shading devices. |
156 |
.PP |
157 |
.I Rcontrib |
158 |
sends the accumulated rays tallies |
159 |
to one or more destinations according to the given |
160 |
.I \-o |
161 |
specification. |
162 |
If a destination begins with an exclamation mark ('!'), then |
163 |
a pipe is opened to a command and data is sent to its standard input. |
164 |
Otherwise, the destination is treated as a file. |
165 |
An existing file of the same name will not be clobbered, unless the |
166 |
.I \-fo |
167 |
option is given. |
168 |
If instead the |
169 |
.I \-r |
170 |
option is specified, data recovery is attempted on existing files. |
171 |
(If |
172 |
.I "\-c 0" |
173 |
is used together with the |
174 |
.I \-r |
175 |
option, existing files are read in and new ray evaluations are added |
176 |
to the previous results, providing a convenient means for |
177 |
progressive simulation.)\0 |
178 |
If an output specification contains a "%s" format, this will be |
179 |
replaced by the modifier name. |
180 |
The |
181 |
.I \-b |
182 |
option may be used to further define |
183 |
a "bin number" within each object if finer resolution is needed, and |
184 |
this will be applied to a "%d" format in the output file |
185 |
specification if present. |
186 |
(The final integer will be offset incrementally |
187 |
if the output is a RADIANCE picture and more than one modifier has |
188 |
the same format specification.)\0 |
189 |
The actual bin number is computed at run time based on ray direction |
190 |
and surface intersection, as described below. |
191 |
The number of bins must be specified in advance with the |
192 |
.I \-bn |
193 |
option, and this is critical for output files containing multiple values |
194 |
per record. |
195 |
A variable or constant name may be given for this parameter if |
196 |
it has been defined via a previous |
197 |
.I \-f |
198 |
or |
199 |
.I \-e |
200 |
option. |
201 |
Since bin numbers start from zero, the bin count is always equal to |
202 |
the last bin plus one. |
203 |
The most recent |
204 |
.I \-p, |
205 |
.I \-b, |
206 |
.I \-bn |
207 |
and |
208 |
.I \-o |
209 |
options to the left of each |
210 |
.I \-m |
211 |
name are the ones used for that modifier. |
212 |
Any |
213 |
.I \-cs |
214 |
option changing the number of spectral color |
215 |
samples must appear before the first modifier. |
216 |
The ordering of other options is unimportant, except for |
217 |
.I \-x |
218 |
and |
219 |
.I \-y |
220 |
if the |
221 |
.I \-c |
222 |
is zero, when they control the resolution string |
223 |
produced in the corresponding output. |
224 |
.PP |
225 |
If a |
226 |
.I \-b |
227 |
expression is defined for a particular modifier, |
228 |
the bin number will be evaluated at run time for each |
229 |
ray contribution. |
230 |
Specifically, each ray's world intersection point will be assigned to |
231 |
the variables Px, Py, and Pz, and the normalized ray direction |
232 |
will be assigned to Dx, Dy, and Dz. |
233 |
These parameters may be combined with definitions given in |
234 |
.I \-e |
235 |
arguments and files read using the |
236 |
.I \-f |
237 |
option. |
238 |
Additional parameter values that apply only to this modifier may be specified |
239 |
with a |
240 |
.I \-p |
241 |
option, which contains a list of variable names and assigned values, separated |
242 |
by commas, colons, or semicolons. |
243 |
The computed bin value will be |
244 |
rounded to the nearest whole number. |
245 |
(Negative bin values will be silently ignored.)\0 |
246 |
For a single bin, you may specify |
247 |
.I "\-b 0", |
248 |
which is the default. |
249 |
This mechanism allows the user to define precise regions or directions |
250 |
they wish to accumulate, such as the Tregenza sky discretization, |
251 |
which would be otherwise impossible to specify |
252 |
as a set of RADIANCE primitives. |
253 |
The rules and predefined functions available for these expressions are |
254 |
described in the |
255 |
.I rcalc(1) |
256 |
man page. |
257 |
Like the other rendering tools, |
258 |
.I rcontrib |
259 |
will search the |
260 |
.I RAYPATH |
261 |
library directories for each file given in a |
262 |
.I \-f |
263 |
option. |
264 |
However, a special evaluation context is set for the |
265 |
.I \-f |
266 |
and |
267 |
.I \-e |
268 |
definitions, so attach a back-quote ('`') to variable and function names |
269 |
you wish these to apply at the global evaluation level and used by all |
270 |
materials and modifiers during rendering. |
271 |
.PP |
272 |
If no |
273 |
.I \-o |
274 |
specification is given, results are written on the standard output in order |
275 |
of modifier (as given on the command line) then bin number. |
276 |
Concatenated data is also sent to a single destination (i.e., an initial |
277 |
.I \-o |
278 |
specification without formatting strings). |
279 |
If a "%s" format appears but no "%d" in the |
280 |
.I \-o |
281 |
specification, then each modifier will have its own output file, with |
282 |
multiple values per record in the case of a non-zero |
283 |
.I \-b |
284 |
definition. |
285 |
If a "%d" format appears but no "%s", then each bin will get its own |
286 |
output file, with modifiers output in order in each record. |
287 |
For text output, each RGB coefficient triple is separated by a tab, |
288 |
with a newline at the end of each ray record. |
289 |
For binary output formats, there is no such delimiter to mark |
290 |
the end of each record. |
291 |
.PP |
292 |
Input and output format defaults to plain text, where each ray's |
293 |
origin and direction (6 real values) are given on input, |
294 |
and one line is produced per output file per ray. |
295 |
Alternative data representations may be specified by the |
296 |
.I \-f[io] |
297 |
option, which is described in the |
298 |
.I rtrace |
299 |
man page along with the associated |
300 |
.I \-x |
301 |
and |
302 |
.I \-y |
303 |
resolution settings. |
304 |
In particular, the color ('c') output data representation |
305 |
together with positive dimensions for |
306 |
.I \-x |
307 |
and |
308 |
.I \-y |
309 |
will produce an uncompressed RADIANCE picture, |
310 |
suitable for manipulation with |
311 |
.I pcomb(1) |
312 |
and related tools. |
313 |
.PP |
314 |
Options may be given on the command line and/or read from the |
315 |
environment and/or read from a file. |
316 |
A command argument beginning with a dollar sign ('$') is immediately |
317 |
replaced by the contents of the given environment variable. |
318 |
A command argument beginning with an at sign ('@') is immediately |
319 |
replaced by the contents of the given file. |
320 |
.PP |
321 |
.I Rcontrib |
322 |
supports light source contributions from photon maps generated by |
323 |
.I mkpmap(1) |
324 |
with its |
325 |
.I -apC |
326 |
option. Enabling photon mapping is described in the |
327 |
.I rtrace |
328 |
man page along with its relevant settings. In photon mapping mode, |
329 |
.I rcontrib |
330 |
only supports contributions from light sources, not arbitrary modifiers. |
331 |
The |
332 |
.I -b |
333 |
option is supported along with its associated ray variables, as |
334 |
discussed above. Ray coefficients are also supported via the |
335 |
.I \-V- |
336 |
option. Using fewer photons than there are light sources for the photon |
337 |
density estimates results in omitted contributions, thus the bandwidth |
338 |
is clamped accordingly and a warning is issued. |
339 |
.SH EXAMPLES |
340 |
To compute the proportional contributions from sources modified |
341 |
by "light1" vs. "light2" on a set of irradiance values: |
342 |
.IP "" .2i |
343 |
rcontrib \-I+ @render.opt \-o c_%s.dat \-m light1 \-m light2 scene.oct < test.dat |
344 |
.PP |
345 |
To generate a pair of images corresponding to these two lights' |
346 |
contributions: |
347 |
.IP "" .2i |
348 |
vwrays \-ff \-x 1024 \-y 1024 \-vf best.vf | |
349 |
rcontrib \-ffc `vwrays \-d \-x 1024 \-y 1024 \-vf best.vf` |
350 |
@render.opt \-o c_%s.hdr \-m light1 \-m light2 scene.oct |
351 |
.PP |
352 |
These images may then be recombined using the desired outputs |
353 |
of light1 and light2: |
354 |
.IP "" .2i |
355 |
pcomb \-c 100 90 75 c_light1.hdr \-c 50 55 57 c_light2.hdr > combined.hdr |
356 |
.PP |
357 |
To compute an array of irradiance contributions according to a Tregenza sky: |
358 |
.IP "" .2i |
359 |
rcontrib \-I+ \-f tregenza.cal \-b tbin \-bn Ntbins \-o sky.dat \-m skyglow |
360 |
\-b 0 \-o ground.dat \-m groundglow @render.opt scene.oct < test.dat |
361 |
.PP |
362 |
To perform an annual simulation of 365 daily sun positions in photon mapping |
363 |
mode: |
364 |
.IP "" .2i |
365 |
rcontrib \-I+ \-h \-V \-fo \-o c_%s.dat \-M lights \-ap contrib.pm 365 |
366 |
scene.oct < test.dat, |
367 |
.SH ENVIRONMENT |
368 |
RAYPATH path to search for \-f and \-M files |
369 |
.SH BUGS |
370 |
We do not currently compute contributions or coefficients properly |
371 |
in scenes with participating media. |
372 |
A single warning will be issued if a scattering or absorbing medium |
373 |
is detected. |
374 |
.SH AUTHOR |
375 |
Greg Ward |
376 |
.SH "SEE ALSO" |
377 |
cnt(1), dctimestep(1), genklemsamp(1), getinfo(1), mkpmap(1), pcomb(1), pfilt(1), |
378 |
pvsum(1), ra_rgbe(1), rcalc(1), rcomb(1), rfluxmtx(1), rmtxop(1), rpict(1), |
379 |
rsensor(1), rtrace(1), total(1), vwrays(1), ximage(1) |
380 |
|