Game Development Reference
In-Depth Information
allows an object to light itself. This is a good idea for things like explosions or light
bulbs anything that emits light. The alpha setting uses the diffuse alpha component;
it is read and used by the simple pixel shader you
ll see in the next chapter.
The last property is used to classify how the scene node is drawn, opaque or
transparent.
'
Textured Vertices
A texture is a piece of two-dimensional art that is applied to a model. Each vertex
gets a texture coordinate. Texture coordinates are conventionally defined as (U,V)
coordinates, where U is the horizontal component and V is the vertical component.
These coordinates are described as floating-point numbers, where (0.0f,0.0f) signifies
the top left of the texture and grows to the left and down for DirectX
in OpenGL it
describes the bottom left of the texture. The coordinate (0.5f, 0.5f) would signify the
exact center of the texture. Each vertex gets a texture coordinate for every texture.
Numbers greater than 1.0 can tile the texture, mirror it, or clamp it, depending on
the addressing mode of the renderer. If you wanted a texture to tile three times in
the horizontal direction and four times in the vertical direction on the surface of a
single polygon, the texture (U,V) coordinate that would accomplish that task would
be (3.0f, 4.0f). Numbers less than 0.0f are also supported. They have the effect of mir-
roring the texture.
Texturing
Creating a texture is as easy as popping into Photoshop, Paint.NET, or any bitmap-
editing tool. That leaves out tools like Macromedia Flash or Illustrator because they
are vector tools and are no good for bitmaps.
Go into one of these tools and create an image 128 × 128 pixels in size, and save it
out as a JPG. Figure 14.16 shows my version.
Figure 14.16
A sample texture.
 
 
 
Search WWH ::




Custom Search