| 1 | 
greg | 
1.3 | 
.\" RCSid "$Id$" | 
| 2 | 
greg | 
1.1 | 
.\"Print with tbl and eqn or neqn with -ms macro package | 
| 3 | 
  | 
  | 
.vs 12 | 
| 4 | 
  | 
  | 
.nr VS 12 | 
| 5 | 
  | 
  | 
.nr PD .5v      \" paragraph distance (inter-paragraph spacing) | 
| 6 | 
  | 
  | 
.EQ L | 
| 7 | 
  | 
  | 
delim $$ | 
| 8 | 
  | 
  | 
.EN | 
| 9 | 
  | 
  | 
.DA | 
| 10 | 
  | 
  | 
.TL | 
| 11 | 
  | 
  | 
Behavior of Materials in RADIANCE | 
| 12 | 
  | 
  | 
.AU | 
| 13 | 
  | 
  | 
Greg Ward | 
| 14 | 
  | 
  | 
.br | 
| 15 | 
  | 
  | 
Lawrence Berkeley Laboratory | 
| 16 | 
  | 
  | 
.NH 1 | 
| 17 | 
  | 
  | 
Definitions | 
| 18 | 
  | 
  | 
.LP | 
| 19 | 
  | 
  | 
This document describes in gory detail how each material type in RADIANCE | 
| 20 | 
  | 
  | 
behaves in terms of its parameter values. | 
| 21 | 
  | 
  | 
The following variables are given: | 
| 22 | 
  | 
  | 
.LP | 
| 23 | 
  | 
  | 
.vs 14 | 
| 24 | 
  | 
  | 
.nr VS 14 | 
| 25 | 
  | 
  | 
.TS | 
| 26 | 
  | 
  | 
center; | 
| 27 | 
  | 
  | 
l8 l. | 
| 28 | 
  | 
  | 
$bold R ( P vec , v hat )$      Value of a ray starting at $P vec$ in direction $v hat$ (in watts/sr/m^2) | 
| 29 | 
  | 
  | 
$P vec sub o$   Eye ray origin | 
| 30 | 
  | 
  | 
$v hat$ Eye ray direction | 
| 31 | 
  | 
  | 
$P vec sub s$   Intersection point of ray with surface | 
| 32 | 
  | 
  | 
$n hat$ Unperturbed surface normal at intersection | 
| 33 | 
  | 
  | 
$a sub n$       Real argument number $n$ | 
| 34 | 
  | 
  | 
$bold C$        Material color, $"{" a sub 1 , a sub 2 , a sub 3 "}"$ | 
| 35 | 
  | 
  | 
$bold p$        Material pattern value, $"{" 1, 1, 1 "}"$ if none | 
| 36 | 
  | 
  | 
$d vec$ Material texture vector, $[ 0, 0, 0 ]$ if none | 
| 37 | 
  | 
  | 
$b vec$ Orientation vector given by the string arguments of anisotropic types | 
| 38 | 
  | 
  | 
$n sub 1$       Index of refraction on eye ray side | 
| 39 | 
  | 
  | 
$n sub 2$       Index of refraction on opposite side | 
| 40 | 
  | 
  | 
$bold A$        Indirect irradiance (in watts/m^2) | 
| 41 | 
  | 
  | 
$bold A sub t$  Indirect irradiance from opposite side (in watts/m^2) | 
| 42 | 
  | 
  | 
$m hat$ Mirror direction, which can vary with Monte Carlo sampling | 
| 43 | 
  | 
  | 
$t sub s$       Specular threshold (set by -st option) | 
| 44 | 
  | 
  | 
$bold B sub i$  Radiance of light source sample $i$ (in watts/sr/m^2) | 
| 45 | 
  | 
  | 
$q hat sub i$   Direction to source sample $i$ | 
| 46 | 
  | 
  | 
$omega sub i$   Solid angle of source sample $i$ (in sr) | 
| 47 | 
  | 
  | 
.TE | 
| 48 | 
  | 
  | 
.vs 12 | 
| 49 | 
  | 
  | 
.nr VS 12 | 
| 50 | 
  | 
  | 
.LP | 
| 51 | 
  | 
  | 
Variables with an arrow over them are vectors. | 
| 52 | 
  | 
  | 
Variables with a circumflex are unit vectors (ie. normalized). | 
| 53 | 
  | 
  | 
All variables written in bold represent color values. | 
| 54 | 
  | 
  | 
.NH 2 | 
| 55 | 
  | 
  | 
Derived Variables | 
| 56 | 
  | 
  | 
.LP | 
| 57 | 
  | 
  | 
The following values are computed from the variables above: | 
| 58 | 
  | 
  | 
.LP | 
| 59 | 
  | 
  | 
.vs 14 | 
| 60 | 
  | 
  | 
.nr VS 14 | 
| 61 | 
  | 
  | 
.TS | 
| 62 | 
  | 
  | 
center; | 
| 63 | 
  | 
  | 
l8 l. | 
| 64 | 
  | 
  | 
$cos sub 1$     Cosine of angle between surface normal and eye ray | 
| 65 | 
  | 
  | 
$cos sub 2$     Cosine of angle between surface normal and transmitted direction | 
| 66 | 
  | 
  | 
$n hat sub p$   Perturbed surface normal (after texture application) | 
| 67 | 
  | 
  | 
$h vec sub i$   Bisecting vector between eye ray and source sample $i$ | 
| 68 | 
  | 
  | 
$F sub TE$      Fresnel coefficient for $TE$-polarized light | 
| 69 | 
  | 
  | 
$F sub TM$      Fresnel coefficient for $TM$-polarized light | 
| 70 | 
  | 
  | 
$F$     Fresnel coefficient for unpolarized light | 
| 71 | 
  | 
  | 
.TE | 
| 72 | 
  | 
  | 
.vs 12 | 
| 73 | 
  | 
  | 
.nr VS 12 | 
| 74 | 
  | 
  | 
.LP | 
| 75 | 
  | 
  | 
These values are computed as follows: | 
| 76 | 
  | 
  | 
.EQ I | 
| 77 | 
  | 
  | 
cos sub 1       mark ==~ - v hat cdot n hat sub p | 
| 78 | 
  | 
  | 
.EN | 
| 79 | 
  | 
  | 
.EQ I | 
| 80 | 
  | 
  | 
cos sub 2       lineup ==~ sqrt { 1~-~( n sub 1 / n sub 2 ) | 
| 81 | 
  | 
  | 
  sup 2 (1~-~cos sub 1 sup 2 )} | 
| 82 | 
  | 
  | 
.EN | 
| 83 | 
  | 
  | 
.EQ I | 
| 84 | 
  | 
  | 
n hat sub p     lineup ==~ { n hat ~+~ d vec } over { ||~ n hat ~+~ d vec ~|| } | 
| 85 | 
  | 
  | 
.EN | 
| 86 | 
  | 
  | 
.EQ I | 
| 87 | 
  | 
  | 
h vec sub i     lineup ==~ q hat sub i ~-~ v hat | 
| 88 | 
  | 
  | 
.EN | 
| 89 | 
  | 
  | 
.EQ I | 
| 90 | 
  | 
  | 
F sub TE        lineup ==~ left [ { n sub 1 cos sub 1 | 
| 91 | 
  | 
  | 
~-~ n sub 2 cos sub 2 } over { n sub 1 cos sub 1 | 
| 92 | 
  | 
  | 
~+~ n sub 2 cos sub 2 } right ] sup 2 | 
| 93 | 
  | 
  | 
.EN | 
| 94 | 
  | 
  | 
.EQ I | 
| 95 | 
  | 
  | 
F sub TM        lineup ==~ left [ {n sub 1 / cos sub 1 | 
| 96 | 
  | 
  | 
~-~ n sub 2 / cos sub 2} over {n sub 1 / cos sub 1 | 
| 97 | 
  | 
  | 
~+~ n sub 2 / cos sub 2} right ] sup 2 | 
| 98 | 
  | 
  | 
.EN | 
| 99 | 
  | 
  | 
.EQ I | 
| 100 | 
  | 
  | 
F       lineup ==~ 1 over 2 F sub TE ~+~ 1 over 2 F sub TM | 
| 101 | 
  | 
  | 
.EN | 
| 102 | 
  | 
  | 
.NH 2 | 
| 103 | 
  | 
  | 
Vector Math | 
| 104 | 
  | 
  | 
.LP | 
| 105 | 
  | 
  | 
Variables that represent vector values are written with an arrow above | 
| 106 | 
  | 
  | 
(eg. $ v vec $). | 
| 107 | 
  | 
  | 
Unit vectors (ie. vectors whose lengths are normalized to 1) have a hat | 
| 108 | 
  | 
  | 
(eg. $ v hat $). | 
| 109 | 
  | 
  | 
Equations containing vectors are implicitly repeated three times, | 
| 110 | 
  | 
  | 
once for each component. | 
| 111 | 
  | 
  | 
Thus, the equation: | 
| 112 | 
  | 
  | 
.EQ I | 
| 113 | 
  | 
  | 
v vec ~=~ 2 n hat ~+~ P vec | 
| 114 | 
  | 
  | 
.EN | 
| 115 | 
  | 
  | 
is equivalent to the three equations: | 
| 116 | 
  | 
  | 
.EQ I | 
| 117 | 
  | 
  | 
v sub x ~=~ 2 n sub x ~+~ P sub x | 
| 118 | 
  | 
  | 
.EN | 
| 119 | 
  | 
  | 
.EQ I | 
| 120 | 
  | 
  | 
v sub y ~=~ 2 n sub y ~+~ P sub y | 
| 121 | 
  | 
  | 
.EN | 
| 122 | 
  | 
  | 
.EQ I | 
| 123 | 
  | 
  | 
v sub z ~=~ 2 n sub z ~+~ P sub z | 
| 124 | 
  | 
  | 
.EN | 
| 125 | 
  | 
  | 
There are also cross and dot product operators defined for vectors, as | 
| 126 | 
  | 
  | 
well as the vector norm: | 
| 127 | 
  | 
  | 
.RS | 
| 128 | 
  | 
  | 
.LP | 
| 129 | 
  | 
  | 
.UL "Vector Dot Product" | 
| 130 | 
  | 
  | 
.EQ I | 
| 131 | 
  | 
  | 
a vec cdot b vec ~==~ a sub x b sub x ~+~ a sub y b sub y ~+~ a sub z b sub z | 
| 132 | 
  | 
  | 
.EN | 
| 133 | 
  | 
  | 
.LP | 
| 134 | 
  | 
  | 
.UL "Vector Cross Product" | 
| 135 | 
  | 
  | 
.EQ I | 
| 136 | 
  | 
  | 
a vec ~ times ~ b vec ~==~ left | matrix { | 
| 137 | 
  | 
  | 
  ccol { i hat above a sub x above b sub x } | 
| 138 | 
  | 
  | 
  ccol { j hat above a sub y above b sub y } | 
| 139 | 
  | 
  | 
  ccol { k hat above a sub z above b sub z } | 
| 140 | 
  | 
  | 
} right | | 
| 141 | 
  | 
  | 
.EN | 
| 142 | 
  | 
  | 
or, written out: | 
| 143 | 
  | 
  | 
.EQ I | 
| 144 | 
  | 
  | 
a vec ~ times ~ b vec ~=~ [ a sub y b sub z ~-~ a sub z b sub y ,~ | 
| 145 | 
  | 
  | 
a sub z b sub x ~-~ a sub x b sub z ,~ a sub x b sub y ~-~ a sub y b sub x ] | 
| 146 | 
  | 
  | 
.EN | 
| 147 | 
  | 
  | 
.LP | 
| 148 | 
  | 
  | 
.UL "Vector Norm" | 
| 149 | 
  | 
  | 
.EQ I | 
| 150 | 
  | 
  | 
|| v vec || ~==~ sqrt {{v sub x} sup 2 ~+~ {v sub y} sup 2 ~+~ {v sub z} sup 2} | 
| 151 | 
  | 
  | 
.EN | 
| 152 | 
  | 
  | 
.RE | 
| 153 | 
  | 
  | 
.LP | 
| 154 | 
  | 
  | 
Values are collected into a vector using square brackets: | 
| 155 | 
  | 
  | 
.EQ I | 
| 156 | 
  | 
  | 
v vec ~=~ [ v sub x , v sub y , v sub z ] | 
| 157 | 
  | 
  | 
.EN | 
| 158 | 
  | 
  | 
.NH 2 | 
| 159 | 
  | 
  | 
Color Math | 
| 160 | 
  | 
  | 
.LP | 
| 161 | 
  | 
  | 
Variables that represent color values are written in boldface type. | 
| 162 | 
  | 
  | 
Color values may have any number of spectral samples. | 
| 163 | 
  | 
  | 
Currently, RADIANCE uses only three such values, referred to generically | 
| 164 | 
  | 
  | 
as red, green and blue. | 
| 165 | 
  | 
  | 
Whenever a color variable appears in an equation, that equation is | 
| 166 | 
  | 
  | 
implicitly repeated once for each spectral sample. | 
| 167 | 
  | 
  | 
Thus, the equation: | 
| 168 | 
  | 
  | 
.EQ I | 
| 169 | 
  | 
  | 
bold C ~=~ bold A^bold B ~+~ d bold F | 
| 170 | 
  | 
  | 
.EN | 
| 171 | 
  | 
  | 
is shorthand for the set of equations: | 
| 172 | 
  | 
  | 
.EQ I | 
| 173 | 
  | 
  | 
C sub 1 ~=~ A sub 1 B sub 1 ~+~ d F sub 1 | 
| 174 | 
  | 
  | 
.EN | 
| 175 | 
  | 
  | 
.EQ I | 
| 176 | 
  | 
  | 
C sub 2 ~=~ A sub 2 B sub 2 ~+~ d F sub 2 | 
| 177 | 
  | 
  | 
.EN | 
| 178 | 
  | 
  | 
.EQ I | 
| 179 | 
  | 
  | 
C sub 3 ~=~ A sub 3 B sub 3 ~+~ d F sub 3 | 
| 180 | 
  | 
  | 
.EN | 
| 181 | 
  | 
  | 
        ... | 
| 182 | 
  | 
  | 
.LP | 
| 183 | 
  | 
  | 
And so on for however many spectral samples are used. | 
| 184 | 
  | 
  | 
Note that color math is not the same as vector math. | 
| 185 | 
  | 
  | 
For example, there is no such thing as | 
| 186 | 
  | 
  | 
a dot product for colors. | 
| 187 | 
  | 
  | 
.LP | 
| 188 | 
  | 
  | 
Curly braces are used to collect values into a single color, like so: | 
| 189 | 
  | 
  | 
.EQ I | 
| 190 | 
  | 
  | 
bold C ~=~ "{" r, g, b "}" | 
| 191 | 
  | 
  | 
.EN | 
| 192 | 
  | 
  | 
.sp 2 | 
| 193 | 
  | 
  | 
.NH | 
| 194 | 
  | 
  | 
Light Sources | 
| 195 | 
  | 
  | 
.LP | 
| 196 | 
  | 
  | 
Light sources are extremely simple in their behavior when viewed directly. | 
| 197 | 
  | 
  | 
Their color in a particular direction is given by the equation: | 
| 198 | 
  | 
  | 
.EQ L | 
| 199 | 
  | 
  | 
bold R ~=~ bold p^bold C | 
| 200 | 
  | 
  | 
.EN | 
| 201 | 
  | 
  | 
.LP | 
| 202 | 
  | 
  | 
The special light source material types, glow, spotlight, and illum, | 
| 203 | 
  | 
  | 
differ only in their affect on the direct calculation, ie. which rays | 
| 204 | 
  | 
  | 
are traced to determine shadows. | 
| 205 | 
  | 
  | 
These differences are explained in the RADIANCE reference manual, and | 
| 206 | 
  | 
  | 
will not be repeated here. | 
| 207 | 
  | 
  | 
.sp 2 | 
| 208 | 
  | 
  | 
.NH | 
| 209 | 
  | 
  | 
Specular Types | 
| 210 | 
  | 
  | 
.LP | 
| 211 | 
  | 
  | 
Specular material types do not involve special light source testing and | 
| 212 | 
  | 
  | 
are thus are simpler to describe than surfaces with a diffuse component. | 
| 213 | 
  | 
  | 
The output radiance is usually a function of one or two other ray  | 
| 214 | 
  | 
  | 
evaluations. | 
| 215 | 
  | 
  | 
.NH 2 | 
| 216 | 
  | 
  | 
Mirror | 
| 217 | 
  | 
  | 
.LP | 
| 218 | 
  | 
  | 
The value at a mirror surface is a function of the ray value in | 
| 219 | 
  | 
  | 
the mirror direction: | 
| 220 | 
  | 
  | 
.EQ L | 
| 221 | 
  | 
  | 
bold R ~=~ bold p^bold C^bold R ( P vec sub s ,~ m hat ) | 
| 222 | 
  | 
  | 
.EN | 
| 223 | 
  | 
  | 
.NH 2 | 
| 224 | 
  | 
  | 
Dieletric | 
| 225 | 
  | 
  | 
.LP | 
| 226 | 
  | 
  | 
The value of a dieletric material is computed from Fresnel's equations: | 
| 227 | 
  | 
  | 
.EQ L | 
| 228 | 
  | 
  | 
bold R ~=~ bold p^bold C sub t ( 1 - F )^bold R ( P vec sub s ,~ t hat ) ~+~ | 
| 229 | 
  | 
  | 
  bold C sub t^F^bold R ( P vec sub s ,~ m hat ) | 
| 230 | 
  | 
  | 
.EN | 
| 231 | 
  | 
  | 
where: | 
| 232 | 
  | 
  | 
.EQ I | 
| 233 | 
  | 
  | 
bold C sub t ~=~ bold C sup {|| P vec sub s ~-~ P vec sub o ||} | 
| 234 | 
  | 
  | 
.EN | 
| 235 | 
  | 
  | 
.EQ I | 
| 236 | 
  | 
  | 
t hat ~=~ n sub 1 over n sub 2 v hat ~+~ left ( n sub 1 over n sub 2 cos sub 1 | 
| 237 | 
  | 
  | 
  ~-~ cos sub 2 right ) n hat sub p | 
| 238 | 
  | 
  | 
.EN | 
| 239 | 
  | 
  | 
.LP | 
| 240 | 
  | 
  | 
The Hartmann constant is used only to calculate the index of refraction | 
| 241 | 
  | 
  | 
for a dielectric, and does not otherwise influence the above equations. | 
| 242 | 
  | 
  | 
In particular, transmitted directions are not sampled based on dispersion. | 
| 243 | 
  | 
  | 
Dispersion is only modeled in a very crude way when a light source is | 
| 244 | 
  | 
  | 
casting a beam towards the eye point. | 
| 245 | 
  | 
  | 
We will not endeavor to explain the algorithm here as it is rather | 
| 246 | 
  | 
  | 
nasty. | 
| 247 | 
  | 
  | 
.LP | 
| 248 | 
  | 
  | 
For the material type "interface", the color which is used for $bold C$ | 
| 249 | 
  | 
  | 
as well as the indices of refraction $n sub 1$ and $n sub 2$ is determined | 
| 250 | 
  | 
  | 
by which direction the ray is headed. | 
| 251 | 
  | 
  | 
.NH 2 | 
| 252 | 
  | 
  | 
Glass | 
| 253 | 
  | 
  | 
.LP | 
| 254 | 
  | 
  | 
Glass uses an infinite series solution to the interreflection inside a pane | 
| 255 | 
  | 
  | 
of thin glass. | 
| 256 | 
  | 
  | 
.EQ L | 
| 257 | 
  | 
  | 
bold R ~=~ bold p^bold C sub t^bold R ( P vec sub s ,~ t hat ) | 
| 258 | 
  | 
  | 
  left [ 1 over 2 {(1 ~-~ F sub TE )} sup 2 over {1 ~-~ F sub TE sup 2 | 
| 259 | 
  | 
  | 
     bold C sub t sup 2 } ~+~ 1 over 2 {(1 ~-~ F sub TM )} sup 2 | 
| 260 | 
  | 
  | 
     over {1 ~-~ F sub TM sup 2 bold C sub t sup 2 } right ] ~+~ | 
| 261 | 
  | 
  | 
  bold R ( P vec sub s ,~ m hat ) left [ 1 over 2 {F sub TE (1 ~+~ | 
| 262 | 
  | 
  | 
     (1 ~-~ 2 F sub TE ) bold C sub t sup 2 )} over {1 ~-~ F sub TE sup 2 | 
| 263 | 
  | 
  | 
     bold C sub t sup 2 } ~+~ 1 over 2 {F sub TM (1 ~+~ | 
| 264 | 
  | 
  | 
     (1 ~-~ 2 F sub TM ) bold C sub t sup 2 )} over {1 ~-~ F sub TM sup 2 | 
| 265 | 
  | 
  | 
     bold C sub t sup 2 } right ] | 
| 266 | 
  | 
  | 
.EN | 
| 267 | 
  | 
  | 
where: | 
| 268 | 
  | 
  | 
.EQ I | 
| 269 | 
  | 
  | 
bold C sub t ~=~ bold C sup {(1/ cos sub 2 )} | 
| 270 | 
  | 
  | 
.EN | 
| 271 | 
  | 
  | 
.EQ I | 
| 272 | 
  | 
  | 
t hat ~=~ v hat~+~2(1^-^n sub 2 ) d vec | 
| 273 | 
  | 
  | 
.EN | 
| 274 | 
  | 
  | 
.sp 2 | 
| 275 | 
  | 
  | 
.NH | 
| 276 | 
  | 
  | 
Basic Reflection Model | 
| 277 | 
  | 
  | 
.LP | 
| 278 | 
  | 
  | 
The basic reflection model used in RADIANCE takes into account both specular | 
| 279 | 
  | 
  | 
and diffuse interactions with both sides of a surface. | 
| 280 | 
  | 
  | 
Most RADIANCE material types are special cases of this more general formula: | 
| 281 | 
  | 
  | 
.EQ L (1) | 
| 282 | 
  | 
  | 
bold R ~=~ mark size +3 sum from sources bold B sub i omega sub i | 
| 283 | 
  | 
  | 
  left { Max(0,~ q hat sub i cdot n hat sub p ) | 
| 284 | 
  | 
  | 
    left ( bold rho sub d over pi ~+~ bold rho sub si right ) ~+~ | 
| 285 | 
  | 
  | 
    Max(0,~ - q hat sub i cdot n hat sub p ) | 
| 286 | 
  | 
  | 
    left ( bold tau sub d over pi ~+~ bold tau sub si right ) right } | 
| 287 | 
  | 
  | 
.EN | 
| 288 | 
  | 
  | 
.EQ L | 
| 289 | 
  | 
  | 
lineup ~~+~~ bold rho sub s bold R ( P vec sub s ,~ m hat ) ~~+~~ | 
| 290 | 
  | 
  | 
  bold tau sub s bold R ( P vec sub s ,~ t hat ) | 
| 291 | 
  | 
  | 
.EN | 
| 292 | 
  | 
  | 
.EQ L | 
| 293 | 
  | 
  | 
lineup ~~+~~ bold rho sub a over pi bold A ~~+~~ | 
| 294 | 
  | 
  | 
  bold tau sub a over pi bold A sub t | 
| 295 | 
  | 
  | 
.EN | 
| 296 | 
  | 
  | 
Note that only one of the transmitted or reflected components in the first | 
| 297 | 
  | 
  | 
term of the above equation can be non-zero, depending on whether the given | 
| 298 | 
  | 
  | 
light source is in front of or behind the surface. | 
| 299 | 
  | 
  | 
The values of the various $ bold rho $ and $ bold tau $ variables will be | 
| 300 | 
  | 
  | 
defined differently for each material type, and are given in the following | 
| 301 | 
  | 
  | 
sections for plastic, metal and trans. | 
| 302 | 
  | 
  | 
.NH 2 | 
| 303 | 
  | 
  | 
Plastic | 
| 304 | 
  | 
  | 
.LP | 
| 305 | 
  | 
  | 
A plastic surface has uncolored highlights and no transmitted component. | 
| 306 | 
  | 
  | 
If the surface roughness ($a sub 5$) is zero or the specularity | 
| 307 | 
  | 
  | 
($bold r sub s$) is greater than the threshold ($t sub s$) | 
| 308 | 
  | 
  | 
then a ray is traced in or near the mirror direction. | 
| 309 | 
  | 
  | 
An approximation to the Fresnel reflection coefficient | 
| 310 | 
  | 
  | 
($bold r sub s ~approx~ 1 - F$) is used to modify the specularity to account | 
| 311 | 
  | 
  | 
for the increase in specular reflection near grazing angles. | 
| 312 | 
  | 
  | 
.LP | 
| 313 | 
  | 
  | 
The reflection formula for plastic is obtained by adding the following | 
| 314 | 
  | 
  | 
definitions to the basic formula given in equation (1): | 
| 315 | 
  | 
  | 
.EQ I | 
| 316 | 
  | 
  | 
bold rho sub d ~=~ bold p^bold C (1 ~-~ a sub 4 ) | 
| 317 | 
  | 
  | 
.EN | 
| 318 | 
  | 
  | 
.EQ I | 
| 319 | 
  | 
  | 
bold rho sub si ~=~ left {~ lpile {{bold r sub s | 
| 320 | 
  | 
  | 
  {f sub s ( q hat sub i )} over | 
| 321 | 
greg | 
1.3 | 
  {( q hat sub i cdot n hat sub p ) cos sub 1}} above | 
| 322 | 
greg | 
1.1 | 
  0 } ~~~ lpile { {if~a sub 5 >0} above otherwise } | 
| 323 | 
  | 
  | 
.EN | 
| 324 | 
  | 
  | 
.EQ I | 
| 325 | 
  | 
  | 
bold rho sub s ~=~ left {~ lpile {{bold r sub s} above 0 } ~~~ | 
| 326 | 
  | 
  | 
  lpile {{if~a sub 5^=^0~or~bold r sub s^>^t sub s} above otherwise } | 
| 327 | 
  | 
  | 
.EN | 
| 328 | 
  | 
  | 
.EQ I | 
| 329 | 
  | 
  | 
bold rho sub a ~=~ left {~ lpile {{ bold p^bold C^(1~-~bold r sub s )} above | 
| 330 | 
  | 
  | 
  {bold p^bold C}} ~~~ lpile | 
| 331 | 
  | 
  | 
  {{if~a sub 5^=^0~or~bold r sub s^>^t sub s} above otherwise } | 
| 332 | 
  | 
  | 
.EN | 
| 333 | 
  | 
  | 
.EQ I | 
| 334 | 
  | 
  | 
bold tau sub a ,~ bold tau sub d ,~ bold tau sub si ,~ bold tau sub s ~=~ 0 | 
| 335 | 
  | 
  | 
.EN | 
| 336 | 
  | 
  | 
.EQ I | 
| 337 | 
  | 
  | 
bold r sub s ~=~ a sub 4 | 
| 338 | 
  | 
  | 
.EN | 
| 339 | 
  | 
  | 
.EQ I | 
| 340 | 
  | 
  | 
f sub s ( q hat sub i ) ~=~ e sup{[ ( h vec sub i cdot n hat sub p ) sup 2 | 
| 341 | 
  | 
  | 
  ~-~ || h vec || sup 2 ]/ | 
| 342 | 
  | 
  | 
  ( h vec sub i cdot n hat sub p ) sup 2 / alpha sub i} | 
| 343 | 
  | 
  | 
  over {4 pi alpha sub i} | 
| 344 | 
  | 
  | 
.EN | 
| 345 | 
  | 
  | 
.EQ I | 
| 346 | 
  | 
  | 
alpha sub i ~=~ a sub 5 sup 2 ~+~ omega sub i over {4 pi} | 
| 347 | 
  | 
  | 
.EN | 
| 348 | 
  | 
  | 
.LP | 
| 349 | 
  | 
  | 
There is one additional caveat to the above formulas. | 
| 350 | 
  | 
  | 
If the roughness is greater than zero and the reflected ray, | 
| 351 | 
  | 
  | 
$bold R ( P vec sub s ,~ r hat )$, | 
| 352 | 
  | 
  | 
intersects a light source, then it is not used in the calculation. | 
| 353 | 
  | 
  | 
Using such a ray would constitute double-counting, since the direct | 
| 354 | 
  | 
  | 
component has already been included in the source sample summation. | 
| 355 | 
  | 
  | 
.NH 2 | 
| 356 | 
  | 
  | 
Metal | 
| 357 | 
  | 
  | 
.LP | 
| 358 | 
  | 
  | 
Metal is identical to plastic, except for the definition of $ bold r sub s $, | 
| 359 | 
  | 
  | 
which now includes the color of the material: | 
| 360 | 
  | 
  | 
.EQ I | 
| 361 | 
  | 
  | 
bold r sub s ~=~ | 
| 362 | 
  | 
  | 
  "{" a sub 1 a sub 4 ,~ | 
| 363 | 
  | 
  | 
  a sub 2 a sub 4 ,~ | 
| 364 | 
  | 
  | 
  a sub 3 a sub 4 "}" | 
| 365 | 
  | 
  | 
.EN | 
| 366 | 
  | 
  | 
.NH 2 | 
| 367 | 
  | 
  | 
Trans | 
| 368 | 
  | 
  | 
.LP | 
| 369 | 
  | 
  | 
The trans type adds transmitted and colored specular and diffuse components | 
| 370 | 
  | 
  | 
to the colored diffuse and uncolored specular components of the plastic type. | 
| 371 | 
  | 
  | 
Again, the roughness value and specular threshold determine | 
| 372 | 
  | 
  | 
whether or not specular rays will be followed for this material. | 
| 373 | 
  | 
  | 
.EQ I | 
| 374 | 
  | 
  | 
bold rho sub d ~=~ bold p^bold C^(1 ~-~ a sub 4 ) ( 1 ~-~ a sub 6 ) | 
| 375 | 
  | 
  | 
.EN | 
| 376 | 
  | 
  | 
.EQ I | 
| 377 | 
  | 
  | 
bold rho sub si ~=~ left {~ lpile {{bold r sub s | 
| 378 | 
  | 
  | 
  {f sub s ( q hat sub i )} over | 
| 379 | 
greg | 
1.3 | 
  {( q hat sub i cdot n hat sub p ) cos sub 1}} above | 
| 380 | 
greg | 
1.1 | 
  0 } ~~~ lpile { {if~a sub 5 >0} above otherwise } | 
| 381 | 
  | 
  | 
.EN | 
| 382 | 
  | 
  | 
.EQ I | 
| 383 | 
  | 
  | 
bold rho sub s ~=~ left {~ lpile {{bold r sub s} above 0 } ~~~ | 
| 384 | 
  | 
  | 
  lpile {{if~a sub 5^=^0~or~bold r sub s^>^t sub s} above otherwise } | 
| 385 | 
  | 
  | 
.EN | 
| 386 | 
  | 
  | 
.EQ I | 
| 387 | 
  | 
  | 
bold rho sub a ~=~ left {~ lpile {{ bold p^bold C^ | 
| 388 | 
  | 
  | 
  (1~-~bold r sub s ) (1~-~a sub 6 )} above | 
| 389 | 
  | 
  | 
  {bold p^bold C^(1~-~a sub 6 )}} ~~~ lpile | 
| 390 | 
  | 
  | 
  {{if~a sub 5^=^0~or~bold r sub s^>^t sub s} above otherwise } | 
| 391 | 
  | 
  | 
.EN | 
| 392 | 
  | 
  | 
.EQ I | 
| 393 | 
  | 
  | 
bold tau sub d ~=~ a sub 6 (1~-~bold r sub s ) (1~-~a sub 7 )^bold p^bold C | 
| 394 | 
  | 
  | 
.EN | 
| 395 | 
  | 
  | 
.EQ I | 
| 396 | 
  | 
  | 
bold tau sub si ~=~ left {~ lpile {{a sub 6 a sub 7 (1~-~bold r sub s )^ | 
| 397 | 
  | 
  | 
  bold p^bold C {g sub s ( q hat sub i )} over | 
| 398 | 
greg | 
1.3 | 
  {(- q hat sub i cdot n hat sub p ) cos sub 1}} above | 
| 399 | 
greg | 
1.1 | 
  0 } ~~~ lpile { {if~a sub 5^>^0} above otherwise } | 
| 400 | 
  | 
  | 
.EN | 
| 401 | 
  | 
  | 
.EQ I | 
| 402 | 
  | 
  | 
bold tau sub s ~=~ left {~ lpile {{a sub 6 a sub 7 (1~-~bold r sub s )^ | 
| 403 | 
  | 
  | 
  bold p^bold C} above 0} ~~~ lpile | 
| 404 | 
  | 
  | 
  {{if~a sub 5^=^0~or~a sub 6 a sub 7 (1~-~bold r sub s )^>^t sub s} | 
| 405 | 
  | 
  | 
  above otherwise} | 
| 406 | 
  | 
  | 
.EN | 
| 407 | 
  | 
  | 
.EQ I | 
| 408 | 
  | 
  | 
bold tau sub a ~=~ left {~ lpile {{a sub 6 (1~-~bold r sub s ) (1~-~a sub 7 ) | 
| 409 | 
  | 
  | 
  ^bold p^bold C} above {a sub 6 (1~-~bold r sub s )^bold p^bold C}} ~~~ | 
| 410 | 
  | 
  | 
  lpile {{if~a sub 5^=^0~or~a sub 6 a sub 7 (1~-~bold r sub s )^>^t sub s} | 
| 411 | 
  | 
  | 
  above otherwise} | 
| 412 | 
  | 
  | 
.EN | 
| 413 | 
  | 
  | 
.EQ I | 
| 414 | 
  | 
  | 
bold r sub s ~=~ a sub 4 | 
| 415 | 
  | 
  | 
.EN | 
| 416 | 
  | 
  | 
.EQ I | 
| 417 | 
  | 
  | 
f sub s ( q hat sub i ) ~=~ e sup{[ ( h vec sub i cdot n hat sub p ) sup 2 | 
| 418 | 
  | 
  | 
  ~-~ || h vec || sup 2 ]/ | 
| 419 | 
  | 
  | 
  ( h vec sub i cdot n hat sub p ) sup 2 / alpha sub i} | 
| 420 | 
  | 
  | 
  over {4 pi alpha sub i} | 
| 421 | 
  | 
  | 
.EN | 
| 422 | 
  | 
  | 
.EQ I | 
| 423 | 
  | 
  | 
alpha sub i ~=~ a sub 5 sup 2 ~+~ omega sub i over {4 pi} | 
| 424 | 
  | 
  | 
.EN | 
| 425 | 
  | 
  | 
.EQ I | 
| 426 | 
  | 
  | 
g sub s ( q hat sub i ) ~=~ e sup{( 2 q hat sub i cdot t hat~-~2)/ beta sub i} | 
| 427 | 
  | 
  | 
  over {pi beta sub i} | 
| 428 | 
  | 
  | 
.EN | 
| 429 | 
  | 
  | 
.EQ I | 
| 430 | 
  | 
  | 
t hat ~=~ {v hat~-~d vec}over{|| v hat~-~d vec ||} | 
| 431 | 
  | 
  | 
.EN | 
| 432 | 
  | 
  | 
.EQ I | 
| 433 | 
  | 
  | 
beta sub i ~=~ a sub 5 sup 2 ~+~ omega sub i over pi | 
| 434 | 
  | 
  | 
.EN | 
| 435 | 
  | 
  | 
.LP | 
| 436 | 
  | 
  | 
The same caveat applies to specular rays generated for trans type as did | 
| 437 | 
  | 
  | 
for plastic and metal. | 
| 438 | 
  | 
  | 
Namely, if the roughness is greater than zero and the reflected ray, | 
| 439 | 
  | 
  | 
$bold R ( P vec sub s ,~ r hat )$, | 
| 440 | 
  | 
  | 
or the transmitted ray, | 
| 441 | 
  | 
  | 
$bold R ( P vec sub s ,~ t hat )$, | 
| 442 | 
  | 
  | 
intersects a light source, then it is not used in the calculation. | 
| 443 | 
  | 
  | 
.NH 2 | 
| 444 | 
  | 
  | 
Anisotropic Types | 
| 445 | 
  | 
  | 
.LP | 
| 446 | 
  | 
  | 
The anisotropic reflectance types (plastic2, metal2, trans2) use the | 
| 447 | 
  | 
  | 
same formulas as their counterparts with the exception of the | 
| 448 | 
  | 
  | 
exponent terms, $f sub s ( q hat sub i )$ and | 
| 449 | 
  | 
  | 
$g sub s ( q hat sub i )$. | 
| 450 | 
  | 
  | 
These terms now use an additional vector, $b vec$, to | 
| 451 | 
  | 
  | 
orient an elliptical highlight. | 
| 452 | 
  | 
  | 
(Note also that the argument numbers for the type trans2 have been | 
| 453 | 
  | 
  | 
changed so that $a sub 6$ is $a sub 7$ and $a sub 7$ is $a sub 8$.)\0 | 
| 454 | 
  | 
  | 
.EQ I | 
| 455 | 
  | 
  | 
f sub s ( q hat sub i ) ~=~ | 
| 456 | 
  | 
  | 
  1 over {4 pi sqrt {alpha sub ix alpha sub iy} } | 
| 457 | 
  | 
  | 
  exp left [ -^{{( h vec sub i cdot x hat )} sup 2 over{alpha sub ix} | 
| 458 | 
  | 
  | 
  ~+~ {( h vec sub i cdot y hat )} sup 2 over{alpha sub iy}} over | 
| 459 | 
  | 
  | 
  {( h vec sub i cdot n hat sub p ) sup 2}right ] | 
| 460 | 
  | 
  | 
.EN | 
| 461 | 
  | 
  | 
.EQ I | 
| 462 | 
  | 
  | 
x hat ~=~ y hat~times~n hat sub p | 
| 463 | 
  | 
  | 
.EN | 
| 464 | 
  | 
  | 
.EQ I | 
| 465 | 
  | 
  | 
y hat ~=~ {n hat sub p~times~b vec}over{|| n hat sub p~times~b vec ||} | 
| 466 | 
  | 
  | 
.EN | 
| 467 | 
  | 
  | 
.EQ I | 
| 468 | 
  | 
  | 
alpha sub ix ~=~ a sub 5 sup 2 ~+~ omega sub i over {4 pi} | 
| 469 | 
  | 
  | 
.EN | 
| 470 | 
  | 
  | 
.EQ I | 
| 471 | 
  | 
  | 
alpha sub iy ~=~ a sub 6 sup 2 ~+~ omega sub i over {4 pi} | 
| 472 | 
  | 
  | 
.EN | 
| 473 | 
  | 
  | 
.EQ I | 
| 474 | 
  | 
  | 
g sub s ( q hat sub i ) ~=~ | 
| 475 | 
  | 
  | 
  1 over {pi sqrt {beta sub ix beta sub iy} } | 
| 476 | 
  | 
  | 
  exp left [ {{( c vec sub i cdot x hat )} sup 2 over{beta sub ix} | 
| 477 | 
  | 
  | 
  ~+~ {( c vec sub i cdot y hat )} sup 2 over{beta sub iy}} over | 
| 478 | 
  | 
  | 
  {{( n hat sub p cdot c vec sub i )}sup 2 over | 
| 479 | 
  | 
  | 
  {|| c vec sub i ||}sup 2 ~-~ 1} | 
| 480 | 
  | 
  | 
  right ] | 
| 481 | 
  | 
  | 
.EN | 
| 482 | 
  | 
  | 
.EQ I | 
| 483 | 
  | 
  | 
c vec sub i ~=~ q hat sub i~-~t hat | 
| 484 | 
  | 
  | 
.EN | 
| 485 | 
  | 
  | 
.EQ I | 
| 486 | 
  | 
  | 
t hat ~=~ {v hat~-~d vec}over{|| v hat~-~d vec ||} | 
| 487 | 
  | 
  | 
.EN | 
| 488 | 
  | 
  | 
.EQ I | 
| 489 | 
  | 
  | 
beta sub ix ~=~ a sub 5 sup 2 ~+~ omega sub i over pi | 
| 490 | 
  | 
  | 
.EN | 
| 491 | 
  | 
  | 
.EQ I | 
| 492 | 
  | 
  | 
beta sub iy ~=~ a sub 6 sup 2 ~+~ omega sub i over pi | 
| 493 | 
  | 
  | 
.EN | 
| 494 | 
  | 
  | 
.NH 2 | 
| 495 | 
  | 
  | 
BRDF Types | 
| 496 | 
  | 
  | 
.LP | 
| 497 | 
  | 
  | 
The more general brdf types (plasfunc, plasdata, metfunc, metdata, | 
| 498 | 
  | 
  | 
BRTDfunc) use the same basic formula given in equation (1), | 
| 499 | 
  | 
  | 
but allow the user to specify $bold rho sub si$ and $bold tau sub si$ as | 
| 500 | 
  | 
  | 
either functions or data, instead of using the default | 
| 501 | 
  | 
  | 
Gaussian formulas. | 
| 502 | 
  | 
  | 
Note that only the exponent terms, $f sub s ( q hat sub i )$ and | 
| 503 | 
  | 
  | 
$g sub s ( q hat sub i )$ with the radicals in their denominators | 
| 504 | 
  | 
  | 
are replaced, and not the coefficients preceding them. | 
| 505 | 
  | 
  | 
It is very important that the user give properly normalized functions (ie. | 
| 506 | 
  | 
  | 
functions that integrate to 1 over the hemisphere) to maintain correct | 
| 507 | 
  | 
  | 
energy balance. |