In the previous shadows update I was explaining how I experimented LiSPSM and trapezoidal shadow maps. Both were a bit disapointing due to the quality change based on where the camera is looking at ( dual frustum case ).
I decided to do a step back and to go for parallel-split shadow maps (PSSM), which are very similar to my first implementation, cascaded shadow maps. In PSSM, the camera frustum is split in N depth sections, and each section gets it own shadow map. Here's a small diagram to explain it:
It offers twice the resolution compared to cascaded shadow maps; the reason is that the shadow frustums are tightly placed on the camera frustum, while in cascaded shadow maps, the frustums were *centered* on the camera origin. Performance is similar.
My version of PSSM is a bit simplified compared to the original algorithm: the distances at which to split the shadow frustums are constant and not determined dynamically. So far I haven't felt the need for it.
The good news is.. with this implementation, I'm finally getting close to the point where I'll call myself "satisfied". In particular, I can now get shadows on small ships, plus shadows on terrain at a long distance. I reached my target of 64 Km for the maximum distance at which shadows can be seen ( using 4 splits ). Pics of the shadowed terrain will come in a future update.
Of course, to get shadows at 64 Km, you'll need a monster PC. I currently "only" get 40 fps on my 8800 GTX, although there's still room for optimizations. Apparently I'm still heavily CPU limited. The bottleneck is, to do atmospheric scattering, shadowing etc.. I need to set for each object tons of shader constants ( plus for precision issues, rendering in camera space requires to compute many matrices per object ), and with the terrain LOD there can be up to a thousand objects in view. Since for shadow mapping the scene has to be rendered for each of the 4 splits into a depth texture, it's rendering many thousand objects per frame. Serious overhead.
Sovereign
WhiteSpade01 sent an update of the Sovereign ( a 650m long ship ), textured with UV tiling and SpAce's texture pack. With the new shadows, I couldn't resist taking a few screenshots. The shader is still basic and only features diffuse, bump, specular, emission and shadows. It lacks the custom/dirt maps as well as the anisotropic lighting ( giving the metallic look of ASEToBin ). No HDRI/bloom yet.