Game Development Reference
In-Depth Information
A plane geometry is mostly used to create terrains. However, we will first discuss
the structure of a plane geometry. A plane geometry is made of vertices where the
normal of each vertex is parallel to each other. The equation for a plane is commonly
written as follows:
Ax + By + Cz + D = 0
In the following diagram, you will see that the plane geometry is made of segments.
You should always have a higher number of segments. When the geometry is
viewed from different camera angles, more segments lead to better resolution and
minimum culling artifacts. We discussed earlier in Chapter 1 , Getting Started with
WebGL Game Development , primitive culling in the assembly/rasterization phase
in the The fragment shader section. The primitives that fall partly outside the view
frustum are culled or not passed to the fragment shader for processing. If you have
a bigger segment size, then you might notice missing triangles around the corners of
the terrain because the centroid of the triangle might fall outside the view area.
The preceding diagram of the plane geometry has three width segments and three
height segments. To render the preceding geometry, we need to generate the
following set of information:
Vertices
Vertex normals
Indices to reduce vertex redundancy
 
Search WWH ::




Custom Search