2d-gaussian-splatting icon indicating copy to clipboard operation
2d-gaussian-splatting copied to clipboard

Help with cov3D_precomp

Open Shubhendu-Jena opened this issue 9 months ago • 3 comments

Hi,

Thanks for the great work. Does your code allow taking covariance matrix as input? If I set "cov3D_precomp" to True, does the function build_covariance_from_scaling_rotation give me exactly the same operations as the ones in your cuda code if scales and rotations are given as input instead?

Thanks in advance

Shubhendu-Jena avatar May 09 '24 05:05 Shubhendu-Jena

I haven't tested cov3D_precomp , but it should work for that. But keep in mind that the cov3D_precomp should be a 3x3 homogeneous transformation matrix,

def setup(means3D, scales, quats, viewmat, projmat):
    rotations = build_scaling_rotation(scales, quats).permute(0,2,1)
    p_view = (means3D @ viewmat[:3,:3]) + viewmat[-1:,:3]
    uv_view = (rotations @ viewmat[:3,:3])
    M = torch.cat([homogeneous_vec(uv_view[:,:2,:]), homogeneous(p_view.unsqueeze(1))], dim=1)
    T = M @ projmat # T stands for (WH)^T in Eq.9
    return T

I just need to check to the consistency between cuda and pytorch then.

hbb1 avatar May 09 '24 05:05 hbb1

Thanks for the quick response and yes, it'd help me a great deal if you could check and let me know. Thanks again!

Shubhendu-Jena avatar May 09 '24 05:05 Shubhendu-Jena

Hi, @Shubhendu-Jena , can you check this PR https://github.com/hbb1/2d-gaussian-splatting/pull/27 to see if the current implementation works for you?

I have tested on a simple experiments show the precomp yields identical results to the previous. I tested on the data nerf-synthetic chair, without regularizations, using an RTX 3090.

EXP PSNR Time
previous 35.29 12 min
new 35.35 12 min
new (pre_comp) 35.35 21 min

BTW, make sure you recompile the latest rasterizer.

hbb1 avatar May 13 '24 10:05 hbb1