Performance: investigate sorting removal (hashed alpha testing or MLAB)
Instead of sorting + alpha blending, investigate whether Hashed Alpha Testing would produce "acceptable" results. Or one of order independent transparency approaches like MLAB. If any of these is decent, perhaps add them as an option.
I made some progress here, my code is a mess now, I can PR after cleaning it a bit. Here's how it looks with 1, 4, and 8 MSAA samples respectively:
There are some other tricks to reduce noise further as shown here: https://luebke.us/publications/StochasticTransparency_I3D2010.pdf
I write to SV_Coverage the coverage mask is created as follows:
uint createStochasticMask(float alpha, float3 pos, uint idx)
{
uint mask = 0;
for (uint i = 0; i < 8; i++)
{
float3 seed = pos + (idx + 1) * (10*i + 1);
float cutoff = saturate(hash13(seed));
if (alpha > cutoff)
{
mask |= 1 << i;
}
}
return mask;
}
I use an intermediate Render Texture with MSAA enabled then resolve it to the main one. It doesn't seem to render well according to depth, when using no order it renders points randomly, and when using the Order buffer everything is inverted (further things render first). Any ideas why? I use:
ZWrite On
ZTest LEqual
Blend One Zero
Cull Off
Would blue noise improve things here? It should be as simple as sampling from a pregenerated texture.
@pablodawson Is this right repo and branch? https://github.com/pablodawson/UnityGaussianSplatting
Nothing renders for me even when I try and bypass the NRE in the console.
@andybak I updated the repo, it implements both Weighted blended OIT and Blue Noise/Hashed OIT, and you can switch between them in the inspector.
For the latter, Blue Noise seems to look worse in my opinion. Weighted blended OIT seems promising as it is less "grainy" but it might require some tweaking to get it right.
Also Noise/Hashed OIT seems to work only on sorted splats which kind of defeats the purpose, but it's a decent starting point I think.
Some comparisons:
Alpha blending:
Blue Noise (8x MSAA):
Hashed (8x MSAA):
Weighted:
I want to try Depth Peeling next, but it might be too much overhead.
Edit: Apparently weighted blending is not good for this case since it fails on surfaces with high alpha with transparency behind it https://therealmjp.github.io/posts/weighted-blended-oit/
Also - it's worth noting that the Quill player varies the blue noise per frame. It increases "crawling" but at a high refresh rate it adds some temporal smoothing (I assume due to persistence of vision)
Interesting, I'll see if I can implement that. Also forgot to add alpha correction, the latest commit should look better (and not require sorting)
Update: Fixed some things. The bike scene looks decent now imo and depth is correct with no sorting.
Hashed alpha 8x:
Alpha blending:
On my 3070: Alpha blending (current): 80 FPS Hashed alpha 8X: 98 FPS Hashed alpha 4X: 103 FPS Hashed alpha 2X: 198 FPS
Also @andybak do you recall using anything else to reduce noise? Looking into TAA and Bilateral/Median Filters for example