Behavior of Materials in RADIANCE Greg Ward Lawrence Berkeley Laboratory 1. Definitions This document describes in gory detail how each material type in RADIANCE behaves in terms of its parameter values. The following variables are given: R("P","v") Value of a ray starting at "P" in direction "v" (in watts/sr/m^2) "P"o Eye ray origin "v" Eye ray direction "P"s Intersection point of ray with surface "n" Unperturbed surface normal at intersection an Real argument number n C Material color, {a1, a2, a3) p Material pattern value, {1,1,1} if none "d" Material texture vector, [0,0,0] if none "b" orientation vector given by the string arguments of anisotropic types n1 Index of refraction on eye ray side n2 Index of refraction on opposite side A Indirect irradiance (in watts/m^2) At Indirect irradiance from opposite side (in watts/m^2) "m" Mirror direction, which can vary with Monte Carlo sampling ts Specular threshold (set by -st option) Bi Radiance of light source sample i (in watts/sr/m^2) "q"i Direction to source sample i wi Solid angle of source sample i (in sr) Variables with an arrow over them are vectors. Variables with a circumflex are unit vectors (ie. normalized). All variables written in bold represent color values. 1.1. Derived Variables The following values are computed from the variables above: cos1 Cosine of angle between surface normal and eye ray cos2 Cosine of angle between surface normal and transmitted direction "n"p Perturbed surface normal (after texture application) "h"i Bisecting vector between eye ray and source sample i FTE Fresnel coefficient for TE -polarized light FTM Fresnel coefficient for TM -polarized light F Fresnel coefficient for unpolarized light These values are computed as follows: cos1 = -"v"."n"p cos2 = 1 - (n1/n2)2(1 - cos12) "n"p = "n" + "d" ||"n" + "d"|| "h"i = "q"i - "v" FTE = [n1cos1 - n2cos2]2 [n1cos1 + n2cos2] FTM = [n1/cos1 - n2/cos2]2 [n1/cos1 = n2/cos2] F = 1/2FTE + 1/2FTM 1.2. Vector Math Variables that represent vector values are written with an arrow above (eg. "v"). Unit vectors (ie. vectors whose lengths are normalized to 1) have a hat (eg. "v"). Equations containing vectors are implicitly repeated three times, once for each component. Thus, the equation: "v" = 2"n" + "P" is equivalent to the three equations: vx = 2nx + Px vy = 2ny + Py vz = 2nz + Pz There are also cross and dot product operators defined for vectors, as well as the vector norm: Vector Dot Product "a"."b" = axbx + ayby + azbz Vector Cross Product "a" x "b" = | "i" "j" "k" | | ax ay az | | bx by bz | or, written out: "a" x "b" = [aybz - azby, azbx - axbz, axby - aybx] Vector Norm ||"v"|| = vx2 + vy2 + vz2 Values are collected into a vector using square brackets: "v" = [vx,vy,vz] 1.3. Color Math Variables that represent color values are written in boldface type. Color values may have any number of spectral samples. Currently, RADIANCE uses only three such values, referred to generically as red, green and blue. Whenever a color variable appears in an equation, that equation is implicitly repeated once for each spectral sample. Thus, the equation: C = AB + dF is shorthand for the set of equations: C1 = A1B1 + dF1 C2 = A2B2 + dF2 C3 = A3B3 + dF3 ... And so on for however many spectral samples are used. Note that color math is not the same as vector math. For example, there is no such thing as a dot product for colors. Curly braces are used to collect values into a single color, like so: C = {r,g,b} 2. Light Sources Light sources are extremely simple in their behavior when viewed directly. Their color in a particular direction is given by the equation: R = p C The special light source material types, glow, spotlight, and illum, differ only in their affect on the direct calculation, ie. which rays are traced to determine shadows. These differences are explained in the RADIANCE reference manual, and will not be repeated here. 3. Specular Types Specular material types do not involve special light source testing and are thus are simpler to describe than surfaces with a diffuse component. The output radiance is usually a function of one or two other ray evaluations. 3.1. Mirror The value at a mirror surface is a function of the ray value in the mirror direction: R = p C R("P"s, "m") 3.2. Dieletric The value of a dieletric material is computed from Fresnel's equations: R = p Ct(1-F)R("P"s,"t") + Ct F R("P"s, "m") where: Ct = C"P"s - "P"o" "t" = n1"v" + {n1cos1 - cos2}"n"p n2 {n2 } The Hartmann constant is used only to calculate the index of refraction for a dielectric, and does not otherwise influence the above equations. In particular, transmitted directions are not sampled based on dispersion. Dispersion is only modeled in a very crude way when a light source is casting a beam towards the eye point. We will not endeavor to explain the algorithm here as it is rather nasty. For the material type "interface", the color which is used for C as well as the indices of refraction n1 and n2 is determined by which direction the ray is headed. 3.3. Glass Glass uses an infinite series solution to the interreflection inside a pane of thin glass. R = pCt R("P"s, "t")[1 (1 - FTE)2 + 1 (1 - FTM)2] + [2 1 - FTE2Ct2+ 2 1 - F2TMCt2] R("P"s,"m")[1 FTE(1 + (1 - 2FTE)Ct2) + [2 1 - fTE2 CT2 1 FTM(1 + (1 - 2FTM)Ct2)] 2 1 - FTM2Ct2 ] where: Ct = C(1/cos2) "t" = "v" + 2(1 - n2)"d" 4. Basic Reflection Model The basic reflection model used in RADIANCE takes into account both specular and diffuse interactions with both sides of a surface. Most RADIANCE material types are special cases of this more general formula: R = E B1w1 {Max (0,"q"i."n"p)[Pd + Psi] + Max(0, -"q"i."n"p) sources "T" [Td + Tsi]} "T" ]} (1) + PsR("P"s, "m") + TsR("P"s, "t") + Pa A + Ta At "T" "T" Note that only one of the transmitted or reflected components in the first term of the above equation can be non-zero, depending on whether the given light source is in front of or behind the surface. The values of the various P and T variables will be defined differently for each material type, and are given in the following sections for plastic, metal and trans. 4.1. Plastic A plastic surface has uncolored highlights and no transmitted component. If the surface roughness (a5) is zero or the specularity (rs) is greater than the threshold (ts) then a ray is traced in or near the mirror direction. An approximation to the Fresnel reflection coefficient (rs = 1-F) is used to modify the specularity to account for the increase in specular reflection near grazing angles. The reflection formula for plastic is obtained by adding the following definitions to the basic formula given in equation (1): Pd = p C(1 - rs) {rs fs("q"i) ("q"i."n"p)cos1 if a5>0 Psi = {0 otherwise Ps = {rs if a5=0 or rs>ts 0 otherwise Pa = p C(1 - rs) if a5=0 or rs>ts p C otherwise Ta, Td, Tsi, Ts = 0 rs = a4 + (1 - a4)e -6cos1 fs("q"i) = e[("h"i."n"p)2 - ||"h"||2]/ai 4"T"ai ai = a52 + wi 4"T" There is one additional caveat to the above formulas. If the roughness is greater than zero and the reflected ray, R("P"s,"t"), intersects a light source, then it is not used in the calculation. Using such a ray would constitute double-counting, since the direct component has already been included in the source sample summation. 4.2. Metal Metal is identical to plastic, except for the definition of rs, which now includes the color of the material: rs = {a1a4 + (1-a1a4)e -6cos1, a2a4 + (1-a2a4)e -6cos1, a3a4 + (1-a3a4)e-6cos1} 4.3. Trans The trans type adds transmitted and colored specular and diffuse components to the colored diffuse and uncolored specular components of the plastic type. Again, the roughness value and specular threshold determine whether or not specular rays will be followed for this material. Pd = p C(1 - rs)(1 - a6) {rs fs("q"i) ("q"i."n"p)cos1 if a5>0 Psi = {0 otherwise Ps = {rs if a5 = 0 or rs>ts 0 otherwise Pa = {p C (1 - rs)(1 - a6) if a5=0 or rs>ts {p C (1 - a6) otherwise Td = a6(1 - rs)(1 - a7)p C {a6a7(1 - rs)p C gs("q"i) -"q"i."n"p)cos1 if a5>0 Tsi = {0 otherwise Ts = {a6a7(1 - rs)p C if a5=0 or a6a7(1 - rs)>ts {0 otherwise Ta = {a6a7(1 - rs)(1 - a7)p C if a5=0 or a6a67(1 - rs)>ts {a6(1 - rs)p C otherwise rs = a4 + (1 - a4)e -6cos1 fs("q"i) = e[("h"i."n"p)s - ||"h"||2]/ai 4"T"ai ai = a2 + Wi 5 4"T" gs("q"i) = e(2"q"i."t" - 2)/Bi "T"Bi "t" = "v" - "d" ||"v" - "d"|| Bi = a2 + Wi 5 "T" 4.4 Anisotropic Types The anisotropic reflectance types (plastic2, metal2, trans2) use the same formulas as their counterparts with the exception of the exponent terms, fs ("q"i) and gs ("q"i). These terms now use an additional vector, "b", to orient an elliptical highlight. (Note also that the argument numbers for the type trans2 have been changed so that a6 is a7 and a7 is a8.) fs("q"i) = 1 exp [ ("h"i."x")2 + ("h"i."y")2 4"T" aixaiy aix aiy ("h"."n"p)2 "x" = "y" x "n"p "y" = "n"p x "b" ||"n"p x "b"|| aix = a2 + wi 5 4"T" Aiy = a2 + wi 6 4"T" gs("q"i) = 1 exp [("c"i."x")2 + ("c"i."y")2 Bix Biy ("n"."c"i)2 - 1 ||"c"i||2] "c"i = "q"i - "t" "t" = "v" - "d" ||"v" - "d"|| Bix = a2 + wi 5 "T" Biy = a2 + wi 6 "T" 4.5. BRDF Types The more general brdf types (plasfunc, plasdata, metfunc, metdata, BRTDfunc) use the same basic formula given in equation (1), but allow the user to specify Psi and Tsi as either functions or data, instead of using the default Gaussian formulas. Note that only the exponent terms, fs("q"i) and gs("q"i) with the radicals in their denominators are replaced, and not the coefficients preceding them. It is very important that the user give properly normalized functions (ie. functions that integrate to 1 over the hemisphere) to maintain correct energy balance. Materials and their reasonable values: Material: parameter 1 (open:closed] interpretation parameter 2 [closed:approximate> interpretation Light: color (0:inf),(0:inf),(0:inf) output brightness Glow: color (0:inf),(0:inf),(0:inf) output brightness maximum radius [0:inf) no shadows - always shadows Spotlight: color (0:inf),(0:inf),(0:inf) output brightness maximum angle [0:360] no shadows - always shadows direction any aimed orientation Mirror: color [0:1],[0:1],[0:1] black - silver Plastic: color [0:1],(0:1],[0:1] black - white specularity [0:.07> matte - satin roughness [0:.2> polished - low gloss Metal: color [0:1],[0:1],[0:1] 0-100% reflectance specularity <.5:1] dirty - clean roughness [0:.5> polished - roughened Trans: color [0:1],[0:1],[0:1] black - white specularity [0:.07> matte - satin roughness [0:.2> polished - low gloss transmission [0:1] opaque - transparent transmitted specularity [0:1] diffuse - clear Dielectric: transmission [0:1],[0:1],[0:1] black - transparent refractive index (1:2> vacuum - diamond Hartmann's constant <-20:30> negative dispersion - positive dispersion Interface: interior transmission [0:1],[0:1],[0:1] black - transparent interior refractive index (1:2> vacuum - diamond exterior transmission [0:1],[0:1],[0:1] black - transparent exterior refractive index (1:2> vacuum - diamond Glass: transmission [0:1],[0:1],[0:1] black - transparent