Using Materials and Lighting
So what's different now than when we were first using lights? The only major difference (other than the fact that we are using a mesh) is the lack of color in our vertex data. This is the cause of the light “failing” now.
In order for Direct3D to correctly calculate the color of a particular point on a 3D object, it must not only know the color of the light, but how that object will reflect the color of that light. In the real world if you shine a red light on a light blue surface, that surface will appear a soft purple color. You need to describe how our “surface” (our cube) reflects light.
In Direct3D, materials describe this property. You can specify how the object will reflect ambient and diffuse lighting, what ...
Get Managed DirectX® 9 Kick Start: Graphics and Game Programming 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.