Thanks so much for your kind words! 🙂
I would assume that you are using ZTest LEqual
instead of ZTest Less
, right?
When it is set to LEqual
, you will receive undesired overdraw (double-shadowing) at equal depth, so when there is no Z-Spacing
, it will all be at the same depth (= all overlapping shadow areas are incorrectly accepted). When set to a very small value like -0.00001
, you have a chance that numerical rounding errors will put two elements on the same depth. Finding a value that is causing no visual problems like -0.001
will always be in the precision range where there is enough numerical precision available so that no two different elements will end up at the same depth.
Note that precision will depend on Z distance between the camera near plane and the rendered element (the vertex position), and also on the distance between near and far plane. So the same Z-Spacing
value may be sufficient when the element is very close, but could lead to precision problems when far away. Just keep this in mind so you don't wonder why things suddenly look wrong when placed further back in a scene.
The precise solutions would be the Reverse Draw Order
option with Z-Spacing < 0
which is yet to be implemented, or using ZTest Less
and Z-Spacing = 0
.