Tutorial 2: Creating a Framework and Window
Before starting to code with DirectX 11 I recommend building a simple code framework. This framework will handle the basic windows functionality and provide an easy way to expand the code in an organized and readable manner. As the intention of these tutorials is just to try different features of DirectX 11 we will purposely keep the framework as thin as possible....
Tutorial 3: Initializing DirectX 11
This tutorial will be the first introduction to working with DirectX 11. We will address how to initialize and shut down Direct3D as well as how to render to a window.
Tutorial 4: Buffers, Shaders, and HLSL
This tutorial will be the introduction to writing vertex and pixel shaders in DirectX 11. It will also be the introduction to using vertex and index buffers in DirectX 11. These are the most fundamental concepts that you need to understand and utilize to render 3D graphics.
Tutorial 5: Texturing
This tutorial will explain how to use texturing in DirectX 11. Texturing allows us to add photorealism to our scenes by applying photographs and other images onto polygon faces.
Tutorial 6: Diffuse Lighting
In this tutorial I will cover how to light 3D objects using diffuse lighting and DirectX 11. We will start with the code from the previous tutorial and modify it.
The type of diffuse lighting we will be implementing is called directional lighting. Directional lighting is similar to how the Sun illuminates the Earth. It is a light source that is a great distance away and based on the direction it is sending light you can determine the amount of light on any object. However unlike ambient lighting (another lighting model we will cover soon) it will not light up surfaces it does not directly touch.
I picked directional lighting to start with because it is very easy to debug visually. Also since it only requires a direction the formula is simpler than the other types of diffuse lighting such as spot lights and point lights.
The implementation of diffuse lighting in DirectX 11 is done with both vertex and pixel shaders. Diffuse lighting requires just the direction and a normal vector for any polygons that we want to light. The direction is a single vector that you define, and you can calculate the normal for any polygon by using the three vertices that compose the polygon. In this tutorial we will also implement the color of the diffuse light in the lighting equation.
Tutorial 7: 3D Model Rendering
This tutorial will cover how to render 3D models in DirectX 11 using HLSL. The code in this tutorial is based on the code from the diffuse lighting tutorial.
We have already been rendering 3D models in the previous tutorials, however they were composed of a single triangle and were fairly uninteresting. Now that the basics have been covered we'll move forward to render a more complex object. In this case the object will be a cube. Before we get into how to render more complex models we will first talk about model formats.
There are many tools available that allow users to create 3D models. Maya and 3D Studio Max are two of the more popular 3D modeling programs. There are also many other tools with less features but still can do the basics for what we need.
Tutorial 8: Loading Maya 2011 Models
This tutorial will cover how to import static 3D models from Maya 2011. Note that this tutorial will be focused on Maya but it also applies to pretty much any other 3D modeling software package with some slight changes.
In the previous tutorials we have already created our own model format and rendered 3D models using that format. The goal now is to convert Maya 2011 models into our format and render them. I won't go into how to model 3D objects in Maya as there are hundreds of tutorials on the net already dedicated to that, we will instead start at the point where you have a textured and triangulated 3D model ready for export.
For the Maya export format we will use the .OBJ format as it is easily readable and good for beginners to start with.
Tutorial 9: Ambient Lighting
This tutorial will be an introduction to using ambient lighting in DirectX 11 with HLSL.
I will explain ambient lighting using an example. Imagine you are in a room and the only light source is sunlight which is coming in from a window. The sunlight doesn't directly point at all the surfaces in the room but everything in the room is illuminated to a certain extent due to bouncing light particles. This lighting effect on the surfaces that the sun isn't directly pointing at is called ambient lighting.
Now to simulate ambient lighting we use a very simple equation. We just set each pixel to be the value of the ambient light at the start of the pixel shader. From that point forward all other operations just add their value to the ambient color. This way we ensure everything is at a minimum using the ambient color value.
Ambient lighting also adds far more realism to a 3D scene.
Tutorial 10: Specular Lighting
This tutorial will be an introduction to using specular lighting in DirectX 11 with HLSL. The code in this tutorial builds on the code from the previous tutorial.
Specular lighting is the use of bright spot highlights to give visual clues for light source locations.
Tutorial 11: 2D Rendering
Being able to render 2D images to the screen is very useful. For example most user interfaces, sprite systems, and text engines are made up of 2D images. DirectX 11 allows you to render 2D images by mapping them to polygons and then rendering using an orthographic projection matrix.
Tutorial 12: Font Engine
Writing text onto the screen is a pretty important function of any application. Rendering text in DirectX 11 requires that you first know how to render 2D images. As we covered that topic in the previous tutorial this tutorial will just build on that knowledge.
The first thing you are going to need is your own font image.
Tutorial 2-12