home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / radiance / spec / material.ms < prev    next >
Text File  |  1994-04-15  |  16KB  |  498 lines

  1. .\" SCCSid "@(#)materials.1 2.5 3/22/93 LBL"
  2. .\"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 1mark ==~ - v hat cdot n hat sub p
  78. .EN
  79. .EQ I
  80. cos sub 2lineup ==~ 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 plineup ==~ { n hat ~+~ d vec } over { ||~ n hat ~+~ d vec ~|| }
  85. .EN
  86. .EQ I
  87. h vec sub ilineup ==~ q hat sub i ~-~ v hat
  88. .EN
  89. .EQ I
  90. F sub TElineup ==~ 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 TMlineup ==~ 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. Flineup ==~ 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 ~-~ bold r sub s )
  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.   sqrt{( q hat sub i cdot n hat sub p ) cos sub 1}} above
  322.   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 ~+~ (1~-~a sub 4 ) e sup{-6cos sub 1}
  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.   alpha sub i} over {4 pi alpha sub i}
  343. .EN
  344. .EQ I
  345. alpha sub i ~=~ a sub 5 sup 2 ~+~ omega sub i over {4 pi}
  346. .EN
  347. .LP
  348. There is one additional caveat to the above formulas.
  349. If the roughness is greater than zero and the reflected ray,
  350. $bold R ( P vec sub s ,~ t hat )$,
  351. intersects a light source, then it is not used in the calculation.
  352. Using such a ray would constitute double-counting, since the direct
  353. component has already been included in the source sample summation.
  354. .NH 2
  355. Metal
  356. .LP
  357. Metal is identical to plastic, except for the definition of $ bold r sub s $,
  358. which now includes the color of the material:
  359. .EQ I
  360. bold r sub s ~=~
  361.   "{" a sub 1 a sub 4 ~+~ (1 - a sub 1 a sub 4 ) e sup {-6cos sub 1},~
  362.   a sub 2 a sub 4 ~+~ (1 - a sub 2 a sub 4 ) e sup {-6cos sub 1},~
  363.   a sub 3 a sub 4 ~+~ (1 - a sub 3 a sub 4 ) e sup {-6cos sub 1} "}"
  364. .EN
  365. .NH 2
  366. Trans
  367. .LP
  368. The trans type adds transmitted and colored specular and diffuse components
  369. to the colored diffuse and uncolored specular components of the plastic type.
  370. Again, the roughness value and specular threshold determine
  371. whether or not specular rays will be followed for this material.
  372. .EQ I
  373. bold rho sub d ~=~ bold p^bold C^(1 ~-~ bold r sub s ) ( 1 ~-~ a sub 6 )
  374. .EN
  375. .EQ I
  376. bold rho sub si ~=~ left {~ lpile {{bold r sub s
  377.   {f sub s ( q hat sub i )} over
  378.   sqrt{( q hat sub i cdot n hat sub p ) cos sub 1}} above
  379.   0 } ~~~ lpile { {if~a sub 5 >0} above otherwise }
  380. .EN
  381. .EQ I
  382. bold rho sub s ~=~ left {~ lpile {{bold r sub s} above 0 } ~~~
  383.   lpile {{if~a sub 5^=^0~or~bold r sub s^>^t sub s} above otherwise }
  384. .EN
  385. .EQ I
  386. bold rho sub a ~=~ left {~ lpile {{ bold p^bold C^
  387.   (1~-~bold r sub s ) (1~-~a sub 6 )} above
  388.   {bold p^bold C^(1~-~a sub 6 )}} ~~~ lpile
  389.   {{if~a sub 5^=^0~or~bold r sub s^>^t sub s} above otherwise }
  390. .EN
  391. .EQ I
  392. bold tau sub d ~=~ a sub 6 (1~-~bold r sub s ) (1~-~a sub 7 )^bold p^bold C
  393. .EN
  394. .EQ I
  395. bold tau sub si ~=~ left {~ lpile {{a sub 6 a sub 7 (1~-~bold r sub s )^
  396.   bold p^bold C {g sub s ( q hat sub i )} over
  397.   sqrt{(- q hat sub i cdot n hat sub p ) cos sub 1}} above
  398.   0 } ~~~ lpile { {if~a sub 5^>^0} above otherwise }
  399. .EN
  400. .EQ I
  401. bold tau sub s ~=~ left {~ lpile {{a sub 6 a sub 7 (1~-~bold r sub s )^
  402.   bold p^bold C} above 0} ~~~ lpile
  403.   {{if~a sub 5^=^0~or~a sub 6 a sub 7 (1~-~bold r sub s )^>^t sub s}
  404.   above otherwise}
  405. .EN
  406. .EQ I
  407. bold tau sub a ~=~ left {~ lpile {{a sub 6 (1~-~bold r sub s ) (1~-~a sub 7 )
  408.   ^bold p^bold C} above {a sub 6 (1~-~bold r sub s )^bold p^bold C}} ~~~
  409.   lpile {{if~a sub 5^=^0~or~a sub 6 a sub 7 (1~-~bold r sub s )^>^t sub s}
  410.   above otherwise}
  411. .EN
  412. .EQ I
  413. bold r sub s ~=~ a sub 4 ~+~ (1~-~a sub 4 ) e sup{-6cos sub 1}
  414. .EN
  415. .EQ I
  416. f sub s ( q hat sub i ) ~=~ e sup{[ ( h vec sub i cdot n hat sub p ) sup 2
  417.   ~-~ || h vec || sup 2 ]/
  418.   alpha sub i} over {4 pi alpha sub i}
  419. .EN
  420. .EQ I
  421. alpha sub i ~=~ a sub 5 sup 2 ~+~ omega sub i over {4 pi}
  422. .EN
  423. .EQ I
  424. g sub s ( q hat sub i ) ~=~ e sup{( 2 q hat sub i cdot t hat~-~2)/ beta sub i}
  425.   over {pi beta sub i}
  426. .EN
  427. .EQ I
  428. t hat ~=~ {v hat~-~d vec}over{|| v hat~-~d vec ||}
  429. .EN
  430. .EQ I
  431. beta sub i ~=~ a sub 5 sup 2 ~+~ omega sub i over pi
  432. .EN
  433. .NH 2
  434. Anisotropic Types
  435. .LP
  436. The anisotropic reflectance types (plastic2, metal2, trans2) use the
  437. same formulas as their counterparts with the exception of the
  438. exponent terms, $f sub s ( q hat sub i )$ and
  439. $g sub s ( q hat sub i )$.
  440. These terms now use an additional vector, $b vec$, to
  441. orient an elliptical highlight.
  442. (Note also that the argument numbers for the type trans2 have been
  443. changed so that $a sub 6$ is $a sub 7$ and $a sub 7$ is $a sub 8$.)\0
  444. .EQ I
  445. f sub s ( q hat sub i ) ~=~
  446.   1 over {4 pi sqrt {alpha sub ix alpha sub iy} }
  447.   exp left [ -^{{( h vec sub i cdot x hat )} sup 2 over{alpha sub ix}
  448.   ~+~ {( h vec sub i cdot y hat )} sup 2 over{alpha sub iy}} over
  449.   {( h vec sub i cdot n hat sub p ) sup 2}right ]
  450. .EN
  451. .EQ I
  452. x hat ~=~ y hat~times~n hat sub p
  453. .EN
  454. .EQ I
  455. y hat ~=~ {n hat sub p~times~b vec}over{|| n hat sub p~times~b vec ||}
  456. .EN
  457. .EQ I
  458. alpha sub ix ~=~ a sub 5 sup 2 ~+~ omega sub i over {4 pi}
  459. .EN
  460. .EQ I
  461. alpha sub iy ~=~ a sub 6 sup 2 ~+~ omega sub i over {4 pi}
  462. .EN
  463. .EQ I
  464. g sub s ( q hat sub i ) ~=~
  465.   1 over {pi sqrt {beta sub ix beta sub iy} }
  466.   exp left [ {{( c vec sub i cdot x hat )} sup 2 over{beta sub ix}
  467.   ~+~ {( c vec sub i cdot y hat )} sup 2 over{beta sub iy}} over
  468.   {{( n hat sub p cdot c vec sub i )}sup 2 over
  469.   {|| c vec sub i ||}sup 2 ~-~ 1}
  470.   right ]
  471. .EN
  472. .EQ I
  473. c vec sub i ~=~ q hat sub i~-~t hat
  474. .EN
  475. .EQ I
  476. t hat ~=~ {v hat~-~d vec}over{|| v hat~-~d vec ||}
  477. .EN
  478. .EQ I
  479. beta sub ix ~=~ a sub 5 sup 2 ~+~ omega sub i over pi
  480. .EN
  481. .EQ I
  482. beta sub iy ~=~ a sub 6 sup 2 ~+~ omega sub i over pi
  483. .EN
  484. .NH 2
  485. BRDF Types
  486. .LP
  487. The more general brdf types (plasfunc, plasdata, metfunc, metdata,
  488. BRTDfunc) use the same basic formula given in equation (1),
  489. but allow the user to specify $bold rho sub si$ and $bold tau sub si$ as
  490. either functions or data, instead of using the default
  491. Gaussian formulas.
  492. Note that only the exponent terms, $f sub s ( q hat sub i )$ and
  493. $g sub s ( q hat sub i )$ with the radicals in their denominators
  494. are replaced, and not the coefficients preceding them.
  495. It is very important that the user give properly normalized functions (ie.
  496. functions that integrate to 1 over the hemisphere) to maintain correct
  497. energy balance.
  498.