Over the last fortnight or so MMM and I have been working on getting Evolved's Shadow Mapping shader to work with GPU bone animated models. At the same time we fixed a few other issues. For example the new shader uses accurate pixel fog rather than vertex fog and also works correctly with unwelded models.
I'm pleased to report that we've resolved the main issues. The result is the attached demo which shows shadow mapping for bumpmapped animated boned models plus fog.
The demo uses two shaders - one for boned models, the other for simple objects (such as the floor in this demo). On my machine the demo runs at up to 1400 fps (with vsync off - with vsync on I get a steady 60). A comparable unboned shader reduces the fps considerably when vsync is off.
[Technical stuff]Shader connoisseurs might be interested to know the following.
There were two problems developing the shader. The first main one was a new one to me and held us up for quite a while till Lee kindly confirmed what the problem was. When a vertex or pixel shader is compiled by DBPro something called a constant register table is set up. This table contains all the variables that the application - i.e. the DBPro program - has to pass to the vertex or pixel shader. In the case of the boned version of the vertex shader this includes the bone matrix palette which in this demo has size 60. Some of the models we were using needed the full 60. Each entry in the palette requires 16 floats (corresponding to a 4x4 matrix) and each register in the constant table can contain 4 floats. This means that the bone matrix palette used 240 of the available 256 entries in the constant table. The others were needed for things like fog distance, world matrix, view matrix and so on. It turned out we had exceeded the limit of 256 for Shader Model 2 (neither Dark Shader or DBPro gave any warning this was happening). We managed to get around that problem by moving some of the vertex shader code into the pixel shader - that helps because some of the registers are no longer need by the vertex shader and are used by the pixel shader instead where there was plenty of room. We now come to the second problem.
The original version of the shader had a pixel shader near its instruction count limit - and that was exceeded when certain instructions were moved into it from the vertex shader. We were able to overcome that by compiling the shader under Shader Model 3 instead of Shader Model 2. However, not everyone has a GFX card that supports SM2. Since several instructions were consumed by the repeated shadow map samples (needed to soften the shadow edges somewhat) a simple solution was to reduce the number of samples. So the attached demo has two main techniques for shadow mapping: one for SM3 which uses the full 3x3 sampling grid used by Evolved, and one for SM2 which uses a simple triangular sampling pattern.
[End of Technical stuff]
The demo uses dark red fog so you can see it working clearly. Just change the colour to something that suits your taste.
The demo uses two animated boned models - one from the MS DX9 SDK ("tiny.x") and one from an FPSC Model Pack "vikingwarrior1.x". [Note that the latter had to have vertex colour removed so bumpmapping would work - you'll see the file has been renamed "vikingwarrior1nodiffuse.x" for that reason.] Some of you will notice that the sword doesn't have its own bump map - if you know how to fix that easily please let me know.
Move the camera using the mouse to turn and up/down keys to move back and forth.
[This post was originally buried in one of the related threads but we decided that anyone interested in shadow mapping for boned animated models would have difficulty finding it. Hence this thread.

I've also taken the opportunity to make two minor changes to the dba code: the animated model now uses a smaller shadow map sampling width (the other shader still uses Evolved's fixed width and could be edited in the same way); the shadow map has been changed to use R32F format. This allows depth to be calculated more accurately.]