Thursday, April 25, 2013

Graphics Write-Up #12

This was a pretty fun assignment that didn't end up being too tricky to do, but there was a bit of debugging to figure out some issues.  All of the coding itself was pretty simple, I pretty much just duplicated my DepthPass and did the same thing for my ShadowPass except from the lights view instead of the camera's.  And....  that was pretty much it.  Changing the light from a point light to a directional light was surprisingly easy and the movement ended up working identically as before except that instead of updating a position, I just update the direction (and the position is calculated from the direction).  The most challenging was setting up the WorldToLightTransform since I just copied what my WorldToViewTransform was doing.  Once I double checked with your instructions, however, D3DXMatrixLookAtLH() worked perfectly.

The fragment shader code was a little trickier to figure out since I had to make sure to sample from the right texel of the shadow map to compare against the texel of the mesh's texture (since they're in different spaces.)  Talking with Derick, Sherly, and Chris really helped with this.

The end result of this assignment is quite possibly the coolest yet.  Seeing shadows working is really awesome.

Here's what the scene looks like:


And here's the shadow map as seen in PIX:


Link to code:  http://www.eng.utah.edu/~jthummel/graphics/ThummelGraphicsAssignment12.zip

No comments:

Post a Comment