Professional Documents
Culture Documents
org/twntduff/directx-11-terrain/src
Managers
Texture Manager:
The texture manager is used to manage the texture assets that are loaded into
memory at any given time. Loading only the relevant texture allows the clearing up
of memory for other processes. The textures are cleared or loaded at the beginning
of each level or game state. For instance, the textures used for the main menu are
the only textures that are loaded at that time and are cleared afterwards because
they are no longer used in the application.
Shader Manager:
The shader manager manages the shader assets that are used in the
application. The only shaders that are loaded are the ones that are being used in
certain areas or levels. When they are no longer needed they are erased to clear
memory for other processes. For instance, a level that takes place inside of a
building and does not require a skybox will not load the skybox specific shader
because it will not be used.
Mesh Manager:
The mesh manager operates the same as the other managers by only loading
the necessary assets for a given area or level. Each entity has a mesh component
and those that share the same mesh share an instance of the single mesh object.
Shadow Mapping
Shadow mapping is a fairly easy way to create dynamic shadowing in a
graphics application. The shadow mapping algorithm works in two passes through
the pipeline. First, the scene is rendered from the point of view of the light source
and the distances are rendered to a texture. Then, the scene is rendered with the
cameras point of view and a test is done to check if the current pixel is further from
the light source than the distance stored in the texture. An orthographic matrix is
used in the case of a directional light because the light source is considered far
enough away that the light rays are parallel to each other.
Skybox
The skybox is used to create a background for a graphics application. It is a
simple cubic skybox that surrounds and follows the camera and is always rendered
behind all of the other objects in the scene. This is how the effect of never getting
closer or further to the sky is created. In advanced skyboxes, the skybox moves
with the camera but at a different speed to give off the illusion that the skybox is
not infinitely far away. This was not included into the project because a simple
skybox would work fine considering there is no night/day cycle and no distant
objects.
Frustum Culling
The three dimensional area on the screen where objects are rendered is
referred to as the viewing frustum. Everything that is inside the viewing frustum is
rendered to the screen by the graphics card and everything outside of the frustum is
examined by the graphics card and then discarded during rendering. Depending on
the graphics card, the process of culling done by the graphics card can be
computationally expensive when there is a large scene with multiple polys. This is
because the graphics card must examine every single poly to remove the polys that
are not in the viewing frustum even if there are only a few polys in view. This is
avoided by using frustum culling to determine if an object is in the viewing
frustum before it is sent to the graphics card so that we can cut down on the
number of polys sent to the graphics card. The way this optimizing feature is
utilized in my DirectX 11 application is by breaking the large terrain up into
different quadrants so that the quadrants can be culled when they are not in the
viewing frustum.