|
Notes for February 11 class -- Introduction to Ray Tracing, part 2
Ray tracing: A simple shader
A simple light source at infinity can be defined as an rgb color, together with an xyz light direction:
vec3 lightColor; // rgb
vec3 lightDirection; // xyz
A diffuse simple surface material can be defined by an rgb "ambient" component,
which is independent of any particular light source, and an rgb "diffuse" component,
which is added for each light source:
vec3 ambient; // rgb
vec3 diffuse; // rgb
The figure to the right shows a diffuse sphere, where the point at
each pixel is computed as:
ambient + lightColor * diffuse * max(0, normal • lightDirection)
|
| |
|
Ray tracing: Multiple light sources
If the scene contains more than one light source, then pixel color
for points on the sphere can be computed by:
ambient + ∑n (
lightColorn * diffuse * max(0, normal • lightDirectionn)
)
where n iterates over the lights in the scene.
|
About the code we worked on in class:
After you hand in the assignment that is due next Tuesday, I will
post the code that we developed in class.
It will be useful for doing
the assignment which will be due a week later.
|
|
| |