- This refactor reduce the Memory overhead of SSS and enables us to always use separate albedo. Previously we used 128bits/px for SSS data and 32bits/px for albedo. Now we use 112bits/px for SSS data & separate albedo altogether.
- Then we separate the translucency evaluation to be outside of surface eval. This as the benefit to reduce code complexity and remove the need for shadow map (non-test) sampler in the shading pass. One big change is that bsdf intensity is multiplied and stored with the albedo color instead of the sss irradiance. This is in order to apply it to both the translucency and the sss diffusion. This change the look of mixed SSS shaders which is now closer to cycles.
- Add shadow bias state to DRW manager to have hardware depth bias. It is set to the minimum needed to avoid shadow acne using bilinear filtered shadowmaps. The bias parameter is now only doing an extra (user defined) offset in world space to avoid aliasing artifact.
- Replace ESM and VSM by PCF shadow mapping. PCF shadowmaps are less prone to light leaking and are faster to render (no prefilter).
- Make sun clip distances automatic: This simplify sun lights setup and matches more cycles behavior.
- Speedup: Use only 2 sample for cascaded shadowmap
- Add subpixel jitter to improve low res shadowmap accuracy. This option is only enabled if soft shadows are enabled.
- Improve contact shadows: Contact shadows now follow the shadowmap direction. This means it matches the shadowmap blur that is proportional to the light radius. Moreover this adds a more efficient bias for most contact shadows.
- Speedup: Only render shadow cube face needed This reduce the number of face to render to 5 in the case of area lights and 5 or 1 for spotlights.
- I removed the shadow method option, the exponent and bleed bias, and softness parameter for both contact shadows and shadowmaps. However, all DNA is left (and tagged with DNA_DEPRECATED) to ensure forward Compatibility (avoid crash of 2.80).
During the developpment of this I tried some techniques that failed:
- Receiver Plane Depth Bias: it was supposed to allow arbitrary wide filter without having self shadowing at the cost of some light leak. In practice, it removes shadowing from almost all surfaces perpendicular to the light vector. I tried putting a maximum bias value but it was very difficult to set the right value. Also the code was a bit heavy.
- samplerCubeShadowArray: Is a failure, we need to add a one texel border to each face and use a custom sampling method in order to have correct interpolation at face borders (when using hardware bilinear shadow test). So it defeats the purpose of using them to simplify the code.