I think that shadowmapping may be cut in the end, however, I want to at least try it out. I couldn’t resist. Seeing as I’m running behind already, what’s another two weeks?
So far, I’ve spent 13 days on it and am incredibly close to resolving the last issue of projecting angled lights. If a light is facing the caster from one side, it’s okay. Extending it to be a light which is above and to one side breaks it completely. I’m not sure if I’ll have it fixed by the weekend, but I’ll certainly try. Two major issues presented themselves, which I’m forever in debt to Game Programming Gems, vterrain.org, and Real-time Rendering Tricks and Techniques in DirectX for having solved. The first was getting the shadowmap projected. I had it rendering into a texture with no problems, but the projection was off. I combined two chapters from Game Programming Gems and Real-time Rendering Tricks and Techniques in DirectX to get to the correct result. The texture would project onto the surface but it was way off. The next issue was how to determine if a triangle is in the shadowmap camera’s frustum. It was way simpler than I thought. Using six bits to represent if a point is in front of a plane, then seeing if the bits were zero (all in), matched with all three (completely outside), or otherwise (intersecting). With all of that I got the following results:
My next steps are to render the object as a grey because currently the texture is showing up inverted as the shadow. I may use the distance from the light to try and simulate a falloff of influence to the contribution of the shadow. Before that, however, I need to address the angled light position problem.
I don’t get to do much with rendering techniques in my day job, so this is quite a nice opportunity, even if it is on hardware that isn’t up to the task of our modern lust for visual complexity.
With the shadowmap out of the way, I look forward to finishing the demo and getting it out there. I think that the lightmapper does need some attention before then, but I’ll deal with it once I get a final environment together.