Graphics Reference
In-Depth Information
8.1.1 Theory
In a typical 3D application, it is common for the 3D model data that will be rendered to be
generated in an external modeling package for later use. This can be an artist's modeling
program, a computer-aided engineering program, or any of a host of other software pack-
ages. These programs are often referred to as digital content creation tools, or DCCs for
short. When the real-time rendering program is started, it loads the 3D model data from
disk, processes it into an appropriate format, and then renders the model in a given scene,
as needed.
To properly render the model within the application's scene, we must specify the location,
orientation, and scale that we want it to appear with. Since the model is defined in object space,
we need to manipulate the vertex positions prior to rasterizing the model's triangles, so that they
appear where we want them to. This manipulation is executed by performing matrix multiplica-
tion on the vertex positions with specially created transformation matrices.
We will provide a brief discussion on transformation matrices here, but will not re-
view the mathematical foundations behind their functionality. Our intention in this topic is
to provide the best possible resource to Direct3D 11, which means that we could not pos-
sibly provide a complete introduction to computer graphics. The formulas described below
are taken from the DirectX SDK and are suitable for our uses in the current example. Since
we are only performing a basic-level matrix manipulation, we can use the matrices without
a complete understanding of their details. If readers are interested in further information,
we refer them to (Eberly, 2007) and (Akenine-Moeller, 2002) for a more detailed discus-
sion of transformation matrices. Unless otherwise stated, all transformation matrices are
defined such that a position is represented with a 1x4 vector that is right-multiplied by a
4x4 transform matrix to produce another 1x4 row vector.
World Space
To render a triangle mesh, the first model manipulation is to determine the spatial state of
the model within the scene. More specifically, we need to specify the desired scale, orienta-
tion, and position of the model. Each of these desired properties can be expressed in a 4x4
matrix form, which is commonly referred to as a homogenous matrix representation. As
we will see later in this section, using homogenous matrices for our object manipulations
allows for easier manipulations and combination of the properties they represent.
Scale matrices. The first property of the mesh that we will examine is its scale. This is
commonly used to convert the model from its original size (as created in the artist's DCC
tool) to the desired size within the rendered scene. In addition, the scale of an object can be
modified to achieve some simple effects, such as shrinking, expanding, or oscillating the
size of an object. The size of the model is manipulated with a scale matrix, which is created
Search WWH ::




Custom Search