ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/man/man1/mkpmap.1
Revision: 1.16
Committed: Wed Apr 14 11:28:36 2021 UTC (4 years ago) by rschregle
Branch: MAIN
CVS Tags: rad5R4, HEAD
Changes since 1.15: +13 -9 lines
Log Message:
docs(mkpmap): documented -apI option

File Contents

# Content
1 .\" RCSid "$Id: mkpmap.1,v 1.15 2021/03/23 21:42:47 rschregle Exp $"
2 .TH MKPMAP 1 "$Date: 2021/03/23 21:42:47 $ $Revision: 1.15 $" RADIANCE
3
4 .SH NAME
5 mkpmap - generate RADIANCE photon map
6
7 .SH SYNOPSIS
8 mkpmap \fB\-apg\fR|\fB\-apc\fR|\fB\-apv\fR|\fB\-apd\fR|\fB\-app\fR|\fB\-apC\fR
9 \fIfile nphotons\fR [\fIbwidth\fR] ...
10 [options] \fIoctree\fR
11
12 .SH DESCRIPTION
13 \fIMkpmap\fR takes a RADIANCE scene description as an octree and
14 performs Monte Carlo forward path tracing from the light sources,
15 depositing indirect ray hitpoints along with their energy (flux) as
16 "photons". The resulting localised energy distribution represents a
17 global illumination solution which is written to a file for subsequent
18 evaluation by \fIrpict(1), rtrace(1)\fR and \fIrvu(1)\fR in a backward
19 raytracing pass. The photon map(s) can be reused for multiple viewpoints
20 and sensor locations as long as the geometry remains unchanged.
21
22 .SH OPTIONS
23 \fIMkpmap\fR can generate different types of photon maps depending on
24 the materials present in the scene. In most cases, these can be
25 specified independently or in combination on the command line. If
26 multiple photon maps of the same type are specified, the last instance
27 takes precedence.
28
29 .IP "\fB\-apg \fIfile nphotons\fR"
30 Generate a global photon map containing approximately \fInphotons\fR
31 photons, and output to \fIfile\fR. This accounts for all
32 indirect illumination, from both specular and diffuse scattering, on
33 surfaces with a diffuse component. This is the most general type of
34 photon map and replaces the ambient calculation in \fIrpict(1),
35 rtrace(1)\fR and \fIrvu(1)\fR.
36
37 .IP "\fB\-apc \fIfile nphotons\fR"
38 Generate a separate caustic photon map containing approximately
39 \fInphotons\fR photons, and output to file \fIfile\fR. This is a
40 subset of the global photon map intended for direct visualisation at
41 primary rays, This accounts for all indirect illumination on diffuse
42 surfaces from specular scattering, which usually exhibits a large
43 gradient and requires a higher resolution than the global photon map,
44 typically containing the tenfold number of photons.
45
46 .IP "\fB\-apv \fIfile nphotons\fR"
47 Generate a volume photon map containing approximately \fInphotons\fR
48 photons, and output to file \fIfile\fR. These account for indirect
49 inscattering in participating media such as \fBmist\fR and complement
50 the direct inscattering computed by \fIrpict(1), rtrace(1)\fR and
51 \fIrvu(1)\fR. See also the \fB\-me\fR, \fB\-ma\fR and \fB\-mg\fR options
52 below.
53
54 .IP "\fB\-apd \fIfile nphotons\fR"
55 Generate a direct photon map containing approximately \fInphotons\fR
56 photons, and output to file \fIfile\fR. This only accounts for direct
57 illumination and is intended for debugging and validation of photon emission
58 from the light sources, as the quality is too low for actual rendering.
59
60 .IP "\fB\-apC \fIfile nphotons\fR"
61 Generate a contribution photon map containing approximately
62 \fInphotons\fR photons, and output to file \fIfile\fR. This may then be
63 used by \fIrcontrib(1)\fR to compute light source contributions. When used
64 with \fIrtrace(1)\fR or \fIrpict(1)\fR, contribution photon maps behave as
65 regular global photon maps and yield cumulative contributions from all light
66 sources.
67 .IP
68 With this option, \fImkpmap\fR uses a modified photon distribution
69 algorithm that ensures all light sources contribute approximately the
70 same number of photons. Each photon indexes a primary hitpoint, incident
71 direction, and emitting light source which can be used to bin
72 contributions per light source and direction.
73 .IP
74 \fIMkpmap\fR cannot generate a contribution photon map in combination with
75 others in a single run, as it uses a different distribution algorithm. Other
76 photon maps specified on the command line will be ignored.
77
78 .IP "\fB\-app \fIfile nphotons bwidth\fR"
79 Generate a precomputed global photon map containing a fraction of
80 \fInphotons\fR photons (specified with the \fB\-apP\fR option, see
81 below), and output to file \fIfile\fR. This is a special case of the
82 global photon map where the irradiance is evaluated for a fraction of
83 the photon positions using \fIbwidth\fR nearest photons, and stored as
84 photon flux; the remaining photons are discarded as their contributions
85 have been accounted for.
86 .IP
87 This obviates the explicit irradiance evaluation by \fIrpict(1),
88 rtrace(1)\fR and \fIrvu(1)\fR, thus providing a speedup at the expense of
89 accuracy. The resulting error is tolerable if the indirect illumination has
90 a low gradient, as is usually the case with diffuse illumination.
91
92 .IP "\fB\-apD \fIpredistrib\fR"
93 Photon predistribution factor; this is the fraction of \fInphotons\fR
94 which are emitted in a distribution prepass in order to estimate the
95 remaining number of photons to emit in the main pass to approximately
96 yield a photon map of size \fInphotons\fR.
97 .IP
98 Setting this too high may yield more than \fInphotons\fR in the initial pass
99 with highly reflective geometry. Note that this value may exceed 1, which
100 may be useful if the resulting photon map size greatly deviates from
101 \fInphotons\fR with a very low average reflectance.
102
103 .IP "\fB\-api \fImin_x min_y min_z max_x max_y max_z\fR"
104 Define a rectangular region of interest within which to store photons
105 exclusively; photons will only be stored within the volume bounded by the
106 given minimum and maximum coordinates. Multiple instances of this option may
107 be specified with cumulative effect to define compound regions of interest.
108 This is useful for constraining photons to only the relevant regions of a
109 scene, but may increase the photon distribution time.
110 .IP
111 \fBWARNING: this is an optimisation option for advanced users (an elite
112 group collectively known as \fIZe Ekspertz\fB) and may yield biased results.
113 Use with caution!\fR
114
115 .IP "\fB-apI \fIpos_x pos_y pos_z rad\fR"
116 Similar to \fB\-api\fR, but with a spherical region of interest of given
117 radius, centred at the given coordinates.
118
119 .IP "\fB\-apm \fImaxbounce\fR"
120 Synonymous with \fB\-lr\fR for backwards compatibility. May be removed in
121 future releases.
122
123 .IP "\fB\-apM \fImaxprepass\fR"
124 Maximum number of iterations of the distribution prepass before terminating
125 if some photon maps are still empty. This option is rarely needed as
126 an aborted prepass may indicate an anomaly in the geometry or an
127 incompatibility with the specified photon map types (see \fBNOTES\fR below).
128
129 .IP "\fB\-apo\fR[\fB+\fR|\fB-\fR|\fB0\fR] \fImod\fR"
130 Specifies a modifier \fImod\fR to act as a \fIphoton port\fR. All
131 objects using this modifier will emit photons directly in lieu of any
132 light sources defined with the \fIsource\fR material. This greatly
133 accelerates photon distribution in scenes where photons have to enter a
134 space which separates them from the emitting light source via an
135 aperture (e.g. fenestration, skylight) acting as a port.
136 .IP
137 In a typical daylight simulation scenario, a fenestration acts as a port to
138 admit photons into an interior after emission from sky and solar sources.
139 Multiple instances of this option may be specified.
140 .IP
141 By default, ports are oriented to emit in the halfspace defined
142 by their associated surface normal. This can be overridden by
143 specifying a trivalent suffix as follows:
144 .RS
145 .IP \fB+\fR:
146 Forward emission; this is equivalent to the abovementioned default behaviour.
147 .IP \fB-\fR:
148 Backward emission; the port is reversed and photons are emitted into the
149 halfspace facing away from the surface normal.
150 .IP \fB0\fR:
151 Bidirectional emission; photons are emitted from both sides of the port.
152 .RE
153 .IP
154 Some typical situations that call for a reversed photon port include, for
155 example:
156 .RS
157 .IP (a)
158 Using fenestrations as ports that were (for whatever
159 reason) defined with outward facing normals,
160 .IP (b)
161 Using a \fBmist\fR
162 primitive as a port, since this requires outward facing normals in order to
163 register the photons as having entered the volume,
164 .IP (c)
165 Reorienting a port associated with a \fBbsdf\fR modifier, since inverting
166 its normal would also reorient the BSDF and alter its behaviour.
167 .RE
168 .IP
169 Other oddball scenarios are conceivable. If in doubt, specify a
170 bidirectional port orientation for a slight performance penalty,
171 as photon emission is attempted from both sides. For well-defined
172 port geometry with inward-facing normals, just use the default;
173 doan' mess with da normalz.
174 .IP
175 Photon port geometry is discretised according to the
176 \fB\-dp\fR and \fB\-ds\fR options. These parameters aid in resolving
177 spatially and directionally varying illuminance received by the port
178 from distant light sources, e.g due to partial occlusion
179 or when using climate-based sky models.
180
181 .IP "\fB\-apO \fImodfile\fR"
182 Read photon port modifiers from the file \fImodfile\fR as a more convenient
183 alternative to multiple instances of \fB\-apo\fR.
184
185 .IP "\fB\-apP \fIprecomp\fR"
186 Fraction of global photons to precompute in the range ]0,1] when using the
187 \fB\-app\fR option.
188
189 .IP "\fB\-apr \fIseed\fR"
190 Seed for the random number generator. This is useful for generating
191 different photon distributions for the same octree and photon map size,
192 notably in progressive applications.
193
194 .IP "\fB\-aps \fImod\fR"
195 Specifies a modifier \fImod\fR defined as \fIantimatter\fR material to act
196 as a virtual (i.e. invisible) receiver surface. Photons will be deposited on
197 all surfaces using this modifier, just like regular materials, but will then
198 be transferred through the surface without undergoing scattering; the
199 surface therefore does not affect the light transport and simply acts as an
200 invisible photon receiver. This is useful when photon irradiance is to be
201 evaluated at points which do not lie on regular geometry, e.g. at workplane
202 height with \fIrtrace\fR's \fB-I\fR option. Without this workaround,
203 photons would be collected from parallel but distant planes, leading to
204 underestimation. Note that photons are only deposited when incident from
205 the front side of the sensor surface, i.e. when entering the
206 \fIantimatter\fR, thus the surface normal is relevant. \fIMkpmap\fR reports
207 an error if the specified modifier is not an \fIantimatter\fR material.
208
209 .IP "\fB\-apS \fImodfile\fR"
210 Read virtual receiver surface modifiers from the file \fImodfile\fR as a more
211 convenient alternative to multiple instances of \fB\-aps\fR.
212
213 .IP "\fB\-ae \fImod\fR"
214 Add \fImod\fR to the ambient exclude list, so that it will be ignored by the
215 photon map. Objects having \fImod\fR as their modifier will not have
216 photons deposited on them. Multiple modifiers may be given, each as separate
217 instances of this option.
218 .IP
219 \fBWARNING: this is an optimisation option for advanced users and may yield
220 biased results. It may also significantly increase photon distribution
221 times. Use with caution!\fR
222
223 .IP "\fB\-aE \fIfile\fR"
224 Same as \fI-ae\fR, except modifiers to be exluded are read from \fIfile\fR,
225 separated by whitespace. The RAYPATH environment variable determines which
226 directories are searched for this file.
227
228 .IP "\fB\-ai \fImod\fR"
229 Add \fImod\fR to the ambient include list, so that it will contribute to the
230 photon map. Only objects having \fImod\fR as their modifier will have
231 photons deposited on them. Multiple modifiers may be given, each as separate
232 instances of this option. Note that the ambient include and exclude options
233 are mutually exclusive.
234 .IP
235 \fBWARNING: this is an optimisation option for advanced users and may yield
236 biased results. It may also significantly increase photon distribution
237 times. Use with caution!\fR
238
239 .IP "\fB\-aI \fIfile\fR"
240 Same as \fI-ai\fR, except modifiers to be included are read from \fIfile\fR,
241 separated by whitespace. The RAYPATH environment variable determines which
242 directories are searched for this file.
243
244 .IP "\fB\-bv\fR[\fB+\fR|\fB-\fR]"
245 Toggles backface visibility; enabling this causes photons to be stored and
246 possibly scattered if they strike the back of a surface, otherwise they
247 are unconditionally absorbed and discarded.
248
249 .IP "\fB\-dp \fIsampleres\fR"
250 Angular resolution for sampling the spatial emission distribution of a
251 modified light source or photon port (e.g. via \fIbrightfunc\fR), in samples
252 per steradian.
253 This is required to numerically integrate the flux emitted by the light
254 source and construct a probability density function for photon emission.
255 The accuracy of photon emission from a modified source or port
256 therefore depends on this parameter. The resolution may need to be increased
257 with complex emission distributions in combination with caustics.
258
259 .IP "\fB\-ds \fIpartsize\fR"
260 Light source partition size ratio; a local light source object (or photon
261 port in case of a distant source) is spatially partitioned to distribute the
262 photon emission over its surface. This parameter specifies the ratio of the
263 size (per dimension) of each partition to the scene cube, and may need
264 to be reduced for modified light sources (e.g. via \fIbrightfunc\fR) with
265 high spatial variance, or for partially occluded photon ports.
266
267 .IP "\fB\-e \fIfile\fR"
268 Redirect diagnostics and progress reports to \fIfile\fR instead of the
269 console.
270
271 .IP "\fB\-fo\fR[\fB+\fR|\fB-\fR]"
272 Toggles overwriting of output files. By default, \fImkpmap\fR will not
273 overwrite an already existing photon map file. This is to prevent
274 inadvertently destroying the results of potentially lengthy photon
275 mapping runs.
276
277 .IP "\fB\-ld \fImaxdist\fR"
278 Limit cumulative distance travelled by a photon along its path to
279 \fImaxdist\fR. Photon hits within this distance will be stored, and the
280 photon is terminated once its path length exceeds this limit. This is
281 useful for setting radial regions of interest around emitting/reflecting
282 geometry, but may increase the photon distribution time.
283 .IP
284 \fBWARNING: this is an optimisation option for advanced users (an elite
285 group collectively known as \fIZe Ekspertz\fB) and may yield biased results.
286 Use with caution!\fR
287
288 .IP "\fB\-lr \fImaxbounce\fR"
289 Limit number of bounces (scattering events) along a photon path to
290 \fImaxbounce\fR before being considered "runaway" and terminated. Photons
291 paths are normally terminated via \fIRussian Roulette\fR, depending on their
292 albedo. With unrealistically high albedos, this is not guaranteed, and this
293 option imposes a hard limit to avoid an infinite loop.
294 .IP
295 \fBWARNING: this is an optimisation option for advanced users (an elite
296 group collectively known as \fIZe Ekspertz\fB) and may yield biased results.
297 Use with caution!\fR
298
299 .IP "\fB\-ma \fIralb galb balb\fR"
300 Set the global scattering albedo for participating media in conjunction
301 with the \fB\-apv\fR option. See \fIrpict(1)\fR for details.
302
303 .IP "\fB\-me \fIrext gext bext\fR"
304 Set the global extinction coefficient for participating media in conjunction
305 with the \fB\-apv\fR option. See \fIrpict(1)\fR for details.
306
307 .IP "\fB\-mg \fIgecc\fR"
308 Set the global scattering eccentricity for participating media in conjunction
309 with the \fB\-apv\fR option. See \fIrpict(1)\fR for details.
310
311 .IP "\fB\-n \fInproc\fR"
312 Use \fInproc\fR processes for parallel photon distribution. There is no
313 benefit in specifying more than the number of physical CPU cores available
314 (so doan' even try). This option is currently not available on Windows --
315 so there, tuff luck.
316
317 .IP "\fB\-t \fIinterval\fR"
318 Output a progress report every \fIinterval\fR seconds. This includes
319 statistics about the currently emitting light source (including number of
320 partitions), the total number of photons emitted, the number of each type
321 stored, the percentage of the completed pass (pre or main), and the elapsed
322 time.
323
324 .SH NOTES
325
326 .SS Parametrisation
327 \fIMkpmap\fR recognises multiplier suffixes (k = 1000, m = 1000000) to
328 facilitate the specification of \fInphotons\fR, both in upper and lower
329 case.
330 .PP
331
332 .SS Distribution Algorithm
333 The photon distribution algorithm estimates the number of required
334 photons to emit to arrive at the specified target count \fInphotons\fR
335 per photon map using a distribution prepass followed by a main pass.
336 As a result, \fImkpmap\fR generates the \fBapproximate\fR number of photons
337 specified, which can vary by up to 10% for typical scenes, but can be
338 higher for scenes with unusually high or low reflectance. In this case,
339 the predistribution factor \fB\-apD\fR should be increased for scenes
340 with low reflectance, and reduced for those with high reflectance.
341 .PP
342 There are situations which may prevent certain (or any)
343 photon types from being generated, depending on the light source and material
344 configuration. This typically occurs when attempting to generate a caustic
345 photon map without specular materials present in the scene, or a volume
346 photon map without participating media. Ill-configured light sources may also
347 prevent indirect rays from reaching a surface, and thus no photons being
348 deposited. In these cases, \fImkpmap\fR will make a number of distribution
349 attempts before terminating with an error. This can be adjusted with the
350 \fB\-apM\fR option.
351
352 .SS Material Support
353 Not all materials are fully supported by the photon map extension. The
354 \fIplasfunc\fR, \fImetfunc\fR, \fItransfunc\fR, \fIplasdata\fR,
355 \fImetdata\fR and \fItransdata\fR materials currently only scatter photons
356 diffusely, and will not produce caustics. The \fIbrtdfunc\fR material only
357 produces caustics via ideal (mirror) specular reflection and transmission.
358 For more realistic scattering behaviour, use the newer \fIbsdf\fR material
359 instead.
360 .PP
361 Virtual light sources (normally enabled with the \fImirror\fR material) are
362 disabled with the photon map, as the resulting caustics are already accounted
363 for.
364
365 .SS Virtual Receiver Surfaces
366 Since photons are surface bound, the density estimate is only asymptotically
367 correct when performed at points which lie on the scene geometry. The
368 irradiance is underestimated for arbitrarily placed points when photons are
369 collected from distant surfaces. \fIMkpmap\fR offers a workaround with a
370 virtual receiver surface using the \fIantimatter\fR material; see the \fB-aps\fR
371 and \fB-apS\fR options for details.
372
373 .SH EXAMPLES
374 The following command generates a global photon map \fIbonzo.gpm\fR and a
375 caustic photon map \fIbonzo.cpm\fR containing approximately 10000 and 100000
376 photons, respectively, with progress report every 5 seconds:
377 .IP
378 mkpmap \-apg bonzo.gpm 10k \-apc bonzo.cpm 100k -t 5 bonzo.oct
379 .PP
380 Generate a global photon map containing 80000 photons, then precompute the
381 diffuse irradiance for 1/4 of these with a bandwidth of 40 photons:
382 .IP
383 mkpmap \-app bonzo-precomp.gpm 80k 40 \-apP 0.25 bonzo.oct
384 .PP
385 Generate 1 million global photons by emitting them from external light
386 sources of type \fIsource\fR into a reference room via a fenestration
387 with modifier \fIglazingMat\fR acting as photon port, with inward-facing
388 normal:
389 .IP
390 mkpmap \-apg refRoom.gpm 1m \-apo glazingMat refRoom.oct
391 .PP
392 Generate a contribution photon map containing 10 million photons to bin
393 light source contributions with \fIrcontrib(1)\fR:
394 .IP
395 mkpmap \-apC bonzo-contrib.gpm 10m bonzo.oct
396
397 .SH BUGS
398 The focus of a spotlight source, as defined by the length of its direction
399 vector, is ignored by the photon map; photons are unconditionally emitted
400 from the light source surface, which can lead to deviations from standard
401 RADIANCE.
402 .PP
403 Light sources simply absorb incoming photons.
404
405 .SH AUTHOR
406 Roland Schregle (roland.schregle@{hslu.ch,gmail.com})
407
408 .SH COPYRIGHT
409 (c) Fraunhofer Institute for Solar Energy Systems,
410 .br
411 (c) Lucerne University of Applied Sciences and Arts,
412 .br
413 (c) Tokyo University of Science.
414
415 .SH ACKNOWLEDGEMENTS
416 Development of the RADIANCE photon mapping extension was supported by:
417
418 .RS
419 \fIFraunhofer Institute for Solar Energy Systems\fR funded by
420 the German Research Foundation (\fIDFG LU-204/10-2\fR, "Fassadenintegrierte
421 Regelsysteme (FARESYS)"),
422
423 \fILucerne University of Applied Sciences and Arts\fR funded by
424 the Swiss National Science Foundation (\fISNSF 147053\fR, "Daylight redirecting components"),
425
426 \fITokyo University of Science\fR funded by the JSPS Grants-in-Aid for Scientific
427 Research Programme (\fIKAKENHI JP19KK0115\fR, "Three-dimensional light flow").
428 .RE
429
430 Many thanks also to the many individuals who tested the code and provided
431 valuable feedback. Special greetz to Don Gregorio, PAB and Capt.\~B!
432
433 .SH "SEE ALSO"
434 rpict(1), rtrace(1), rvu(1), rcontrib(1),
435 .br
436 \fIThe RADIANCE Photon Map Manual\fR,
437 .br
438 \fIDevelopment and Integration of the RADIANCE Photon Map Extension:
439 Technical Report\fR,
440 .br
441 \fIThe RADIANCE Out-of-Core Photon Map: Technical Report\fR,
442 .br
443 \fIBonzo Daylighting Tool a.k.a. EvilDRC [TM]\fR
444