3D Game Programming

(C. Jardin) #1

CHAPTER 14


Project: Phases of the Moon


The retrograde-motion chapter was pretty amazing, but in this chapter we’ll
cover something every 3D programmer must learn at some point: how to
visualize the moon and its phases. It’ll end up looking like this:

Why is it important to simulate the moon’s phases? First, it’s a simple enough
problem—the sun shines on the moon, which revolves around Earth—that
lets us use our knowledge of lights and materials. It also lets us play the rel-
ative-positioning tricks that we practiced with an avatar’s hands and feet
previously.

If you still think it’s not important, go watch Toy Story. It was the first full-
length computer-animated movie, and the programmers behind the project
made sure they got it right—a waxing crescent moon is visible behind Woody
and Buzz when they argue after being left by Andy at the gas station. If it was
important enough for those movie-makers, it’s important enough for us!

When you’re done with this chapter, you will


  • Know the most important trick in a 3D
    programmer’s virtual toolbox

  • Know strategies to make big changes to
    existing code

  • Understand moon phases better than most
    people (but not the Toy Story animators)


Prepared exclusively for Michael Powell report erratum • discuss

Free download pdf