Graphics Reference
In-Depth Information
How it works…
We first added the light's color and direction to our per frame constant buffer. This groups
the camera location and light together as in most situations they will not change between
the start and end of a frame. The new per material buffer on the other hand could change
many times per frame but not necessarily for each object.
We have set the light's direction in world space as we are performing all our light
calculations in this space.
We have added a new structure for storing material properties. These properties are
based on the information that we will be loading from the Visual Studio graphics content
pipeline CMO file.
UV mapping
By adding the UV transformation matrix to the per material constant buffer, we have
completed support for UV mapping for Visual Studio CMO meshes. The UV transform is used
to rotate or flip the vertex UV coordinates. This is necessary depending on how the mesh has
been converted by the Visual Studio graphics content pipeline. It can also be useful to use the
UV transform when changing a mesh vertex's winding order.
UV mapping is the process of unwrapping a mesh and assigning 2D texture coordinates to
vertices in such a way that when rendered in 3D space, the texture wraps around the object.
This process is performed within the 3D modeling software and looks something like the
following screenshot. From a rendering point of view, we are interested in the UV coordinates
assigned and the UV transform applied to the mesh.
UV mapping within Blender (www.blender.org)
 
Search WWH ::




Custom Search