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