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
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
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 13: Direct Input
This tutorial will cover using Direct Input in DirectX 11. The code in this tutorial will be based on the previous font tutorial code.
Tutorial 14: Direct Sound
This tutorial will cover the basics of using Direct Sound in DirectX 11 as well as how to load and play .wav audio files. This tutorial is based on the code in the previous DirectX 11 tutorials.
Tutorial 15: FPS, CPU Usage, and Timers
This tutorial will introduce three new classes that will encapsulate the functionality of a frames per second counter, a cpu usage counter, and a high precision timer. The code in this tutorial is based on the code from the Font Engine tutorial.
Tutorial 16: Frustum Culling
The three dimensional viewing area on the screen where everything is drawn to is called the viewing frustum. Everything that is inside the frustum will be rendered to the screen by the video card. Everything that is outside of the frustum the video card will
examine and then discard during the rendering process.
Tutorial 17: Multitexturing and Texture Arrays
This tutorial will cover how to do multitexturing in DirectX 11 as well as how to implement texture arrays in DirectX 11. Multitexturing is the process of blending two different textures to create a final texture. The equation you use to blend the two textures
can differ depending on the result you are trying to achieve. In this tutorial we will look at just combining the average pixel color of the two textures to create an evenly blended final texture.
Tutorial 18: Light Maps
Light mapping in DirectX 11 is the process of using a secondary texture or data file to create a fast look up table to create unique lighting effects that require very little processing. Because we use a secondary source as the basis for our lighting we can
remove any other light calculations from our application. This can gain us incredible speed.
Tutorial 19: Alpha Mapping
Alpha mapping in DirectX 11 is the process of using the alpha layer of a texture to determine the blending amount for each pixel when combining two textures.
Tutorial 20: Bump Mapping
The proper terminology for the bump mapping technique we use is called normal mapping. The reason being is that we use a special texture called a normal map which is essentially a look up table for surface normals. Each pixel in this normal map indicates the
light direction for the corresponding pixel on the texture color map.
Tutorial 21: Specular Mapping
Specular mapping is the process of using a texture or alpha layer of a texture as a look up table for per-pixel specular lighting intensity. This process is identical to how light mapping works except that it is used for specular highlights instead.
Tutorial 22: Render to Texture
Render to texture allows you to render your scene to a texture resource instead of just the back buffer. You can then use that texture resource in your current scene to achieve numerous effects. For example you could render the scene from a different camera
angle and then use that texture in a mirror or video screen. You can also do some processing on that texture or use a special shader to render it to achieve even more unique effects. The list of things you can do with render to texture is endless and is the
reason why it is one of the most powerful tools in DirectX 11.
Tutorial 23: Fog
I will cover a very basic fog effect that is pretty simple to implement. The first step is to choose a color for the fog such as grey and then clear the back buffer to that color. Now the entire scene starts off being fogged. For each model that will be inside
the fog you add a certain amount of fog color in the pixel shader based on the model's location inside the fog. There are a couple of different fog equations we can use, in this tutorial I will use a linear equation but we will talk about a couple equations.
Tutorial 24: Clipping Planes
Clip planes are generally used to truncate geometry along a given plane in 3D space. The most common example that most people will be familiar with is the near and far clipping planes that we setup when creating a view port. The far plane of the view port clips
any geometry that goes beyond it so that we are not drawing the entire contents of massive 3D scenes.
Tutorial 25: Texture Translation
Texture translation is the technique used to animate a texture moving over a polygon surface. This tutorial will cover how to implement texture translation using DirectX 11 and HLSL. The code in this tutorial is based on the previous tutorial.
Tutorial 26: Transparency
Transparency is the effect that allows textured objects to appear see-through.
Tutorial 27: Reflection
This tutorial will cover how to implement basic planar reflections in DirectX 11 using HLSL and C++. In this tutorial we will render a cube being reflected by the floor.
Tutorial 28: Screen Fades
In this tutorial we will go over how to create the effect of fading in a scene