ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/doc/man/man1/rcontrib.1
Revision: 1.27
Committed: Thu Oct 23 23:34:59 2025 UTC (2 weeks, 1 day ago) by greg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.26: +2 -6 lines
Log Message:
docs: Added rxfluxmtx man page and updated others accordingly

File Contents

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