Game Development Reference
In-Depth Information
n Near clipping plane: This is the distance between your eye and the near view
plane. Any object closer will get clipped. The units are usually meters, but feel
free to set them to whatever standard makes sense for your game.
n Far clipping plane: The distance between your eye and the far clipping plane.
Anything farther away will be clipped.
Set Far Clipping Plane Distance to Something Far, but Not Too Far
Don
t set your far clipping plane to some arbitrarily large number in the hopes
that nothing in your huge 3D world will get clipped. The trade-off is that the
huge distance between your near and far clipping plane will create sorting
problems in objects very close or very far from the camera
'
depending on
your renderer. These weird sorting problems manifest themselves as if two
polygons were run through a paper shredder, since the individual pixels on
two coincident polygons will sort incorrectly. This problem is caused by
numerical inaccuracy, and the polygons will sort into exactly the depth in 3D
space. If you see this problem, first check the art to make sure the artists
actually placed the polygons correctly and then check your far clipping plane
distance. This problem is sometimes called
Z fighting.
Also, don
'
t set your near clipping plane to zero, with the hope that you
'
ll be able to see things very close
to the camera. There
s a relationship between the near clipping plane and the field of view. If you
arbitrarily move the near clipping plane closer to the camera without changing the field of view, weird
things begin to happen. My suggestion is to write a little code and see for yourself.
'
Geometry
Did you know that everything from teapots to cars to volleyball-playing beach bun-
nies can be made out of triangles? We all know that a geometric triangle is made up
of three points. In a 3D world, a triangle is composed of three vertices. A vertex
holds important information the shader will use to draw the triangle, and as you
might expect, there can be a lot more than its location in a 3D space.
Different renderers will support different kinds of triangles and therefore different
kinds of vertices that create those triangles. Once you get your feet wet with one ren-
dering technology, such as DirectX 11, you
ll quickly find analogs in any other ren-
dering technology, such as OpenGL. In our example, our vertex will contain a
position in 3D space, a normal vector, and a texture coordinate.
'
struct D3D11Vertex_UnlitTextured
{
D3DXVECTOR3 Pos;
D3DXVECTOR3 Normal;
D3DXVECTOR2 Uv;
};
 
 
Search WWH ::




Custom Search