Monday, July 29, 2013 Eric Richards

This time around, we are going to begin with a simple texturing example.  We’ll draw a simple cube, and apply a crate-style texture to it.  We’ll need to make some changes to our Basic.fx shader code, as well as the C# wrapper class, BasicEffect.  Lastly, we’ll need to create a new vertex structure, which will contain, in addition to the position and normal information we have been using, a uv texture coordinate.  If you are following along in Mr. Luna’s book , this would be Chapter 8, the Crate Demo.  You can see my full code for the demo at https://github.com/ericrrichards/dx11.git, under DX11/CrateDemo.

crate

Thursday, July 25, 2013 Eric Richards

This time, we are going to take the scene that we used for the Shapes Demo, and apply a three-point lighting shader.  We’ll replace the central sphere from the scene with the skull model that we loaded from a file in the Skull Demo, to make the scene a little more interesting.  We will also do some work encapsulating our shader in a C# class, as we will be using this shader effect as a basis that we will extend when we look at texturing, blending and other effects.  As always, the full code for this example can be found at my Github repository https://github.com/ericrrichards/dx11.git; the project for this example can be found in the DX11 solution under Examples/LitSkull.

litskull1

litskull2

litskull3

Rendering the LitSkull scene with 1 light (key lit) Rendering the LitSkull scene with 2 lights (key and fill lit) Rendering the LitSkull scene with 3 lights (key, fill and back lit)

Wednesday, July 24, 2013 Eric Richards

Last time, we ran through a whirlwind tour of lighting and material theory, and built up our data structures and shader functions for our lighting operations.  This time around, we’ll get to actually implementing our first lighting demo.  We’re going to take the Waves Demo that we covered previously and light it with a directional light, a point light that will orbit the scene, and a spot light that will focus on our camera’s view point.  On to the code!

lighting


Tuesday, July 23, 2013 Eric Richards

Last time, we finished up our exploration of the examples from Chapter 6 of Frank Luna’s Introduction to 3D Game Programming with Direct3D 11.0 .  This time, and for the next week or so, we’re going to be adding lighting to our repertoire.  There are only two demo applications on tap in this chapter, but they are comparatively meatier, so I may take a couple posts to describe each one.

First off, we are going to modify our previous Waves Demo to render using per-pixel lighting, as opposed to the flat color we used previously.  Even without any more advanced techniques, this gives us a much prettier visual. lighting waves To get there, we are going to have to do a lot of legwork to implement this more realistic lighting model.  We will need to implement three different varieties of lights, a material class, and a much more advanced shader effect.  Along the way, we will run into a couple interesting and slightly aggravating differences between the way one would do things in C++ and native DirectX and how we need to implement the same ideas in C# with SlimDX.  I would suggest that you follow along with my code from https://github.com/ericrrichards/dx11.git.  You will want to examine the Examples/LightingDemo and Core projects from the solution.


Monday, July 22, 2013 Eric Richards
We’ll wrap up the slate of examples from Chapter 6 of Frank Luna’s Introduction to 3D Game Programming with Direct3D 11.0 by taking a look at updating a vertex buffer each frame, as opposed to the immutable vertex buffers we have been working with previously.  We will be using the Hills Demo that we created previously as a starting point, and add a second grid mesh that will represent water.  We will update this mesh each frame, to get the ripple effect shown below. waves