This revision contains two major changes:
- Postproc improvements
Depth of field and bloom/hdr have been merged into a single shader called dof_bloom_color. Since the two techniques share data dependencies it was more efficient to combine them into a single shader and use defines to enable or disable one or the other independently. This also allows both techniques to be applied at the same time for a negligible increase in cost, which was previously not possible. The appearance of DOF has also been dramatically improved so that it is actually something people might want to use.
Additionally the blur shader has been modified to use a smaller and nicer looking gaussian blur instead of a box blur.
DOF has been changed from being a map option to being a user option. There are at least three reasons why I believe this is a better choice:
A. There are exactly zero maps using DOF currently, and the auto-map generator does not use it either.
B. It is not an artistically relevant effect. It is not tunable and whether it is enabled or not has no impact on the way maps look in artistic terms. It looks very consistent in terms of producing the impression of distance between different maps, based on the general scaling factor of 0ad. Conversely it would make the game look inconsistent if some maps used it and others didn't, which is undesirable.
C. It's generally a user preference whether they like the way it looks or not.
- Shadow map improvements
The regular box filter for PCF filtering has been replaced with a poisson disk, which looks better for small blurs than the regular box blur that was previously used. I also modified it to maintain the same blur scaling regardless of the shadow map size.
Additionally I implemented percentage-closer-soft-shadows and added a user option for enabling it. For PCSS I ultimately decided to use a regular grid for blur sampling instead of a poisson disk, because it's much cheaper on a per-sample basis and allows for much smoother blurs with fewer banding artifacts. It is however disabled for objects drawn with USE_TRANSPARENT due to the large number of fragments which such objects can produce, which leads to unplayably low framerates that rapidly approach 0 fps. It falls back to regular PCF filtering for such objects.
I removed the ultra-low and ultra-high shadow map resolution settings. Ultra-low was so bad that it wasn't worth using, and ultra-high seems to fail to allocate the textures for reasons that I was unable to determine, even after doing a thorough investigation. I know that the spring engine using SDL has been able to use 8192x shadow maps with no problem, so I really don't understand why it isn't working properly for us. If the shadow map should still fail to allocate for whatever reason, it will now properly have the renderer reload the relevant shaders to disable shadow rendering entirely. I've also fixed some issues with shadows failing to draw properly after the shadow map resolution was changed in game.
Finally I changed it to use 16 bit depth for the shadow map by default. As far as I can tell this doesn't cause any real issues with shadow quality, but on non-ancient graphics cards reducing the bit depth reduces the bandwidth, which improves performance considerably for PCSS and PCF. The bit depth can still be set manually in local.cfg for old cards which may have worse performance when using 16bit rather than 24bit depth.
Misc Changes:
- The "draw unit silhouettes" option was moved from graphics to general. As a general rather than graphics-specific feature it really belongs there anyway, but mainly it needed to be moved out because the graphics tab was overcrowded and the options were literally spilling out over the buttons at the bottom of the window.
- The "prefer GLSL" option has been removed (also because of crowding issues). Instead, I set default.cfg to use shaders and preferglsl= true by default. This will soon be the only option anyway, and is the de-facto condition for >95% of our users, so it seemed like the most obvious choice of options to drop.