ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/ray.1
Revision: 1.48
Committed: Thu May 29 16:42:28 2025 UTC (3 days, 7 hours ago) by greg
Branch: MAIN
Changes since 1.47: +18 -1 lines
Log Message:
fix: Updated behavior of "mirror" type to handle indirect transmission, thanks to Jon Sargent

File Contents

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