Getting ready

To start with this recipe, perform the following steps:

  1. Create a new shader (Phong), material(PhongMat), and a new scene with a sphere in it with a Plane underneath it (GameObject | 3D Objects | Plane).
  2. Attach the shader to the material and the material to the object. To finish off your new scene, create a new directional light if one is not there already, so that you can see your Specular effect as you code it:

Get Unity 2018 Shaders and Effects Cookbook 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.