fatPeter / mini-splatting

103 stars 10 forks source link

About projection matrix #6

Open dingjr7 opened 2 months ago

dingjr7 commented 2 months ago

What is the camera coordinate defined in mini-splatting? I find the closest one is the one from direct3D.

屏幕截图 2024-09-04 233732

However, you commented out the P[2, 2]. Moreover, the sign of P[0, 2] and P[1, 2] are not the same.

fatPeter commented 2 months ago

Thank you for your interest.

Please check this issue (https://github.com/graphdeco-inria/gaussian-splatting/issues/388) for more information. Besides, ensure that the inverse projection (https://github.com/fatPeter/mini-splatting/blob/main/submodules/diff-gaussian-rasterization_ms/cuda_rasterizer/forward.cu#L497C24-L497C53) is correspondingly modified if the projective matrix is modified.

dingjr7 commented 2 months ago

I am still confused. If this follows the opengl's coordinate, then P[2, 3] should be multiplied by 2. The issue suggests that the z range is mapped to [0,1] rather than [-1,1].

fatPeter commented 2 months ago

You are right. The original and the opengl projection matrix are more technically correct. The thrid row (P[2,0] to P[2,3]) of the projection matrix indicates normalization along z-axis. Ideally, using mapping from (n, f) to (-1, 1), (0, 1) or any (x, y) does not affect the final reconstruction result in the camera or world space. The key point is to ensure the consistency between the point projection and the inverse projection as: image Thank you for pointing it out, and I will switch to the original projection matrix in the following version of mini-splatting.