antimatter15 / splat

WebGL 3D Gaussian Splat Viewer
https://antimatter15.com/splat/
MIT License
1.7k stars 169 forks source link

[FR] Anti-alising #42

Closed KovenYu closed 3 months ago

KovenYu commented 4 months ago

Hi,

Thanks for the wonderful work! I found that the anti-alising effect is different from the original 3DGS, so that thin particles or distant particles are displayed differently than original 3DGS.

Below, left is the original 3DGS, right is this viewer. You can see the strings in the bicycle tire. I also find similar effects when viewing distant structures.

image (18)

I wonder why this is the case, and if this can be fixed. I can try to do this, if you can teach me how.

Thanks!

alex-virodov commented 3 months ago

Hello. I am not the author, but I think the fix is to add the following code in in the vertex shader (after https://github.com/antimatter15/splat/blob/main/main.js#L693):

        mat3 cov2d = transpose(T) * Vrk * T; // current code

    cov2d[0][0] += 0.3;
    cov2d[1][1] += 0.3; 

This is taken from the cuda renderer: https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/59f5f77e3ddbac3ed9db93ec2cfe99ed6c5d121d/cuda_rasterizer/forward.cu#L107C1-L111C20

I don't have the exact view you have in the image, but here are my images without this change (top) and with this change (bottom): image

KovenYu commented 3 months ago

Thanks, @alex-virodov ! Also another way to do it is to remove the bias in covariance in the 3DGS training cuda code.