Shadows, Reflections and Instancing
You will need to download more java files.
Instancing
To add instancing to your Ray Tracer, you will need three transform
methods to the Matrix class, as described in Chapter 21 on pages 421
and 424.
Then add the Instance class (child of the GeometricObject class) to
your Ray Tracer (included in the above zip file).
Then you can test your ray tracer using Figure 21.05(b) and Figure
21.15, although you will not get exactly these results until you
implement shadows.
Reflections
To add reflections to your Ray Tracer, you will need to make the
modifications described in Chapter 24, specifically those changes
described on page 498. Luckily, three of the new classes are included
in the zip file you downloaded. You will need to:
- add a max_depth to the ViewPlane class
- add a depth to the ShadeRec class
- add a new Whitted class (child of the Tracer class) - included in the zip file
- add a new PerfectSpecular class (child of the BRDF class) - included in the zip file
- add a new Reflective class (child of the Phong class) - included in the zip file
Then you can test your ray tracer using Figure 24.17, Figure 24.18, and Figure 24.20. Again, you still need to implement shadows to get exactly these images.
Shadows
This is the tricky part of the assignment. To add shadows, you will
need to modify every Material class, every Light class, and every
GeometricObject class, as described in Chapter 16 on page 299:
- Each Material class will need a shade method.
- Each Light class will need an in_shadow method.
- Each GeometricObject class will need a shadow_hit method.
For testing your shadow code, try to generate the cover image on page 293, Figure 16.10 and Figure 16.11(b).
Questions
Answer the following questions:
- Questions 16.1, 16.2 and 16.4 on page 306. To demonstrate your answer to question 16.4, create an image "SelfShadow.jpg" which shows an object that self-shadows.
- Exercises 16.1 on page 307.
- Questions 21.1 and 21.2 on page 437.
- Questions 24.2, 24.3, 24.4 on page 520.
Images
Once you have completed Instancing, Reflections and Shadows, turn in:
- SelfShadow.jpg - from Question 16.4 above
- Figure 21.15 - from page 439
- Two images with at least one reflective object and at least one object obviously shadowing another. The first image should be "ReflectiveWithShadows.jpg" and the second (with shadows turned off) should be "ReflectiveWithout.jpg".
Last modified: Thu Mar 10 13:09:25 MST 2011