Directional light shadows, bugfixes

· by Steve · Read in about 2 min · (282 Words)

Heh, I guess that’ll teach me to speak too soon. I was so sure my new shadow culling system was working last Tuesday, but in fact there was a bug which caused shadows to be prematurely culled. I spent ages tracking it down, thinking it was in the cull volume building, so I added debug volumes and tried lots of things - in the end it was a simple error in Frustum::getWorldCorners which I hadn’t noticed before because it had no discernable effect on previous usages of it. Bah.

I also fixed a number of other bugs, like a clearScene bug in the Octree manager which has plagued a few people lately, and a particle system release-mode bug which just showed up yesterday, even though it must have been there for months. That was pretty puzzling, especially since it never occurred whilst debugging (even in release mode), but I found it in the end.

Today I added support for shadow casting with directional lights. This wasn’t much of a big deal, the only major thing was that since I’m extruding to a fixed distance, rather than to infinity (since you cannot extrude to infinity without a vertex program, at least in D3D since ‘w’ position values are not allowed), I need dark caps and quads on the sides of the shadow hull, just like for point lights, whilst you only need tris and no cark cap when you extrude a directional volume to infinity. I intend to add vertex program extrusino eventually, but for consistency I may continue to extrude to a fixed distance since in practice it doesn’t cause any problems (most people can easily define the maximum extrusion distance required).