Game Engine Architecture

(Ben Green) #1
463

occluding object and extend planes outward from the camera’s focal point
through each of these edges. We test more-distant objects against these oc-
clusion volumes and cull them if they lie entirely within the occlusion region.
This is illustrated in Figure 10.45.
Portals are best used when rendering enclosed indoor environments with
a relatively small number of windows and doorways between “rooms.” In
this kind of scene, the portals occupy a relatively small percentage of the total
volume of the camera frustum, resulting in a large number of objects outside
the portals which can be culled. Antiportals are best applied to large outdoor
environments, in which nearby objects oft en occlude large swaths of the cam-
era frustum. In this case, the antiportals occupy a relatively large percent-
age of the total camera frustum volume, resulting in large numbers of culled
objects.


10.2.7.2. Primitive Submission


Once a list of visible geometric primitives has been generated, the individual
primitives must be submitt ed to the GPU pipeline for rendering. This can be
accomplished by making calls to DrawIndexedPrimitive() in DirectX or
glDrawArrays() in OpenGL.


Render State


As we learned in Section 10.2.5, the functionality of many of the GPU pipeline’s
stages is fi xed but confi gurable. And even programmable stages are driven in
part by confi gurable parameters. Some examples of these confi gurable param-
eters are listed below (although this is by no means a complete list!)


z world-view matrix;
z light direction vectors;
z texture bindings (i.e., which textures to use for a given material/
shader);
z texture addressing and fi ltering modes;
z time base for scrolling textures and other animated eff ects;
z z test (enabled or disabled);
z alpha blending options.
The set of all confi gurable parameters within the GPU pipeline is known
as the hardware state or render state. It is the application stage’s responsibility to
ensure that the hardware state is confi gured properly and completely for each
submitt ed primitive. Ideally these state sett ings are described completely by
the material associated with each submesh. So the application stage’s job boils


10.2. The Rendering Pipeline

Free download pdf