Skip to content

Learn DirectX 11

Sergey Stepanov edited this page Nov 30, 2016 · 39 revisions

The sole purpose of this project is learning DirectX 11 api. Practical Rendering and Computation with Direct3D 11 book is used as the main source of knowledge. The second part of the book is composed of various rendering techniques and examples. Most of these examples will be implemented in the project (from very basic up to some advanced techniques). The implementation process follows the structure of the book.

Chapter 8. Mesh Rendering

##Chapter 8. Mesh Rendering

Static mesh rendering

[ static_mesh_example ] (https://cloud.githubusercontent.com/assets/10673999/20491185/9f5b4d62-b021-11e6-8aa7-504a1caf35bc.png)

The example is pretty simple but it is a good point to start implementing more sophisticated techniques. There are a cube and directional light source on the scene.

The main goals are:

  • Initialize DirectX device, context and swap chain.
  • Load geometry and texture data and upload the data into the GPU.
  • Load and compile vertex and pixel shaders.
  • Set up the pipeline and draw the scene.

Vertex skinning

vertex_skinning_example_01 vertex_skinning_example_02 vertex_skinning_example_03
The example uses famous Bob Lamp model which has 1 animation. Also there is a directional light source on the scene.

Vertices of such animated model has the following format: position, normal, texture coordinates, 4 bone indices and 4 bone weights. Vertex shader gets appropriate bones' matrices from StructuredBuffer<float4x4> by bone indices and uses bone weights to interpolate the outcome vertex position.

Actually the vertex shader is pretty simple. The main challenge is to load a model with its animations, compose vertex data (including bone indices and weights) and implement animation algorithm which computes bone matrices for each frame preserving bone hierarchy.

Displacement mapping

Clone this wiki locally