Sunday, August 11, 2013 Eric Richards

In this post, we are going to discuss applications of the Direct3D stencil buffer, by porting the example from Chapter 10 of Frank Luna’s Introduction to 3D Game Programming with Direct3D 11.0 to C# and SlimDX.  We will create a simple scene, consisting of an object (in our case, the skull mesh that we have used previously), and some simple room geometry, including a section which will act as a mirror and reflect the rest of the geometry in our scene.  We will also implement planar shadows, so that our central object will cast shadows on the rest of our geometry when it is blocking our primary directional light.  The full code for this example can be downloaded from my GitHub repository, at https://github.com/ericrrichards/dx11.git, under the MirrorDemo project.

mirror


Monday, August 05, 2013 Eric Richards

Last time, we covered some of the theory that underlies blending and distance fog.  This time, we’ll go over the implementation of our demo that uses these effects, the BlendDemo.  This will be based off of our previous demo, the Textured Hills Demo, with an added box mesh and a wire fence texture applied to demonstrate pixel clipping using an alpha map.  We’ll need to update our Basic.fx shader code to add support for blending and clipping, as well as the fog effect, and we’ll need to define some new render states to define our blending operations.  You can find the full code for this example at https://github.com/ericrrichards/dx11.git under the BlendDemo project.

blendDemo2


Friday, August 02, 2013 Eric Richards

This time around, we are going to dig into Chapter 9 of Frank Luna’s Introduction to 3D Game Programming with Direct3D 11.0 .  We will be implementing the BlendDemo in the next couple of posts.  We will base this demo off our previous example, the Textured Hills Demo.  We will be adding transparency to our water mesh, a fog effect, and a box with a wire texture, with transparency implemented using pixel shader clipping.  We’ll need to update our shader effect, Basic.fx, to support these additional effects, along with its C# wrapper class.  We’ll also look at additional DirectX blend and rasterizer states, and build up a static class to manage our these for us, in the same fashion we used for our InputLayouts and Effects.  The full code for this example can be found on GitHub at https://github.com/ericrrichards/dx11.git, under the BlendDemo project.  Before we can get to the demo code, we need to cover some of the basics first, however.

blendDemo


Thursday, August 01, 2013 Eric Richards

We’re going to wrap up our exploration of Chapter 8 of Frank Luna’s Introduction to 3D Game Programming with Direct3D 11.0 by implementing one of the exercises from the end of the chapter.  This exercise asks us to render a cube, similar to our Crate Demo, but this time to show a succession of different textures, in order to create an animation, similar to a child’s flip book.  Mr. Luna suggests that we simply load an array of separate textures and swap them based on our simulation time, but we are going to go one step beyond, and implement a texture atlas, so that we will have all of the frames of animation composited into a single texture, and we can select the individual frames by changing our texture coordinate transform matrix.  We’ll wrap this functionality up into a little utility class that we can then reuse. 

firebox


Wednesday, July 31, 2013 Eric Richards

This time around, we are going to revisit our old friend, the Waves Demo, and add textures to the land and water meshes.  We will also be taking advantage of the gTexTransform matrix of our Basic.fx shader to tile our land texture multiple times across our mesh, to achieve more detail, and use tiling and translations on on our water mesh texture to create a simple but very visually appealing animation for our waves.  This demo corresponds to the TexturedHillsAndWaves demo from Chapter 8 of Frank Luna’s Introduction to 3D Game Programming with Direct3D 11.0 .  You can download the full source for this example from my GitHub repository at https://github.com/ericrrichards/dx11.git.

Here is a still of our finished project this time:

texHills

I’m also going to try to upload a video of this demo in action, as the static screenshot doesn’t quite do justice: