maturk / dn-splatter

DN-Splatter: Depth and Normal Priors for Gaussian Splatting and Meshing
https://maturk.github.io/dn-splatter/
Apache License 2.0
490 stars 30 forks source link

Normal supervision - Is normal properly expressed in camera coordinates before rendering ? #75

Open gaetan-landreau opened 1 month ago

gaetan-landreau commented 1 month ago

Hi ! 👋🏼 I recently skimmed through your code and this particular line made me a bit lost .. https://github.com/maturk/dn-splatter/blob/367c36dbcf1426ba21c1b58045346efdfebc4242/dn_splatter/dn_model.py#L556 As comment suggest that it "convert normals from world space to camera space", I would have rather taken the inverse of camera.camera_to_worlds to express the normals, defined in world coordinate, into the camera one. Am I missing something ? 🥲

sevashasla commented 1 week ago

Hello! If I am not mistaken the code is correct. Normals are vectors-rows but not vectors-columns. Therefore the result in vector-s-columns should be (w2c @ normal.T) = (c2w.T @ normal.T) We want to get vectors-rows back, then (c2w.T @ normal.T).T = normal @ c2w