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