Hopefully I'm done with the fog for a while. Recently I fixed the last few particles to fog out correctly. The most challenging was the smoke, which used an unusual blend mode :
srccolor * srccolor + invsrccolor * destcolor
Sort of a combination of brightening & darkening. I made it foggable by moving the srccolor^2 into the pixel shader, and fading srccolor.rgb to black, and fading the srccolor.a to white, then blending with :
srccolor + invsrcalpha * destcolor
This way both terms fade out to do nothing in the distance.
In the process of fixing the fog on the particles, I cleaned up some code with the laser bolt and needle particles, and decided to adjust the glow on the needle particle. Turns out this revealed another issue - the spherical glow object drawn around the needle was lagging behind by a frame.
The reason was that the particles are drawn in object type order, so that all needles were updated & drawn after all glow spheres. That caused things to get out of sync. So, I changed it so that objects are now drawn in a different order using a small look-up table to give the new order based on object type. I could have rearranged the object types order instead, but that might have broken some of the existing levels.
This morning I refactored the code handling the fog / depth_cueing texture so that it is automatically generated from
the near & far parameters.
Over the next few days I plan to put in the RPG elements, so you can choose a level, have your character's stats used in the game, the monsters will be somewhat randomized, etc.
Here are some recent shots :