Home > Articles > Programming > Games

  • Print
  • + Share This
This chapter is from the book


Let’s experiment with the effects shaders have on the way models look. You will use the same mesh and texture for each model; only the shaders will be different. The project created in this exercise is named Hour3_Exercise and is available in the Hour 3 book files.

  1. Create a new scene or project.
  2. Add a Materials and a Textures folder to your project. Locate the files Brick_Normal.png and Brick_Texture.png in the Hour 3 book files and drag them into the Textures folder.
  3. In the Project view, select Brick_Texture. In the Inspector view, change the aniso level from 1 to 3 to increase the texture quality for curves. Click Apply.
  4. In the Project view, select Brick_Normal. In the Inspector view, change the texture type to Normal Map. Click Apply.
  5. Add a directional light to your project (click GameObject > Create Other > Directional Light) and give it a position of (0, 10, –10) with a rotation of (30, 40, 0).
  6. Add four spheres to your project. Scale them each to (2, 2, 2). Spread them out by giving them positions of (2, 0, –5), (–2, 0, –5), (–2, 2, –5), and (2, 2, –5).
  7. Create four new materials in the Materials folder. Name them DiffuseBrick, SpecularBrick, BumpedBrick, and BumpedSpecularBrick. Figure 3.9 contains all the properties of the four materials. Go ahead and set their values.

    FIGURE 3.9

    FIGURE 3.9 Material properties.

  8. Click and drag each of the materials onto one of the four spheres. Notice how the light and the curvature of the spheres interact with the different shaders. Remember that you can move about the Scene view to see the spheres at different angles.
  • + Share This
  • 🔖 Save To Your Account