Derivatives of Trigonometric Functions

text only
 
 
progress indicator progress indicator progress indicator progress indicator

Lighting a Surface

Once you have the normal vector, you could store that in a vertex and apply the standard DirectX lights. For this book, I have chosen not to do that for a couple of reasons. First, I wanted to limit the amount of DirectX specific code whenever possible. Second, I wanted to spend a brief amount of time showing you why the normal was important.

The examples in this book only deal with diffuse lighting. In this simple model, the intensity of reflected light anywhere on the surface is determined by the dot product of the normal vector and the opposite of the light direction, as shown in Figure 7.7. Both vectors should be normalized before computing the dot product.


Figure 7.7: Lighting on a surface.

There are certainly more complex and realistic ways to light a surface, but this model is sufficient for these simple examples. In the source code, you will see this explicitly computed and placed into the vertex color . If you would rather light the surface with other methods , you could place the normal vector into the vertex and light the surface with a shader or fixed function lighting.

At this point, you have all the basic equations you need to render a Bezier surface. Before I show you the source code needed to actually implement these equations, I need to briefly go over the general 3D framework used in all of the surface chapters.

progress indicator progress indicator progress indicator progress indicator


Focus on Curves and Surfaces
Focus On Curves and Surfaces (Focus on Game Development)
ISBN: 159200007X
EAN: 2147483647
Year: 2003
Pages: 104
Authors: Kelly Dempski

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net