Putting It Together

Thinking in terms of CSG can be challenging if you’re not used to it. It takes some practice to learn to see the world around you as unions, intersections, and differences of primitive shapes. Here are some things you can do with CSG and some hints for how to construct them.

  • A lens. (The intersection of two spheres.)

  • A six-sided die. (A cube, mostly, but using CSG difference operations with scaled spheres to form the pips.)

  • A block letter or number. (Perhaps from a flattened cube, with pieces shaved off using differences with cubes and cylinders.)

  • A flower. (Perhaps form the petals out of spheres, strategically scaled and shaped by intersecting other spheres.)

  • The planet Saturn. (Form each ring by subtracting one cylinder from another.)

If you’re feeling ambitious, think of how you might increase the realism for each of these. For example, dice in real life are not perfect cubes, but instead have rounded edges and corners. How would you create that effect, using just what you’ve implemented so far in your ray tracer?

images/csg/die.png

What else can you imagine? Furniture? Buildings? Dragons, knights, and castles? Trains, planes, or automobiles? Might as well make a spaceship or two, because the sky is the limit!

At this point, you’re as good as done with the Ray Tracer Challenge, but go ahead and turn the page anyway. Let’s talk about where you might take your ray tracer next, because like all the best projects, there’s always another feature you can add.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.1.239