hyperlogic / splatapult

A 3d gaussian splatting renderer in C++ and OpenGL
MIT License
89 stars 12 forks source link

Some questions. Thank you #12

Closed yuyaolong closed 5 months ago

yuyaolong commented 5 months ago

https://github.com/hyperlogic/splatapult/blob/7b0416a62269c3079aeea90160a25cbbb7f141c6/src/splatrenderer.cpp#L146

:Why we need to do glm::inverse here?

yuyaolong commented 5 months ago

Is the reason: calculate camera transformation in the world coordinate space firstly, inverse that matrix will be like do world coordinate space origin transformation in camera coordinate space

hyperlogic commented 5 months ago

I find it's easier to think of the camera itself as a 3d object. This allows me to treat movement and rotation of the camera the same as any other 3d object. However, when rendering from the camera's point of view from a vertex shader you need the "view transformation" which is the inverse of the "camera transformation". (combined with the projection matrix as well)

Hope this helps.