JMU
Lighting 3D Shapes
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Physics Basics
Physics Basics (cont.)
Transparency
Reflecting Materials
A Model of Diffuse Reflection
A Model of Diffuse Reflection (cont.)
A Model of Diffuse Reflection (cont.)
A Model of Specular Reflection
A Model of Specular Reflection (cont.)
A Model of Specular Reflection (cont.)
A Complete Model of Reflection
A Complete Model (cont.)
An Example of Reflection
An Example of Reflection (cont.)
An Example of Reflection (cont.)
Calculating the Surface Normal if it is Not Provided
Calculating the Reflection Vector
Calculating the Reflection Vector (cont.)
Calculating the Reflection Vector (cont.)
Reflection at Points other than \(\bs{0}\)
An Example of Reflection (cont.)
An Example of Reflection (cont.)
Interpreting A Different Example of Reflection

What is "going on" in the following example?

images/lighting-3d_cube.gif
Transparent/Translucent Materials
A Model of Transmission and Refraction

Understanding the Transmission/Refraction Angle

images/snells-law.png

Where \(\eta_i\) and \(\eta_t\) denote the index of refraction of the initial medium and transmitting medium, respectively, \(\bs{n}\) denotes the normal vector, and \(\bs{b}\) is chosen so as to form a basis with \(\bs{n}\) (i.e., \( \bs{b} = \frac{\bs{i} + \cos(\theta_i)\bs{n}}{\sin(\theta_i)}\)).

A Model of Transmission and Refraction (cont.)
A Model of Transmission and Refraction (cont.)
One Derivation (Assuming all Vectors have been Normalized)
  1. From Snell's Law: \( \sin(\theta_t) = \frac{\eta_i}{\eta_t} \sin(\theta_i) \)
  2. \(\sin^2(\alpha) + \cos^2(\alpha) = 1\) for any angle, \(\alpha\), so:
    \( \sin^2(\alpha) = \left(1 - \cos^2(\alpha) \right) \Rightarrow \sin(\alpha) = \sqrt{\left(1 - \cos^2(\alpha) \right)} \\ \cos^2(\alpha) = \left(1 - \sin^2(\alpha) \right) \Rightarrow \cos(\alpha) = \sqrt{\left(1 - \sin^2(\alpha) \right)} \)
  3. Substituting the first equation in (2) into (1): \( \sin(\theta_t) = \frac{\eta_i}{\eta_t} \sqrt{\left(1 - \cos^2(\alpha) \right)} \)
  4. From our study of the standard basis and and the unit circle:
    \( \bs{t} = \sin(\theta_t)\bs{b} - \cos(\theta_t)\bs{n} \\ \bs{i} = \sin(\theta_i)\bs{b} - \cos(\theta_i)\bs{n} \)
  5. From the second equation in (4): \( \sin(\theta_i)\bs{b} = \bs{i} + \cos(\theta_i)\bs{n} \)
  6. Substituting Snell's Law into the first equation in (4): \( \bs{t} = \frac{\eta_i}{\eta_t} \sin(\theta_i)\bs{b} - \cos(\theta_t)\bs{n} \)
  7. Substituting (5) into (6): \( \bs{t} = \frac{\eta_i}{\eta_t} \left( \bs{i} + \cos(\theta_i)\bs{n} \right) - \cos(\theta_t)\bs{n} \)
  8. Since \(\cos(\theta_i) = -\bs{i} \cdot \bs{n}\), it follows from (7) that:
    \( \bs{t} = \frac{\eta_i}{\eta_t} \left(\bs{i} - (\bs{i} \cdot \bs{n}) \bs{n} \right) - \cos(\theta_t) \bs{n} \)
  9. Substituting (3) into the second equation in (2): \( \cos^2(\theta_t) = 1 - \frac{\eta_i^2}{\eta_t^2} \left( 1 - \cos^2(\theta_i) \right) \)
  10. Substituting (9) into (8): \( \bs{t} = \frac{\eta_i}{\eta_t} (\bs{i} - (\bs{i} \cdot \bs{n}) \bs{n}) - \bs{n} \sqrt{1 - \frac{\eta_i}{\eta_t^2} (1 - \cos^2(\theta_i)} \)
  11. Since \(\cos(\theta_i) = -\bs{i} \cdot \bs{n}\) and \((-\cos(\theta_i))^2 = \cos^2(\theta_i)\):
    \( \bs{t} = \frac{\eta_i}{\eta_t} (\bs{i} - (\bs{i} \cdot \bs{n}) \bs{n}) - \bs{n} \sqrt{1 - \frac{\eta_i^2}{\eta_t^2} \left( 1 - (\bs{i} \cdot \bs{n})^2 \right)} \)
A Model of Transmission and Refraction (cont.)
A Model of Transmission and Refraction (cont.)