# CS488 - Introduction to Computer Graphics - Lecture 15

1. Mid-term
2. Hand back A3, project proposals

# Ray Tracing II

### Recursive Ray Tracing

Just what the name says, but why would you do it?

1. Unusual light paths for illumination, such as colour bleeding, reflection

### Surface Normals

Implicit surfaces, i.e., given by f(Q) = 0.

• Normal is perpendicular to the tangent space n . (Q' - Q) as Q' -> Q for all Q' on the surface.
• Normal is grad f(Q) = i df/dx + j df/dy + k df/dz

Transforming the normal vector

1. Normal vector, n, defined by nT.(Q1-Q) = 0
2. Under an affine transformation, M, n goes to n', Q goes to Q' = MQ, and Q1 goes to Q1' = MQ1.
3. The new tangent, n', is defined by n'T.(Q1'-Q') = 0 = n'T.M(Q1'-Q).
4. If n'T = nT M^-1 then the equation is identically true.
5. Therefore, n' = (M^-1)T n.
6. Notice the structure: contravariant versus covariant.

### Constructive Solid Geometry (CSG)

Geometric primitives can make other geometric primitives by

1. union
2. intersection
3. subtraction

The result is like sculpting; the problem is that describing the result is very difficult; the solution is

• Keep the combined primitives uncombined in the model
• Do the set operations on the ray
• Remember the normals

### Texture Mapping

1. Basic
2. Map 2D image onto primitive using a 2D affine transformation
• Simple if the surface of the primitive is flat
• otherwise, ...
• Texture pixels normally do not match display pixels, so some image processing may be needed.
3. Backwards map intersection point with ray into the image to get the surface properties
2. Normal Mapping (Bump mapping)
1. Start with a difference surface, defined with respect to the surface
2. Calculate the normals to the difference surface and map them onto the surface of the primitive
3. Use the mapped surface models for lighting
4. No occlusion, shadows are wrong, silhouettes are wrong, nobody notices!
3. Solid Textures
1. Solution to mapping texture onto curved surfaces
2. Usually procedural

### Speeding Up Intersection Tests

1. Bounding Volumes (usually Boxes)
1. Find the smallest - or close to smallest - regular volume that encloses the object
2. Use ray-intersect-volume as a pretest for fast negative results.
• benefit of quicker `miss' detection
• cost of getting a good bounding surface
• Both increase as complexity of primitive increases

Scene subdision

1. Divide the scene volume into sub-volumes: many ways to do it, such as