Finding the Normal on a Child Object
Remember back in Transforming Normals, when you used the shape’s transformation matrix to manipulate the normal vector? The same thing needs to happen when computing the normal on a child object of a group, but now there’s a complication: when an intersection is found with a group, the intersection record itself references the intersected child. As your ray tracer is currently implemented, this means that when you compute the normal vector on that child object, only the child’s transforms are considered, and not the transforms of any group the child may belong to.
This is what you’ll work on next, in three steps:
-
Write a function that converts a point from world space to object space, recursively taking ...
Get The Ray Tracer Challenge now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.