ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/ray.1
Revision: 1.49
Committed: Fri May 30 16:35:52 2025 UTC (2 days, 14 hours ago) by greg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.48: +5 -3 lines
Log Message:
docs: Improved wording on new mirror material behavior

File Contents

# Content
1 .\" RCSid "$Id: ray.1,v 1.48 2025/05/29 16:42:28 greg Exp $"
2 .\" Print using the -ms macro package
3 .DA 12/09/2024
4 .LP
5 .tl """Copyright \(co 2024 Regents, University of California
6 .sp 2
7 .TL
8 The
9 .so ../src/rt/VERSION
10 .br
11 Synthetic Imaging System
12 .AU
13 Building Technologies Department
14 .br
15 Lawrence Berkeley Laboratory
16 .br
17 1 Cyclotron Rd., MS 90-3111
18 .br
19 Berkeley, CA 94720
20 .NH 1
21 Introduction
22 .PP
23 RADIANCE was developed as a research tool
24 for predicting the distribution of visible radiation in
25 illuminated spaces.
26 It takes as input a three-dimensional geometric model of
27 the physical environment, and produces a map of
28 spectral radiance values in a color image.
29 The technique of ray-tracing follows light backwards
30 from the image plane to the source(s).
31 Because it can produce realistic images from a simple description,
32 RADIANCE has a wide range of applications in graphic arts,
33 lighting design, computer-aided engineering and architecture.
34 .KF
35 .sp 25
36 .ce
37 .B "Figure 1."
38 .sp
39 .KE
40 .PP
41 The diagram in Figure 1 shows the flow between programs (boxes) and
42 data (ovals).
43 The central program is
44 .I rpict,
45 which produces a picture from a scene description.
46 .I Rview
47 is a variation of
48 .I rpict
49 that computes and displays images interactively.
50 Other programs (not shown) connect many of these elements together,
51 such as the executive programs
52 .I rad
53 and
54 .I ranimate,
55 the interactive rendering program
56 .I rholo,
57 and the animation program
58 .I ranimove.
59 The program
60 .I obj2mesh
61 acts as both a converter and scene compiler, converting a Wavefront .OBJ
62 file into a compiled mesh octree for efficient rendering.
63 .PP
64 A scene description file lists the surfaces and materials
65 that make up a specific environment.
66 The current surface types are spheres, polygons, cones, and cylinders.
67 There is also a composite surface type, called mesh, and a pseudosurface
68 type, called instance, which facilitates very complex geometries.
69 Surfaces can be made from materials such as plastic, metal, and glass.
70 Light sources can be distant disks as well as local spheres, disks
71 and polygons.
72 .PP
73 From a three-dimensional scene description and a specified view,
74 .I rpict
75 produces a two-dimensional image.
76 A picture file is a compressed binary representation of the
77 pixels in the image.
78 This picture can be scaled in size and
79 brightness, anti-aliased, and sent to a graphics output device.
80 .PP
81 A header in each picture file lists the program(s) and
82 parameters that produced it.
83 This is useful for identifying a picture
84 without having to display it.
85 The information can be read by the program
86 .I getinfo.
87 .NH 1
88 Scene Description
89 .PP
90 A scene description file represents a
91 three-dimensional physical environment
92 in Cartesian (rectilinear) world coordinates.
93 It is stored as ASCII text, with the following basic format:
94 .DS
95 # comment
96
97 modifier type identifier
98 n S1 S2 "S 3" .. Sn
99 0
100 m R1 R2 R3 .. Rm
101
102 modifier alias identifier reference
103
104 ! command
105
106 ...
107 .DE
108 .PP
109 A comment line begins with a pound sign, `#'.
110 .PP
111 The scene description
112 .I primitives
113 all have the same general format, and can
114 be either surfaces or modifiers.
115 A primitive has a modifier, a type, and an identifier.
116 A modifier is either the identifier of a
117 .I "previously defined"
118 primitive, or "void"\(dg.
119 .FS
120 \(dgThe most recent definition of a modifier is the one used,
121 and later definitions do not cause relinking of loaded
122 primitives.
123 Thus, the same identifier may be used repeatedly, and each new
124 definition will apply to the primitives following it.
125 .FE
126 An identifier can be any string (i.e., any sequence of non-white characters).
127 The
128 .I arguments
129 associated with a primitive can be strings or real numbers.
130 The first integer following the identifier is the number
131 of string arguments, and it is followed by the arguments themselves
132 (separated by white space or enclosed in quotes).
133 The next integer is the number of integer arguments, and is followed
134 by the integer arguments.
135 (There are currently no primitives that use them, however.)
136 The next integer is the real argument count, and it is followed
137 by the real arguments.
138 .PP
139 An alias gets its type and arguments from a previously defined primitive.
140 This is useful when the same material is used with a different
141 modifier, or as a convenient naming mechanism.
142 The reserved modifier name "inherit" may be used to specificy that
143 an alias will inherit its modifier from the original.
144 Surfaces cannot be aliased.
145 .PP
146 A line beginning with an exclamation point, `!',
147 is interpreted as a command.
148 It is executed by the shell, and its output is read as input to
149 the program.
150 The command must not try to read from its standard input, or
151 confusion will result.
152 A command may be continued over multiple lines using a backslash, `\\',
153 to escape the newline.
154 .PP
155 White space is generally ignored, except as a separator.
156 The exception is the newline character after a command or comment.
157 Commands, comments and primitives may appear in any combination, so long
158 as they are not intermingled.
159 .NH 2
160 Primitive Types
161 .PP
162 Primitives can be surfaces, materials, textures or patterns.
163 Modifiers can be materials, mixtures, textures or patterns.
164 Simple surfaces must have one material in their modifier list.
165 .NH 3
166 Surfaces
167 .PP
168 A scene description will consist mostly of surfaces.
169 The basic types are given below.
170 .LP
171 .UL Source
172 .PP
173 A source is not really a surface, but a solid angle.
174 It is used for specifying light sources that are very distant.
175 The direction to the center of the source and the number of degrees
176 subtended by its disk are given as follows:
177 .DS
178 mod source id
179 0
180 0
181 4 xdir ydir zdir angle
182 .DE
183 .LP
184 .UL Sphere
185 .PP
186 A sphere is given by its center and radius:
187 .DS
188 mod sphere id
189 0
190 0
191 4 xcent ycent zcent radius
192 .DE
193 .LP
194 .UL Bubble
195 .PP
196 A bubble is simply a sphere whose surface normal points inward.
197 .LP
198 .UL Polygon
199 .PP
200 A polygon is given by a list of three-dimensional vertices,
201 which are ordered counter-clockwise as viewed from
202 the front side (into the surface normal).
203 The last vertex is automatically connected to the first.
204 Holes are represented in polygons as interior vertices connected to
205 the outer perimeter by coincident edges (seams).
206 .DS
207 mod polygon id
208 0
209 0
210 3n
211 x1 y1 z1
212 x2 y2 z2
213 ...
214 xn yn zn
215 .DE
216 .LP
217 .UL Cone
218 .PP
219 A cone is a megaphone-shaped object.
220 It is truncated by two planes perpendicular to its axis,
221 and one of its ends may come to a point.
222 It is given as two axis endpoints, and the starting
223 and ending radii:
224 .DS
225 mod cone id
226 0
227 0
228 8
229 x0 y0 z0
230 x1 y1 z1
231 r0 r1
232 .DE
233 .LP
234 .UL Cup
235 .PP
236 A cup is an inverted cone (i.e., has an inward surface normal).
237 .LP
238 .UL Cylinder
239 .PP
240 A cylinder is like a cone, but its starting and ending radii are
241 equal.
242 .DS
243 mod cylinder id
244 0
245 0
246 7
247 x0 y0 z0
248 x1 y1 z1
249 rad
250 .DE
251 .LP
252 .UL Tube
253 .PP
254 A tube is an inverted cylinder.
255 .LP
256 .UL Ring
257 .PP
258 A ring is a circular disk given by its center, surface
259 normal, and inner and outer radii:
260 .DS
261 mod ring id
262 0
263 0
264 8
265 xcent ycent zcent
266 xdir ydir zdir
267 r0 r1
268 .DE
269 .LP
270 .UL Mesh
271 .PP
272 A mesh is a compound surface, made up of many triangles and
273 an octree data structure to accelerate ray intersection.
274 It is typically converted from a Wavefront .OBJ file using the
275 .I obj2mesh
276 program.
277 .DS
278 mod mesh id
279 1+ meshfile transform
280 0
281 0
282 .DE
283 If the modifier is "void", then surfaces will use the modifiers given
284 in the original mesh description.
285 Otherwise, the modifier specified is used in their place.
286 The transform moves the mesh to the desired location in the scene.
287 Multiple instances using the same meshfile take little extra memory,
288 and the compiled mesh itself takes much less space than individual
289 polygons would.
290 In the case of an unsmoothed mesh, using the mesh primitive reduces
291 memory requirements by a factor of 30 relative to individual triangles.
292 If a mesh has smoothed surfaces, we save a factor of 50 or more,
293 permitting very detailed geometries that would otherwise exhaust the
294 available memory.
295 In addition, the mesh primitive can have associated (u,v) coordinates
296 for pattern and texture mapping.
297 These are made available to function files via the Lu and Lv variables.
298 .LP
299 .UL Instance
300 .PP
301 An instance is a compound surface, given by the contents of an
302 octree file (created by oconv).
303 .DS
304 mod instance id
305 1+ octree transform
306 0
307 0
308 .DE
309 If the modifier is "void", then surfaces will use the modifiers given
310 in the original description.
311 Otherwise, the modifier specified is used in their place.
312 The transform moves the octree to the desired location in the scene.
313 Multiple instances using the same octree take little extra memory,
314 hence very complex descriptions can be rendered using this primitive.
315 .PP
316 There are a number of important limitations to be aware of when using
317 instances.
318 First, the scene description used to generate the octree must stand on
319 its own, without referring to modifiers in the parent description.
320 This is necessary for oconv to create the octree.
321 Second, light sources in the octree will not be incorporated correctly
322 in the calculation, and they are not recommended.
323 Finally, there is no advantage (other than convenience) to
324 using a single instance of an octree, or an octree containing only a
325 few surfaces.
326 An xform command on the subordinate description is prefered in such cases.
327 .NH 3
328 Materials
329 .PP
330 A material defines the way light interacts with a surface.
331 The basic types are given below.
332 .LP
333 .UL Light
334 .PP
335 Light is the basic material for self-luminous surfaces (i.e., light
336 sources).
337 In addition to the source surface type, spheres, discs (rings with zero
338 inner radius), cylinders (provided they are long enough), and
339 polygons can act as light sources.
340 Polygons work best when they are rectangular.
341 Cones cannot be used at this time.
342 A pattern may be used to specify a light output distribution.
343 Light is defined simply as a RGB radiance value (watts/steradian/m2):
344 .DS
345 mod light id
346 0
347 0
348 3 red green blue
349 .DE
350 .LP
351 .UL Illum
352 .PP
353 Illum is used for secondary light sources with broad distributions.
354 A secondary light source is treated like any other
355 light source, except when viewed directly.
356 It then acts like it is made of a different material (indicated by
357 the string argument), or becomes invisible (if no string argument is given,
358 or the argument is "void").
359 Secondary sources are useful when modeling windows or
360 brightly illuminated surfaces.
361 .DS
362 mod illum id
363 1 material
364 0
365 3 red green blue
366 .DE
367 .LP
368 .UL Glow
369 .PP
370 Glow is used for surfaces that are self-luminous, but limited
371 in their effect.
372 In addition to the radiance value, a maximum radius for
373 shadow testing is given:
374 .DS
375 mod glow id
376 0
377 0
378 4 red green blue maxrad
379 .DE
380 If maxrad is zero, then the surface will never be tested
381 for shadow, although it may participate in an interreflection calculation.
382 If maxrad is negative, then the surface will never contribute to scene
383 illumination.
384 Glow sources will never illuminate objects on the other side of an
385 illum surface.
386 This provides a convenient way to illuminate local light fixture
387 geometry without overlighting nearby objects.
388 .LP
389 .UL Spotlight
390 .PP
391 Spotlight is used for self-luminous surfaces having directed output.
392 As well as radiance, the full cone angle (in degrees)
393 and orientation (output direction) vector are given.
394 The length of the orientation vector is the distance
395 of the effective focus behind the source center (i.e., the focal length).
396 .DS
397 mod spotlight id
398 0
399 0
400 7 red green blue angle xdir ydir zdir
401 .DE
402 .LP
403 .UL Mirror
404 .PP
405 Mirror is used for planar surfaces that produce virtual
406 source reflections.
407 This material should be used sparingly, as it may cause the light
408 source calculation to blow up if it is applied to many small surfaces.
409 This material is only supported for flat surfaces such as polygons
410 and rings.
411 The arguments are simply the RGB reflectance values, which should be
412 between 0 and 1.
413 An optional string argument may be used like the illum type to specify a
414 different material to be used for shading non-source rays.
415 If this alternate material is given as "void", then the mirror surface
416 will be invisible.
417 This is only appropriate if the surface hides other (more detailed)
418 geometry with the same overall reflectance.
419 .DS
420 mod mirror id
421 1 material
422 0
423 3 red green blue
424 .DE
425 While alternate materials that are reflective will appear as normal,
426 indirect rays will use the mirror's reflectance rather than the
427 alternate type.
428 Transmitting materials are an exception, where both transmission and
429 reflection will use the alternate type for all rays not specifically
430 targeting virtual light sources.
431 In this case, it is important that any reflections be purely specular
432 (mirror-like) and equal to the mirror's reflectivity
433 to maintain a valid result.
434 A pure diffuse reflection may be added if desired.
435 .PP
436 The mirror material type reflects light sources only from the front side
437 of a surface, regardless of any alternate material.
438 If virtual source generation is desired on both sides, two coincident
439 surfaces with opposite normal orientations may be employed to achieve
440 this effect.
441 The reflectance and alternate material type may be
442 different for the overlapped surfaces,
443 and the two sides will behave accordingly.
444 .LP
445 .UL Prism1
446 .PP
447 The prism1 material is for general light redirection from prismatic
448 glazings, generating virtual light sources.
449 It can only be used to modify a planar surface (i.e., a polygon or disk)
450 and should not result in either light concentration or scattering.
451 The new direction of the ray can be on either side of the material,
452 and the definitions must have the correct bidirectional properties
453 to work properly with virtual light sources.
454 The arguments give the coefficient for the redirected light
455 and its direction.
456 .DS
457 mod prism1 id
458 5+ coef dx dy dz funcfile transform
459 0
460 n A1 A2 .. An
461 .DE
462 The new direction variables
463 .I "dx, dy"
464 and
465 .I dz
466 need not produce a normalized vector.
467 For convenience, the variables
468 .I "DxA, DyA"
469 and
470 .I DzA
471 are defined as the normalized direction to the target light source.
472 See section 2.2.1 on function files for further information.
473 .LP
474 .UL Prism2
475 .PP
476 The material prism2 is identical to prism1 except that
477 it provides for two ray redirections rather than one.
478 .DS
479 mod prism2 id
480 9+ coef1 dx1 dy1 dz1 coef2 dx2 dy2 dz2 funcfile transform
481 0
482 n A1 A2 .. An
483 .DE
484 .LP
485 .UL Mist
486 .PP
487 Mist is a virtual material used to delineate a volume
488 of participating atmosphere.
489 A list of important light sources may be given, along with an
490 extinction coefficient, scattering albedo and scattering eccentricity
491 parameter.
492 The light sources named by the string argument list
493 will be tested for scattering within the volume.
494 Sources are identified by name, and virtual light sources may be indicated
495 by giving the relaying object followed by '>' followed by the source, i.e:
496 .DS
497 3 source1 mirror1>source10 mirror2>mirror1>source3
498 .DE
499 Normally, only one source is given per mist material, and there is an
500 upper limit of 32 to the total number of active scattering sources.
501 The extinction coefficient, if given, is added to the global
502 coefficient set on the command line.
503 Extinction is in units of 1/distance (distance based on the world coordinates),
504 and indicates the proportional loss of radiance over one unit distance.
505 The scattering albedo, if present, will override the global setting within
506 the volume.
507 An albedo of 0\00\00 means a perfectly absorbing medium, and an albedo of
508 1\01\01\0 means
509 a perfectly scattering medium (no absorption).
510 The scattering eccentricity parameter will likewise override the global
511 setting if it is present.
512 Scattering eccentricity indicates how much scattered light favors the
513 forward direction, as fit by the Henyey-Greenstein function:
514 .DS
515 P(theta) = (1 - g*g) / (1 + g*g - 2*g*cos(theta))^1.5
516 .DE
517 A perfectly isotropic scattering medium has a g parameter of 0, and
518 a highly directional material has a g parameter close to 1.
519 Fits to the g parameter may be found along with typical extinction
520 coefficients and scattering albedos for various atmospheres and
521 cloud types in USGS meteorological tables.
522 (A pattern will be applied to the extinction values.)\0
523 .DS
524 mod mist id
525 N src1 src2 .. srcN
526 0
527 0|3|6|7 [ rext gext bext [ ralb galb balb [ g ] ] ]
528 .DE
529 There are two usual uses of the mist type.
530 One is to surround a beam from a spotlight or laser so that it is
531 visible during rendering.
532 For this application, it is important to use a cone (or cylinder) that
533 is long enough and wide enough to contain the important visible portion.
534 Light source photometry and intervening objects will have the desired
535 effect, and crossing beams will result in additive scattering.
536 For this application, it is best to leave off the real arguments, and
537 use the global rendering parameters to control the atmosphere.
538 The second application is to model clouds or other localized media.
539 Complex boundary geometry may be used to give shape to a uniform medium,
540 so long as the boundary encloses a proper volume.
541 Alternatively, a pattern may be used to set the line integral value
542 through the cloud for a ray entering or exiting a point in a given
543 direction.
544 For this application, it is best if cloud volumes do not overlap each other,
545 and opaque objects contained within them may not be illuminated correctly
546 unless the line integrals consider enclosed geometry.
547 .LP
548 .UL Plastic
549 .PP
550 Plastic is a material with uncolored highlights.
551 It is given by its RGB reflectance, its fraction of specularity,
552 and its roughness value.
553 Roughness is specified as the rms slope of surface facets.
554 A value of 0 corresponds to a perfectly smooth surface, and
555 a value of 1 would be a very rough surface.
556 Specularity fractions greater than 0.1 and
557 roughness values greater than 0.2 are not very
558 realistic.
559 (A pattern modifying plastic will affect the material color.)
560 .DS
561 mod plastic id
562 0
563 0
564 5 red green blue spec rough
565 .DE
566 .LP
567 .UL Metal
568 .PP
569 Metal is similar to plastic, but specular highlights
570 are modified by the material color.
571 Specularity of metals is usually .9 or greater.
572 As for plastic, roughness values above .2 are uncommon.
573 .LP
574 .UL Trans
575 .PP
576 Trans is a translucent material, similar to plastic.
577 The transmissivity is the fraction of penetrating light that
578 travels all the way through the material.
579 The transmitted specular component is the fraction of transmitted
580 light that is not diffusely scattered.
581 Transmitted and diffusely reflected light is modified by the material color.
582 Translucent objects are infinitely thin.
583 .DS
584 mod trans id
585 0
586 0
587 7 red green blue spec rough trans tspec
588 .DE
589 .LP
590 .UL Plastic2
591 .PP
592 Plastic2 is similar to plastic, but with anisotropic
593 roughness.
594 This means that highlights in the surface will appear elliptical rather
595 than round.
596 The orientation of the anisotropy is determined by the unnormalized
597 direction vector
598 .I "ux uy uz".
599 These three expressions (separated by white space) are evaluated in
600 the context of the function file
601 .I funcfile.
602 If no function file is required (i.e., no special variables or
603 functions are required), a period (`.') may be given in its
604 place.
605 (See the discussion of Function Files in the Auxiliary Files section).
606 The
607 .I urough
608 value defines the roughness along the
609 .B u
610 vector given projected onto the surface.
611 The
612 .I vrough
613 value defines the roughness perpendicular to this vector.
614 Note that the highlight will be narrower in the direction of the
615 smaller roughness value.
616 Roughness values of zero are not allowed for efficiency reasons
617 since the behavior would be the same as regular plastic in that
618 case.
619 .DS
620 mod plastic2 id
621 4+ ux uy uz funcfile transform
622 0
623 6 red green blue spec urough vrough
624 .DE
625 .LP
626 .UL Metal2
627 .PP
628 Metal2 is the same as plastic2, except that the highlights are
629 modified by the material color.
630 .LP
631 .UL Trans2
632 .PP
633 Trans2 is the anisotropic version of trans.
634 The string arguments are the same as for plastic2, and the real
635 arguments are the same as for trans but with an additional roughness
636 value.
637 .DS
638 mod trans2 id
639 4+ ux uy uz funcfile transform
640 0
641 8 red green blue spec urough vrough trans tspec
642 .DE
643 .LP
644 .UL Ashik2
645 .PP
646 Ashik2 is the anisotropic reflectance model by Ashikhmin & Shirley.
647 The string arguments are the same as for plastic2, but the real
648 arguments have additional flexibility to specify the specular color.
649 Also, rather than roughness, specular power is used, which has no
650 physical meaning other than larger numbers are equivalent to a smoother
651 surface.
652 Unlike other material types, total reflectance is the sum of
653 diffuse and specular colors, and should be adjusted accordingly.
654 .DS
655 mod ashik2 id
656 4+ ux uy uz funcfile transform
657 0
658 8 dred dgrn dblu sred sgrn sblu u-power v-power
659 .DE
660 .LP
661 .UL WGMDfunc
662 .PP
663 WGMDfunc is a more programmable version of trans2,
664 with separate modifier paths and variables to control each component.
665 (WGMD stands for Ward-Geisler-Moroder-Duer, which is the basis for
666 this empirical model, similar to the previous ones beside Ashik2.)\0
667 The specification of this material is given below.
668 .DS
669 mod WGMDfunc id
670 13+ rs_mod rs rs_urough rs_vrough
671 ts_mod ts ts_urough ts_vrough
672 td_mod
673 ux uy uz funcfile transform
674 0
675 9+ rfdif gfdif bfdif
676 rbdif gbdif bbdif
677 rtdif gtdif btdif
678 A10 ..
679 .DE
680 The sum of specular reflectance (
681 .I rs
682 ), specular transmittance (
683 .I ts
684 ), diffuse reflectance (
685 .I "rfdif gfdif bfdif"
686 for front and
687 .I "rbdif gbdif bbdif"
688 for back)
689 and diffuse transmittance (
690 .I "rtdif gtdif btdif"
691 ) should be less than 1 for each
692 channel.
693 .PP
694 Unique to this material, separate modifier channels are
695 provided for each component.
696 The main modifier is used on the diffuse reflectance, both
697 front and back.
698 The
699 .I rs_mod
700 modifier is used for specular reflectance.
701 If "void" is given for
702 .I rs_mod,
703 then the specular reflection color will be white.
704 The special "inherit" keyword may also be given, in which case
705 specular reflectance will share the main modifier.
706 This behavior is replicated for the specular transmittance modifier
707 .I ts_mod,
708 which has its own independent roughness expressions.
709 Finally, the diffuse transmittance modifier is given as
710 .I td_mod,
711 which may also be "void" or "inherit".
712 Note that any spectra or color for specular components must be
713 carried by the named modifier(s).
714 .PP
715 The main advantage to this material over BRTDfunc and
716 other programmable types described below is that the specular sampling is
717 well-defined, so that all components are fully computed.
718 .LP
719 .UL Dielectric
720 .PP
721 A dielectric material is transparent, and it refracts light
722 as well as reflecting it.
723 Its behavior is determined by the index of refraction and
724 transmission coefficient in each wavelength band per unit length.
725 Common glass has a index of refraction (n) around 1.5,
726 and a transmission coefficient of roughly 0.92 over an inch.
727 An additional number, the Hartmann constant, describes how
728 the index of refraction changes as a function of wavelength.
729 It is usually zero.
730 (A pattern modifies only the refracted value.)
731 .DS
732 mod dielectric id
733 0
734 0
735 5 rtn gtn btn n hc
736 .DE
737 .LP
738 .UL Interface
739 .PP
740 An interface is a boundary between two dielectrics.
741 The first transmission coefficient and refractive index are for the inside;
742 the second ones are for the outside.
743 Ordinary dielectrics are surrounded by a vacuum (1 1 1 1).
744 .DS
745 mod interface id
746 0
747 0
748 8 rtn1 gtn1 btn1 n1 rtn2 gtn2 btn2 n2
749 .DE
750 .LP
751 .UL Glass
752 .PP
753 Glass is similar to dielectric, but it is optimized for thin glass
754 surfaces (n = 1.52).
755 One transmitted ray and one reflected ray is produced.
756 By using a single surface is in place of two, internal reflections
757 are avoided.
758 The surface orientation is irrelevant, as it is for plastic,
759 metal, and trans.
760 The only specification required is the transmissivity at normal
761 incidence.
762 (Transmissivity is the amount of light not absorbed in one traversal
763 of the material.
764 Transmittance -- the value usually measured -- is the total light
765 transmitted through the pane including multiple reflections.)\0
766 To compute transmissivity (tn) from transmittance (Tn) use:
767 .DS
768 tn = (sqrt(.8402528435+.0072522239*Tn*Tn)-.9166530661)/.0036261119/Tn
769 .DE
770 Standard 88% transmittance glass has a transmissivity of 0.96.
771 (A pattern modifying glass will affect the transmissivity.)
772 If a fourth real argument is given, it is interpreted as the index of
773 refraction to use instead of 1.52.
774 .DS
775 mod glass id
776 0
777 0
778 3 rtn gtn btn
779 .DE
780 .LP
781 .UL Plasfunc
782 .PP
783 Plasfunc in used for the procedural definition of plastic-like
784 materials with arbitrary bidirectional reflectance distribution
785 functions (BRDF's).
786 The arguments to this material include the color and specularity,
787 as well as the function defining the specular distribution and the
788 auxiliary file where it may be found.
789 .DS
790 mod plasfunc id
791 2+ refl funcfile transform
792 0
793 4+ red green blue spec A5 ..
794 .DE
795 The function
796 .I refl
797 takes four arguments, the x, y and z
798 direction towards the incident light, and the solid angle
799 subtended by the source.
800 The solid angle is provided to facilitate averaging, and is usually
801 ignored.
802 The
803 .I refl
804 function should integrate to 1 over
805 the projected hemisphere to maintain energy balance.
806 At least four real arguments must be given, and these are made
807 available along with any additional values to the reflectance
808 function.
809 Currently, only the contribution from direct light sources is
810 considered in the specular calculation.
811 As in most material types, the surface normal is always
812 altered to face the incoming ray.
813 .LP
814 .UL Metfunc
815 .PP
816 Metfunc is identical to plasfunc and takes the same arguments, but
817 the specular component is multiplied also by the material color.
818 .LP
819 .UL Transfunc
820 .PP
821 Transfunc is similar to plasfunc but with an arbitrary bidirectional
822 transmittance distribution as well as a reflectance distribution.
823 Both reflectance and transmittance are specified with the same function.
824 .DS
825 mod transfunc id
826 2+ brtd funcfile transform
827 0
828 6+ red green blue rspec trans tspec A7 ..
829 .DE
830 Where
831 .I trans
832 is the total light transmitted and
833 .I tspec
834 is the non-Lambertian fraction of transmitted light.
835 The function
836 .I brtd
837 should integrate to 1 over each projected hemisphere.
838 .LP
839 .UL BRTDfunc
840 .PP
841 The material BRTDfunc gives the maximum flexibility over surface
842 reflectance and transmittance, providing for spectrally-dependent
843 specular rays and reflectance and transmittance distribution functions.
844 .DS
845 mod BRTDfunc id
846 10+ rrefl grefl brefl
847 rtrns gtrns btrns
848 rbrtd gbrtd bbrtd
849 funcfile transform
850 0
851 9+ rfdif gfdif bfdif
852 rbdif gbdif bbdif
853 rtdif gtdif btdif
854 A10 ..
855 .DE
856 The variables
857 .I "rrefl, grefl"
858 and
859 .I brefl
860 specify the color coefficients for
861 the ideal specular (mirror) reflection of the surface.
862 The variables
863 .I "rtrns, gtrns"
864 and
865 .I btrns
866 specify the color coefficients for the ideal specular transmission.
867 The functions
868 .I "rbrtd, gbrtd"
869 and
870 .I bbrtd
871 take the direction to the incident light (and its solid angle)
872 and compute the color coefficients for the directional diffuse part of
873 reflection and transmission.
874 As a special case, three identical values of '0' may be given in place of
875 these function names to indicate no directional diffuse component.
876 .PP
877 Unlike most other material types, the surface normal is not altered to
878 face the incoming ray.
879 Thus, functions and variables must pay attention to the orientation of
880 the surface and make adjustments appropriately.
881 However, the special variables for the perturbed dot product and surface
882 normal,
883 .I "RdotP, NxP, NyP"
884 and
885 .I NzP
886 are reoriented as if the ray hit the front surface for convenience.
887 .PP
888 A diffuse reflection component may be given for the front side with
889 .I "rfdif, gfdif"
890 and
891 .I bfdif
892 for the front side of the surface or
893 .I "rbdif, gbdif"
894 and
895 .I bbdif
896 for the back side.
897 The diffuse transmittance (must be the same for both sides by physical law)
898 is given by
899 .I "rtdif, gtdif"
900 and
901 .I btdif.
902 A pattern will modify these diffuse scattering values,
903 and will be available through the special variables
904 .I "CrP, CgP"
905 and
906 .I CbP.
907 .PP
908 Care must be taken when using this material type to produce a physically
909 valid reflection model.
910 The reflectance functions should be bidirectional, and under no circumstances
911 should the sum of reflected diffuse, transmitted diffuse, reflected specular,
912 transmitted specular and the integrated directional diffuse component be
913 greater than one.
914 .LP
915 .UL Plasdata
916 .PP
917 Plasdata is used for arbitrary BRDF's that are most conveniently
918 given as interpolated data.
919 The arguments to this material are the data file and coordinate index
920 functions, as well as a function to optionally modify the data
921 values.
922 .DS
923 mod plasdata id
924 3+n+
925 func datafile
926 funcfile x1 x2 .. xn transform
927 0
928 4+ red green blue spec A5 ..
929 .DE
930 The coordinate indices
931 .I "(x1, x2,"
932 etc.) are themselves functions of
933 the x, y and z direction to the incident light, plus the solid angle
934 subtended by the light source (usually ignored).
935 The data function
936 .I (func)
937 takes five variables, the
938 interpolated value from the n-dimensional data file, followed by the
939 x, y and z direction to the incident light and the solid angle of the source.
940 The light source direction and size may of course be ignored by the function.
941 .LP
942 .UL Metdata
943 .PP
944 As metfunc is to plasfunc, metdata is to plasdata.
945 Metdata takes the same arguments as plasdata, but the specular
946 component is modified by the given material color.
947 .LP
948 .UL Transdata
949 .PP
950 Transdata is like plasdata but the specification includes transmittance
951 as well as reflectance.
952 The parameters are as follows.
953 .DS
954 mod transdata id
955 3+n+
956 func datafile
957 funcfile x1 x2 .. xn transform
958 0
959 6+ red green blue rspec trans tspec A7 ..
960 .DE
961 .LP
962 .UL BSDF
963 .PP
964 The BSDF material type loads an XML (eXtensible Markup Language)
965 file describing a bidirectional scattering distribution function.
966 Real arguments to this material may define additional
967 diffuse components that augment the BSDF data.
968 String arguments are used to define thickness for proxied
969 surfaces and the "up" orientation for the material.
970 .DS
971 mod BSDF id
972 6+ thick BSDFfile ux uy uz funcfile transform
973 0
974 0|3|6|9
975 rfdif gfdif bfdif
976 rbdif gbdif bbdif
977 rtdif gtdif btdif
978 .DE
979 The first string argument is a "thickness" parameter that may be used
980 to hide detail geometry being proxied by an aggregate BSDF material.
981 If a view or shadow ray hits a BSDF proxy with non-zero thickness,
982 it will pass directly through as if the surface were not there.
983 Similar to the illum type, this permits direct viewing and
984 shadow testing of complex geometry.
985 The BSDF is used when a scattered (indirect) ray hits the surface,
986 and any transmitted sample rays will be offset by the thickness amount
987 to avoid the hidden geometry and gather samples from the other side.
988 In this manner, BSDF surfaces can improve the results for indirect
989 scattering from complex systems without sacrificing appearance or
990 shadow accuracy.
991 If the BSDF has transmission and back-side reflection data,
992 a parallel BSDF surface may be
993 placed slightly less than the given thickness away from the front surface
994 to enclose the complex geometry on both sides.
995 The sign of the thickness is important, as it indicates whether the
996 proxied geometry is behind the BSDF surface (when thickness is positive)
997 or in front (when thickness is negative).
998 .LP
999 The second string argument is the name of the BSDF file, which is
1000 found in the usual auxiliary locations.
1001 The following three string parameters name variables for an "up" vector,
1002 which together with the surface normal, define the
1003 local coordinate system that orients the BSDF.
1004 These variables, along with the thickness, are defined in a function
1005 file given as the next string argument.
1006 An optional transform is used to scale the thickness and reorient the up vector.
1007 .LP
1008 If no real arguments are given, the BSDF is used by itself to determine
1009 reflection and transmission.
1010 If there are at least 3 real arguments, the first triplet is an
1011 additional diffuse reflectance for the front side.
1012 At least 6 real arguments adds diffuse reflectance to the rear side of the surface.
1013 If there are 9 real arguments, the final triplet will be taken as an additional
1014 diffuse transmittance.
1015 All diffuse components as well as the non-diffuse transmission are
1016 modified by patterns applied to this material.
1017 The non-diffuse reflection from either side are unaffected.
1018 Textures perturb the effective surface normal in the usual way.
1019 .LP
1020 The surface normal of this type is not altered to face the incoming ray,
1021 so the front and back BSDF reflections may differ.
1022 (Transmission is identical front-to-back by physical law.)\0
1023 If back visibility is turned off during rendering and there is no
1024 transmission or back-side reflection, only then the surface will be
1025 invisible from behind.
1026 Unlike other data-driven material types, the BSDF type is fully
1027 supported and all parts of the distribution are properly sampled.
1028 .LP
1029 .UL aBSDF
1030 .PP
1031 The aBSDF material is identical to the BSDF type with two important
1032 differences.
1033 First, proxy geometry is not supported, so there is no thickness parameter.
1034 Second, an aBSDF is assumed to have some specular through component
1035 (the 'a' stands for "aperture"), which
1036 is treated specially during the direct calculation and when viewing the
1037 material.
1038 Based on the BSDF data, the coefficient of specular transmission is
1039 determined and used for modifying unscattered shadow and view rays.
1040 .DS
1041 mod aBSDF id
1042 5+ BSDFfile ux uy uz funcfile transform
1043 0
1044 0|3|6|9
1045 rfdif gfdif bfdif
1046 rbdif gbdif bbdif
1047 rtdif gtdif btdif
1048 .DE
1049 .LP
1050 If a material has no specular transmitted component, it is much better
1051 to use the BSDF type with a zero thickness than to use aBSDF.
1052 .LP
1053 .UL Antimatter
1054 .PP
1055 Antimatter is a material that can "subtract" volumes from other volumes.
1056 A ray passing into an antimatter object becomes blind to all the specified
1057 modifiers:
1058 .DS
1059 mod antimatter id
1060 N mod1 mod2 .. modN
1061 0
1062 0
1063 .DE
1064 The first modifier will also be used to shade the area leaving the
1065 antimatter volume and entering the regular volume.
1066 If mod1 is void, the antimatter volume is completely invisible.
1067 If shading is desired at antimatter surfaces, it is important
1068 that the related volumes are closed with outward-facing normals.
1069 Antimatter surfaces should not intersect with other antimatter boundaries,
1070 and it is unwise to use the same modifier in nested antimatter volumes.
1071 The viewpoint must be outside all volumes concerned for a correct
1072 rendering.
1073 .NH 3
1074 Textures
1075 .PP
1076 A texture is a perturbation of the surface normal, and
1077 is given by either a function or data.
1078 .LP
1079 .UL Texfunc
1080 .PP
1081 A texfunc uses an auxiliary function file
1082 to specify a procedural texture:
1083 .DS
1084 mod texfunc id
1085 4+ xpert ypert zpert funcfile transform
1086 0
1087 n A1 A2 .. An
1088 .DE
1089 .LP
1090 .UL Texdata
1091 .PP
1092 A texdata texture uses three data files to get the surface
1093 normal perturbations.
1094 The variables
1095 .I xfunc,
1096 .I yfunc
1097 and
1098 .I zfunc
1099 take three arguments
1100 each from the interpolated values in
1101 .I xdfname,
1102 .I ydfname
1103 and
1104 .I zdfname.
1105 .DS
1106 mod texdata id
1107 8+ xfunc yfunc zfunc xdfname ydfname zdfname vfname x0 x1 .. xf
1108 0
1109 n A1 A2 .. An
1110 .DE
1111 .NH 3
1112 Patterns
1113 .PP
1114 Patterns are used to modify the reflectance of materials.
1115 The basic types are given below.
1116 .LP
1117 .UL Colorfunc
1118 .PP
1119 A colorfunc is a procedurally defined color pattern.
1120 It is specified as follows:
1121 .DS
1122 mod colorfunc id
1123 4+ red green blue funcfile transform
1124 0
1125 n A1 A2 .. An
1126 .DE
1127 .LP
1128 .UL Brightfunc
1129 .PP
1130 A brightfunc is the same as a colorfunc, except it is monochromatic.
1131 .DS
1132 mod brightfunc id
1133 2+ refl funcfile transform
1134 0
1135 n A1 A2 .. An
1136 .DE
1137 .LP
1138 .UL Colordata
1139 .PP
1140 Colordata uses an interpolated data map to modify a material's color.
1141 The map is n-dimensional, and is stored in three
1142 auxiliary files, one for each color.
1143 The coordinates used to look up and interpolate the data are
1144 defined in another auxiliary file.
1145 The interpolated data values are modified by functions of
1146 one or three variables.
1147 If the functions are of one variable, then they are passed the
1148 corresponding color component (red or green or blue).
1149 If the functions are of three variables, then they are passed the
1150 original red, green, and blue values as parameters.
1151 .DS
1152 mod colordata id
1153 7+n+
1154 rfunc gfunc bfunc rdatafile gdatafile bdatafile
1155 funcfile x1 x2 .. xn transform
1156 0
1157 m A1 A2 .. Am
1158 .DE
1159 .LP
1160 .UL Brightdata
1161 .PP
1162 Brightdata is like colordata, except monochromatic.
1163 .DS
1164 mod brightdata id
1165 3+n+
1166 func datafile
1167 funcfile x1 x2 .. xn transform
1168 0
1169 m A1 A2 .. Am
1170 .DE
1171 .LP
1172 .UL Colorpict
1173 .PP
1174 Colorpict is a special case of colordata, where the pattern is
1175 a two-dimensional image stored in the RADIANCE picture format.
1176 The dimensions of the image data are determined by the picture
1177 such that the smaller dimension is always 1, and the other
1178 is the ratio between the larger and the smaller.
1179 For example, a 500x338 picture would have coordinates (u,v)
1180 in the rectangle between (0,0) and (1.48,1).
1181 .DS
1182 mod colorpict id
1183 7+
1184 rfunc gfunc bfunc pictfile
1185 funcfile u v transform
1186 0
1187 m A1 A2 .. Am
1188 .DE
1189 .LP
1190 .UL Colortext
1191 .PP
1192 Colortext is dichromatic writing in a polygonal font.
1193 The font is defined in an auxiliary file, such as
1194 .I helvet.fnt.
1195 The text itself is also specified in a separate file, or
1196 can be part of the material arguments.
1197 The character size, orientation, aspect ratio and slant is
1198 determined by right and down motion vectors.
1199 The upper left origin for the text block as well as
1200 the foreground and background colors
1201 must also be given.
1202 .DS
1203 mod colortext id
1204 2 fontfile textfile
1205 0
1206 15+
1207 Ox Oy Oz
1208 Rx Ry Rz
1209 Dx Dy Dz
1210 rfore gfore bfore
1211 rback gback bback
1212 [spacing]
1213 .DE
1214 or:
1215 .DS
1216 mod colortext id
1217 2+N fontfile . This is a line with N words ...
1218 0
1219 15+
1220 Ox Oy Oz
1221 Rx Ry Rz
1222 Dx Dy Dz
1223 rfore gfore bfore
1224 rback gback bback
1225 [spacing]
1226 .DE
1227 .LP
1228 .UL Brighttext
1229 .PP
1230 Brighttext is like colortext, but the writing is monochromatic.
1231 .DS
1232 mod brighttext id
1233 2 fontfile textfile
1234 0
1235 11+
1236 Ox Oy Oz
1237 Rx Ry Rz
1238 Dx Dy Dz
1239 foreground background
1240 [spacing]
1241 .DE
1242 or:
1243 .DS
1244 mod brighttext id
1245 2+N fontfile . This is a line with N words ...
1246 0
1247 11+
1248 Ox Oy Oz
1249 Rx Ry Rz
1250 Dx Dy Dz
1251 foreground background
1252 [spacing]
1253 .DE
1254 .LP
1255 By default, a uniform spacing algorithm is used that guarantees
1256 every character will appear in a precisely determined position.
1257 Unfortunately, such a scheme results in rather unattractive and difficult to
1258 read text with most fonts.
1259 The optional
1260 .I spacing
1261 value defines the distance between characters for proportional spacing.
1262 A positive value selects a spacing algorithm that preserves right margins and
1263 indentation, but does not provide the ultimate in proportionally spaced text.
1264 A negative value insures that characters are properly spaced, but the
1265 placement of words then varies unpredictably.
1266 The choice depends on the relative importance of spacing versus formatting.
1267 When presenting a section of formatted text, a positive spacing value is
1268 usually preferred.
1269 A single line of text will often be accompanied by a negative spacing value.
1270 A section of text meant to depict a picture, perhaps using a special purpose
1271 font such as hexbit4x1.fnt, calls for uniform spacing.
1272 Reasonable magnitudes for proportional spacing are
1273 between 0.1 (for tightly spaced characters) and 0.3 (for wide spacing).
1274 .LP
1275 .UL Spectrum
1276 .PP
1277 The spectrum primitive is the most basic type for introducing spectral
1278 color to a material.
1279 Since materials only provide RGB parameters, spectral patterns
1280 are the only way to superimpose wavelength-dependent behavior.
1281 .DS
1282 mod spectrum id
1283 0
1284 0
1285 5+ nmA nmB s1 s2 .. sN
1286 .DE
1287 The first two real arguments indicate the extrema of the
1288 spectral range in nanometers.
1289 Subsequent real values correspond to multipliers at each wavelength.
1290 The nmA wavelength may be greater or less than nmB,
1291 but they may not be equal, and their ordering matches
1292 the order of the spectral values.
1293 A minimum of 3 values must be given, which would act
1294 more or less the same as a constant RGB multiplier.
1295 As with RGB values, spectral quantities normally range between 0
1296 and 1 at each wavelength, or average to 1.0 against a standard
1297 sensitivity functions such as V(lambda).
1298 The best results obtain when the spectral range and number
1299 of samples match rendering options, though resampling will handle
1300 any differences, zero-filling wavelenths outside the nmA to nmB
1301 range.
1302 A warning will be issued if the given wavelength range does not
1303 adequately cover the visible spectrum.
1304 .LP
1305 .UL Specfile
1306 .PP
1307 The specfile primitive is equivalent to the spectrum type, but
1308 the wavelength range and values are contained in a 1-dimensional
1309 data file.
1310 This may be a more convenient way to specify a spectral color,
1311 especially one corresponding to a standard illuminant such as D65
1312 or a library of measured spectra.
1313 .DS
1314 mod specfile id
1315 1 datafile
1316 0
1317 0
1318 .DE
1319 As with the spectrum type, rendering wavelengths outside the defined
1320 range will be zero-filled.
1321 Unlike the spectrum type, the file may contain non-uniform samples.
1322 .LP
1323 .UL Specfunc
1324 .PP
1325 The specfunc primitive offers dynamic control over a spectral
1326 pattern, similar to the colorfunc type.
1327 .DS
1328 mod specfunc id
1329 2+ sfunc funcfile transform
1330 0
1331 2+ nmA nmB A3 ..
1332 .DE
1333 Like the spectrum primitive, the wavelength range is specified
1334 in the first two real arguments, and additional real values are
1335 set in the evaluation context.
1336 This function is fed a wavelenth sample
1337 between nmA and nmB as its only argument,
1338 and it returns the corresponding spectral intensity.
1339 .LP
1340 .UL Specdata
1341 .PP
1342 Specdata is like brightdata and colordata, but with more
1343 than 3 specular samples.
1344 .DS
1345 mod specdata id
1346 3+n+
1347 func datafile
1348 funcfile x1 x2 .. xn transform
1349 0
1350 m A1 A2 .. Am
1351 .DE
1352 The data file must have one more dimension than the coordinate
1353 variable count, as this final dimension corresponds to the covered
1354 spectrum.
1355 The starting and ending wavelengths are specified in "datafile"
1356 as well as the number of spectral samples.
1357 The function "func" will be called with two parameters, the
1358 interpolated spectral value for the current coordinate and the
1359 associated wavelength.
1360 If the spectrum is broken into 12 components, then 12 calls
1361 will be made to "func" for the relevant ray evaluation.
1362 .LP
1363 .UL Specpict
1364 .PP
1365 Specpict is a special case of specdata, where the pattern is
1366 a hyperspectral image stored in the common-exponent file format.
1367 The dimensions of the image data are determined by the picture
1368 just as with the colorpict primitive.
1369 .DS
1370 mod specpict id
1371 5+
1372 func specfile
1373 funcfile u v transform
1374 0
1375 m A1 A2 .. Am
1376 .DE
1377 The function "func" is called with the interpolated pixel value
1378 and the wavelength sample in nanometers, the same as specdata,
1379 with as many calls made as there are components in "specfile".
1380 .NH 3
1381 Mixtures
1382 .PP
1383 A mixture is a blend of one or more materials or textures and patterns.
1384 Blended materials should not be light source types or virtual source types.
1385 The basic types are given below.
1386 .LP
1387 .UL Mixfunc
1388 .PP
1389 A mixfunc mixes two modifiers procedurally.
1390 It is specified as follows:
1391 .DS
1392 mod mixfunc id
1393 4+ foreground background vname funcfile transform
1394 0
1395 n A1 A2 .. An
1396 .DE
1397 Foreground and background are modifier names that must be
1398 defined earlier in the scene description.
1399 If one of these is a material, then
1400 the modifier of the mixfunc must be "void".
1401 (Either the foreground or background modifier may be "void",
1402 which serves as a form of opacity control when used with a material.)\0
1403 Vname is the coefficient defined in funcfile that determines the influence
1404 of foreground.
1405 The background coefficient is always (1-vname).
1406 .LP
1407 .UL Mixdata
1408 .PP
1409 Mixdata combines two modifiers using an auxiliary data file:
1410 .DS
1411 mod mixdata id
1412 5+n+
1413 foreground background func datafile
1414 funcfile x1 x2 .. xn transform
1415 0
1416 m A1 A2 .. Am
1417 .DE
1418 .LP
1419 .UL Mixpict
1420 .PP
1421 Mixpict combines two modifiers based on a picture:
1422 .DS
1423 mod mixpict id
1424 7+
1425 foreground background func pictfile
1426 funcfile u v transform
1427 0
1428 m A1 A2 .. Am
1429 .DE
1430 The mixing coefficient function "func" takes three
1431 arguments, the red, green and blue values
1432 corresponding to the pixel at (u,v).
1433 .LP
1434 .UL Mixtext
1435 .PP
1436 Mixtext uses one modifier for the text foreground, and one for the
1437 background:
1438 .DS
1439 mod mixtext id
1440 4 foreground background fontfile textfile
1441 0
1442 9+
1443 Ox Oy Oz
1444 Rx Ry Rz
1445 Dx Dy Dz
1446 [spacing]
1447 .DE
1448 or:
1449 .DS
1450 mod mixtext id
1451 4+N
1452 foreground background fontfile .
1453 This is a line with N words ...
1454 0
1455 9+
1456 Ox Oy Oz
1457 Rx Ry Rz
1458 Dx Dy Dz
1459 [spacing]
1460 .DE
1461 .NH 2
1462 Auxiliary Files
1463 .PP
1464 Auxiliary files used in textures and patterns
1465 are accessed by the programs during image generation.
1466 These files may be located in the working directory, or in
1467 a library directory.
1468 The environment variable
1469 .I RAYPATH
1470 can be assigned an alternate set of search directories.
1471 Following is a brief description of some common file types.
1472 .NH 3
1473 Function Files
1474 .PP
1475 A function file contains the definitions of variables, functions
1476 and constants used by a primitive.
1477 The transformation that accompanies the file name contains the necessary
1478 rotations, translations and scalings to bring the coordinates of
1479 the function file into agreement with the world coordinates.
1480 The transformation specification is the same as for the
1481 .I xform
1482 command.
1483 An example function file is given below:
1484 .DS
1485 {
1486 This is a comment, enclosed in curly braces.
1487 {Comments can be nested.}
1488 }
1489 { standard expressions use +,-,*,/,^,(,) }
1490 vname = Ny * func(A1) ;
1491 { constants are defined with a colon }
1492 const : sqrt(PI/2) ;
1493 { user-defined functions add to library }
1494 func(x) = 5 + A1*sin(x/3) ;
1495 { functions may be passed and recursive }
1496 rfunc(f,x) = if(x,f(x),f(-x)*rfunc(f,x+1)) ;
1497 { constant functions may also be defined }
1498 cfunc(x) : 10*x / sqrt(x) ;
1499 .DE
1500 Many variables and functions are already defined by the program,
1501 and they are listed in the file
1502 .I rayinit.cal.
1503 The following variables are particularly important:
1504 .DS
1505 Dx, Dy, Dz - incident ray direction
1506 Nx, Ny, Nz - surface normal at intersection point
1507 Px, Py, Pz - intersection point
1508 T - distance from start
1509 Ts - single ray (shadow) distance
1510 Rdot - cosine between ray and normal
1511 arg(0) - number of real arguments
1512 arg(i) - i'th real argument
1513 .DE
1514 For mesh objects, the local surface coordinates are available:
1515 .DS
1516 Lu, Lv - local (u,v) coordinates
1517 .DE
1518 For BRDF types, the following variables are defined as well:
1519 .DS
1520 NxP, NyP, NzP - perturbed surface normal
1521 RdotP - perturbed dot product
1522 CrP, CgP, CbP - perturbed material color
1523 .DE
1524 A unique context is set up for each file so that the same variable
1525 may appear in different function files without conflict.
1526 The variables listed above and any others defined in
1527 rayinit.cal are available globally.
1528 If no file is needed by a given primitive because all the required
1529 variables are global, a period (`.') can be given in
1530 place of the file name.
1531 It is also possible to give an expression instead of a straight
1532 variable name in a scene file.
1533 Functions (requiring parameters)
1534 must be given as names and not as expressions.
1535 .PP
1536 Constant expressions are used as an optimization in function
1537 files.
1538 They are replaced wherever they occur in an expression by their
1539 value.
1540 Constant expressions are evaluated only once, so they must not
1541 contain any variables or values that can change, such as the ray
1542 variables Px and Ny or the primitive argument function arg().
1543 All the math library functions such as sqrt() and cos() have the
1544 constant attribute, so they will be replaced by immediate values
1545 whenever they are given constant arguments.
1546 Thus, the subexpression cos(PI*sqrt(2)) is immediately replaced
1547 by its value, -.266255342, and does not cause any additional overhead
1548 in the calculation.
1549 .PP
1550 It is generally a good idea to define constants and variables before
1551 they are referred to in a function file.
1552 Although evaluation does not take place until later, the interpreter
1553 does variable scoping and constant subexpression evaluation based on
1554 what it has compiled already.
1555 For example, a variable that is defined globally in rayinit.cal then
1556 referenced in the local context of a function file cannot
1557 subsequently be redefined in the same file because the compiler
1558 has already determined the scope of the referenced variable as global.
1559 To avoid such conflicts, one can state the scope of a variable explicitly
1560 by preceding the variable name with a context mark (a back-quote) for
1561 a local variable, or following the name with a context mark for a global
1562 variable.
1563 .NH 3
1564 Data Files
1565 .PP
1566 Data files contain n-dimensional arrays of real numbers used
1567 for interpolation.
1568 Typically, definitions in a function file determine how
1569 to index and use interpolated data values.
1570 The basic data file format is as follows:
1571 .DS
1572 N
1573 beg1 end1 m1
1574 0 0 m2 x2.1 x2.2 x2.3 x2.4 .. x2.m2
1575 ...
1576 begN endN mN
1577 DATA, later dimensions changing faster.
1578 .DE
1579 N is the number of dimensions.
1580 For each dimension, the beginning and ending coordinate
1581 values and the dimension size is given.
1582 Alternatively, individual coordinate values can be given when
1583 the points are not evenly spaced.
1584 These values must either be increasing or decreasing monotonically.
1585 The data is m1*m2*...*mN real numbers in ASCII form.
1586 Comments may appear anywhere in the file, beginning with a pound
1587 sign ('#') and continuing to the end of line.
1588 .NH 3
1589 Font Files
1590 .PP
1591 A font file lists the polygons which make up a character set.
1592 Comments may appear anywhere in the file, beginning with a pound
1593 sign ('#') and continuing to the end of line.
1594 All numbers are decimal integers:
1595 .DS
1596 code n
1597 x0 y0
1598 x1 y1
1599 ...
1600 xn yn
1601 ...
1602 .DE
1603 The ASCII codes can appear in any order.
1604 N is the number of vertices, and the last is automatically
1605 connected to the first.
1606 Separate polygonal sections are joined by coincident sides.
1607 The character coordinate system is a square with lower left corner at
1608 (0,0), lower right at (255,0) and upper right at (255,255).
1609 .NH 2
1610 Generators
1611 .PP
1612 A generator is any program that produces a scene description
1613 as its output.
1614 They usually appear as commands in a scene description file.
1615 An example of a simple generator is
1616 .I genbox.
1617 .I Genbox
1618 takes the arguments of width, height and depth to produce
1619 a parallelepiped description.
1620 .I Genprism
1621 takes a list of 2-dimensional coordinates and extrudes them along a vector to
1622 produce a 3-dimensional prism.
1623 .I Genrev
1624 is a more sophisticated generator
1625 that produces an object of rotation from parametric functions
1626 for radius and axis position.
1627 .I Gensurf
1628 tessellates a surface defined by the
1629 parametric functions x(s,t), y(s,t), and z(s,t).
1630 .I Genworm
1631 links cylinders and spheres along a curve.
1632 .I Gensky
1633 produces a sun and sky distribution corresponding
1634 to a given time and date.
1635 .PP
1636 .I Xform
1637 is a program that transforms a scene description from one
1638 coordinate space to another.
1639 .I Xform
1640 does rotation, translation, scaling, and mirroring.
1641 .NH 1
1642 Image Generation
1643 .PP
1644 Once the scene has been described in three-dimensions, it
1645 is possible to generate a two-dimensional image from a
1646 given perspective.
1647 .PP
1648 The image generating programs use an
1649 .I octree
1650 to efficiently trace rays through the scene.
1651 An octree subdivides space into nested octants which
1652 contain sets of surfaces.
1653 In RADIANCE, an octree is created from a scene description by
1654 .I oconv.
1655 The details of this process are not important,
1656 but the octree will serve as input to the ray-tracing
1657 programs and directs the use of a scene description.
1658 .PP
1659 .I Rview
1660 is ray-tracing program for viewing a scene interactively.
1661 When the user specifies a new perspective,
1662 .I rview
1663 quickly displays a rough
1664 image on the terminal, then progressively
1665 increases the resolution as the user looks on.
1666 He can select a particular section of the image to improve,
1667 or move to a different view and start over.
1668 This mode of interaction is useful for debugging scenes
1669 as well as determining the best view for a final image.
1670 .PP
1671 .I Rpict
1672 produces a high-resolution picture of a scene from
1673 a particular perspective.
1674 This program features adaptive sampling, crash
1675 recovery and progress reporting, all of which are important
1676 for time-consuming images.
1677 .PP
1678 A number of filters are available for manipulating picture files.
1679 .I Pfilt
1680 sets the exposure and performs anti-aliasing.
1681 .I Pcompos
1682 composites (cuts and pastes) pictures.
1683 .I Pcond
1684 conditions a picture for a specific display device.
1685 .I Pcomb
1686 performs arbitrary math on one or more pictures.
1687 .I Protate
1688 rotates a picture 90 degrees clockwise.
1689 .I Pflip
1690 flips a picture horizontally, vertically, or both (180 degree rotation).
1691 .I Pvalue
1692 converts a picture to and from simpler formats.
1693 .PP
1694 Pictures may be displayed directly under X11 using the program
1695 .I ximage,
1696 or converted a standard image format.
1697 .I Ra_bmp
1698 converts to and from Microsoft Bitmap images.
1699 .I Ra_ppm
1700 converts to and from Poskanzer Portable Pixmap formats.
1701 .I Ra_ps
1702 converts to PostScript color and greyscale formats.
1703 .I Ra_rgbe
1704 converts to and from Radiance uncompressed picture format.
1705 .I Ra_t16
1706 converts to and from Targa 16 and 24-bit image formats.
1707 .I Ra_t8
1708 converts to and from Targa 8-bit image format.
1709 .I Ra_tiff
1710 converts to and from TIFF.
1711 .I Ra_xyze
1712 converts to and from Radiance CIE picture format.
1713 .NH 1
1714 License
1715 .PP
1716 .DS
1717 The Radiance Software License, Version 1.0
1718
1719 Copyright (c) 1990 - 2008 The Regents of the University of California,
1720 through Lawrence Berkeley National Laboratory. All rights reserved.
1721
1722 Redistribution and use in source and binary forms, with or without
1723 modification, are permitted provided that the following conditions
1724 are met:
1725
1726 1. Redistributions of source code must retain the above copyright
1727 notice, this list of conditions and the following disclaimer.
1728
1729 2. Redistributions in binary form must reproduce the above copyright
1730 notice, this list of conditions and the following disclaimer in
1731 the documentation and/or other materials provided with the
1732 distribution.
1733
1734 3. The end-user documentation included with the redistribution,
1735 if any, must include the following acknowledgment:
1736 "This product includes Radiance software
1737 (http://radsite.lbl.gov/)
1738 developed by the Lawrence Berkeley National Laboratory
1739 (http://www.lbl.gov/)."
1740 Alternately, this acknowledgment may appear in the software itself,
1741 if and wherever such third-party acknowledgments normally appear.
1742
1743 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
1744 and "The Regents of the University of California" must
1745 not be used to endorse or promote products derived from this
1746 software without prior written permission. For written
1747 permission, please contact [email protected].
1748
1749 5. Products derived from this software may not be called "Radiance",
1750 nor may "Radiance" appear in their name, without prior written
1751 permission of Lawrence Berkeley National Laboratory.
1752
1753 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1754 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1755 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1756 DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
1757 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1758 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1759 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1760 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1761 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1762 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
1763 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1764 SUCH DAMAGE.
1765 .DE
1766 .NH 1
1767 Acknowledgements
1768 .PP
1769 This work was supported by the Assistant Secretary of Conservation
1770 and Renewable Energy, Office of Building Energy Research and
1771 Development, Buildings Equipment Division of the U.S. Department of
1772 Energy under Contract No. DE-AC03-76SF00098.
1773 .PP
1774 Additional work was sponsored by the Swiss federal government
1775 under the Swiss LUMEN Project and was
1776 carried out in the Laboratoire d'Energie Solaire (LESO Group) at
1777 the Ecole Polytechnique Federale de Lausanne (EPFL University)
1778 in Lausanne, Switzerland.
1779 .NH 1
1780 References
1781 .LP
1782 Ward, Gregory J., Bruno Bueno, David Geisler-Moroder,
1783 Lars O. Grobe, Jacob C. Jonsson, Eleanor
1784 S. Lee, Taoning Wang, Helen Rose Wilson,
1785 ``Daylight Simulation Workflows Incorporating
1786 Measured Bidirectional Scattering Distribution Functions,''
1787 .I "Energy & Buildings",
1788 Vol. 259, No. 111890, 2022.
1789 .LP
1790 Wang, Taoning, Gregory Ward, Eleanor Lee,
1791 ``Efficient modeling of optically-complex, non-coplanar
1792 exterior shading: Validation of matrix algebraic methods,''
1793 .I "Energy & Buildings",
1794 vol. 174, pp. 464-83, Sept. 2018.
1795 .LP
1796 Lee, Eleanor S., David Geisler-Moroder, Gregory Ward,
1797 ``Modeling the direct sun component in buildings using matrix
1798 algebraic approaches: Methods and validation,''
1799 .I Solar Energy,
1800 vol. 160, 15 January 2018, pp 380-395.
1801 .LP
1802 Ward, G., M. Kurt & N. Bonneel,
1803 ``Reducing Anisotropic BSDF Measurement to Common Practice,''
1804 .I Workshop on Material Appearance Modeling,
1805 2014.
1806 .LP
1807 McNeil, A., C.J. Jonsson, D. Appelfeld, G. Ward, E.S. Lee,
1808 ``A validation of a ray-tracing tool used to generate
1809 bi-directional scattering distribution functions for
1810 complex fenestration systems,''
1811 .I "Solar Energy",
1812 98, 404-14, November 2013.
1813 .LP
1814 Ward, G., R. Mistrick, E.S. Lee, A. McNeil, J. Jonsson,
1815 ``Simulating the Daylight Performance of Complex Fenestration Systems
1816 Using Bidirectional Scattering Distribution Functions within Radiance,''
1817 .I "Leukos",
1818 7(4),
1819 April 2011.
1820 .LP
1821 Cater, K., A. Chalmers, G. Ward,
1822 ``Detail to Attention: Exploiting Visual Tasks for Selective Rendering,''
1823 .I "Eurograhics Symposium on Rendering",
1824 June 2003.
1825 .LP
1826 Ward, G., Elena Eydelberg-Vileshin,
1827 ``Picture Perfect RGB Rendering Using Spectral Prefiltering and
1828 Sharp Color Primaries,''
1829 13th Eurographics Workshop on Rendering, P. Debevec and
1830 S. Gibson (Editors), June 2002.
1831 .LP
1832 Ward, G. and M. Simmons,
1833 ``The Holodeck Ray Cache: An Interactive Rendering System for Global
1834 Illumination in Nondiffuse Environments,''
1835 .I "ACM Transactions on Graphics,"
1836 18(4):361-98, October 1999.
1837 .LP
1838 Larson, G.W., H. Rushmeier, C. Piatko,
1839 ``A Visibility Matching Tone Reproduction Operator for High Dynamic
1840 Range Scenes,''
1841 .I "IEEE Transactions on Visualization and Computer Graphics",
1842 3(4), 291-306, December 1997.
1843 .LP
1844 Ward, G.,
1845 ``Making Global Illumination User Friendly,''
1846 .I "Sixth Eurographics Workshop on Rendering",
1847 proceedings to be published by Springer-Verlag,
1848 Dublin, Ireland, June 1995.
1849 .LP
1850 Rushmeier, H., G. Ward, C. Piatko, P. Sanders, B. Rust,
1851 ``Comparing Real and Synthetic Images: Some Ideas about Metrics,''
1852 .I "Sixth Eurographics Workshop on Rendering",
1853 proceedings to be published by Springer-Verlag,
1854 Dublin, Ireland, June 1995.
1855 .LP
1856 Ward, G.,
1857 ``The Radiance Lighting Simulation and Rendering System,''
1858 .I "Computer Graphics",
1859 Orlando, July 1994.
1860 .LP
1861 Rushmeier, H., G. Ward,
1862 ``Energy-Preserving Non-Linear Filters,''
1863 .I "Computer Graphics",
1864 Orlando, July 1994.
1865 .LP
1866 Ward, G.,
1867 ``A Contrast-Based Scalefactor for Luminance Display,''
1868 .I "Graphics Gems IV",
1869 Edited by Paul Heckbert,
1870 Academic Press 1994.
1871 .LP
1872 Ward, G.,
1873 ``Measuring and Modeling Anisotropic Reflection,''
1874 .I "Computer Graphics",
1875 Chicago, July 1992.
1876 .LP
1877 Ward, G., P. Heckbert,
1878 ``Irradiance Gradients,''
1879 .I "Third Annual Eurographics Workshop on Rendering",
1880 to be published by Springer-Verlag, held in Bristol, UK, May 1992.
1881 .LP
1882 Ward, G.,
1883 ``Adaptive Shadow Testing for Ray Tracing,''
1884 .I "Second Annual Eurographics Workshop on Rendering",
1885 to be published by Springer-Verlag, held in Barcelona, SPAIN, May 1991.
1886 .LP
1887 Ward, G.,
1888 ``Visualization,''
1889 .I "Lighting Design and Application",
1890 Vol. 20, No. 6, June 1990.
1891 .LP
1892 Ward, G., F. Rubinstein, R. Clear,
1893 ``A Ray Tracing Solution for Diffuse Interreflection,''
1894 .I "Computer Graphics",
1895 Vol. 22, No. 4, August 1988.
1896 .LP
1897 Ward, G., F. Rubinstein,
1898 ``A New Technique for Computer Simulation of Illuminated Spaces,''
1899 .I "Journal of the Illuminating Engineering Society",
1900 Vol. 17, No. 1, Winter 1988.