Game Development Reference
In-Depth Information
Fig 2.16 A plane and its normal.
The sides of planes are defined by straight edges between vertices. Each
vertex has an associated point in space. In addition, planes only have one side.
This means that they can only be seen when viewed from above. To see this,
open Unity and create a plane game object. Rotate the plane around to the
other side. It will become invisible, but it will still be there.
In order to define the visible side of a plane, it has an associated vector called a
normal . This is not to be confused with normalization of a vector into a unit vector.
A normal is a vector that is orthogonal (90°) to the plane as shown in Figure 2.16 .
Knowing the normal to a plane is critical in determining how textures and lighting
affect a model. It is the side the normal comes out of that is visible and therefore
textured and lit. When a model is created in a 3D modeling package such as
Blender the normals are usually facing outward from the object. Figure 2.17
shows a model in Blender with the normals for each plane shown in blue.
The angle that a normal makes with any rays from light sources is used to
calculate the lighting effect on the plane. Figure 2.18 illustrates the vectors
and normal used in calculating the effect of light on a plane. The closer
the normal becomes to being parallel with the vector to the light source,
the brighter the plane will be drawn. This lighting model is called Lambert
shading and is used in computer graphics for diffuse lighting. Further
elucidation of shading is presented in later chapters.
Search Nedrilad ::

Custom Search