Annoying problems fixed

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

I finally nailed some of the more annoying problems I’ve had on my TODO list - it turns out the lack of shadows when hardware skinning (which actually caused GL to crash in the driver - yuck), were due to a feature I put in, but forgot about. :/ I wanted to suppress the update of a shadow buffer to the hardware version when only doing the software vertex blend because of the shadow, because otherwise you would unnecessarily upload the buffer twice. Problem was, I forgot to undo this suppression, so the shadow buffer never got uploaded. Doh. It was a bugger to track down though, because everything looked fine - I even read back the contents of the buffer (from the shadow buffer of course), and tried cloning the vertex data (which fixed it too). I had thought it was a memory corruption, but in fact it was something a lot simpler. Hey ho, I’m just glad it’s out of the way. It has raised one other issue though - subtle differences between the results of the software and hardware blending cause z-fighting on the light cap, which can be seen when you enter zfail mode. I may have to change the technique to use a separate light cap renderable (as I had had previously but optimised it out), at least for hardware skinned entities.

I also fixed the fullscreen D3D9 problem, that was due to not rebinding a temporary buffer when it was possible it could have been juggled to another entity since the last frame. This is one of those unpredictable things that only happen in some cases, which is always a problem.

So finally I can move on to other things, I plan to sort out directional lights next and improve the query which finds casters for lights. I intend to use a variation on the ‘near clip volume’ test for point lights, that is forming a pyramid from each side of the frustum and the light and seeing what’s inside it. For directional lights (which have no position), I was thinking of trying to form planes from the significant edges of the frustum, parallel to the light direction, and do a containment test. Hopefully this should ensure that the work done for shadow construction is kept to the minimum required.