
Progress!
Holding the gun with both handsI got the soldier to hold the gun with both hands. The physics of it is working ok, but I haven't got the character pose/animation right yet. More on that in the last section of this post. Also the gun jitters a bit more visibly than I'd like, but I can fix that later.
Shadow maps the "correct" wayI got my shadow mapping to use the built-in depth buffer, instead of what I had been doing before (manually encoding the depth info as a color, then decoding it again). Surprisingly enough, it's actually slower

According to
Australian doofus who doesn't like FreeSpace, the ability to read depth values directly from a depth texture (presumably instead of using comparison operations) is a relatively new feature and some older graphics cards may not support it... so maybe it's also the case that the graphics cards that support it may not support it as well as they supported the shenanigans I was doing previously.
But it just makes more sense to use the depth buffer that's already being written to, rather than having a redundant color buffer to store the same data. So I'm going to keep it, even if it's somewhat slower than the color buffers thing. And anyway I was able to get it going faster again by simply decreasing the resolution of the shadow map from 4096
2 to 2048
2.
Maybe it would be better to use the depth comparison stuff for the shadow maps, where instead of reading floats from the depth texture, I can only compare the floats to other values. Idunno, I might go back and change it later. I think I will still need to get actual floats from the main depth buffer, even if the shadow map depth buffers can use depth comparison.
Cascaded shadow mappingAfter I got shadows working the "correct" way, I made it so it renders 3 different shadow maps, all with the same resolution, but each one covering a larger area centered further from the camera. Then I procrastinated for a day.
Then I made it so the deferred lighting (or is it shading?) fragment shader actually uses all 3 of the shadow maps I rendered.
I actually had to reduce the resolution
again once I had 3 shadow maps going at once, so now it's down to 1024
2. It still looks
decent, so I'm content to leave it as it is for now.
Enough of this graphics stuff, let's get back to C/PHFTCharacter/Physics Happy Fun Time, that is.
Part of my problem, I think, is that I need more animations for my doods. As it is now, my soldier has animations for walking forward and backward, left and right, and turning left and right. But it doesn't account for the normal vectors of the terrain it's stepping on, and it doesn't account for differences in terrain elevation either. I might be able to resolve the normal vectors thing entirely with articulation of the ankle joint, I'm not sure. But to deal with walking up or along a slope I need animations for those things.
But my attempts to make poses or animations where more than one of the Dood's bones would be constrained (e.g. holding a gun with both hands, or standing with two feet on the ground) have all been failures. The way I have things set up, I tell each joint what orientation it should be in, and it will try to do that. But if there's two or more external constraints, I'm specifying more degrees of freedom than I have. Also I have to worry about whether the joint orientations I'm specifying are within the joints' rotation limits. Both of those issues can cause the Dood to tense up and contort himself in strange ways, making the actual bone orientations not match what the pose is telling it to do... which in turn makes editing the pose that much more difficult.
What I need is a tool to create and edit Dood poses and animations. So far I've made a program which displays a Dood, and that's about it. I spent a fair amount of time yesterday trying to plan in advance how the data would be stored for various purposes:
- Designing the file format for animations
- Maybe having two such formats: one for the editor and one for use by the actual game (like how PCS2 has both .PMF and .POF)
- Designing the struct/class for animations loaded in the editor
- Designing the struct/class for animations for use by the actual game
But ultimately it was too much and I didn't end up settling on anything. Maybe I will just make it possible to edit the pose of the Dood, and worry about I/O and formats and stuff once I get that working.
@z64555: Ehhh... dynamic lighting for particles is a low priority.