3D Game Programming

(C. Jardin) #1

CHAPTER 12


Working with Lights and Materials


In this chapter we’ll cover how to build interesting shapes and materials that
look like this:

Back in Chapter 1, Project: Creating Simple Shapes, on page 1, we discussed
shapes in our 3D library. Here we’ll talk about different kinds of covers for
those shapes. We cannot learn about covers without also learning about
lighting. Even in the real world, material and lights go together. If a material
is shiny, then it means it reflects light better. If a material is dark and not
shiny, then a very bright light might be needed in order to see it.

The MeshNormalMaterial that we have used so far is helpful when we’re first
building games, but it’s not a good choice for real games. There is no control
over the color, the shininess, or anything. Let’s look at a couple of materials
that will let us change that.

13.1 Getting Started


Start a new project in ICE. Choose the 3Dstarterproject template from the menu,
then save it with the name Lights and Materials.

12.2 Changing Color


Add the following below START CODING ON THE NEXT LINE:


When you’re done with this chapter, you will


  • Understand how to make different colors

  • Be able to make shapes shiny or hard to
    see

  • Know how to make shadows in 3D games


Prepared exclusively for Michael Powell report erratum • discuss

Free download pdf