huggingface / gsplat.js

JavaScript Gaussian Splatting library.
MIT License
1.26k stars 77 forks source link

Rendering #94

Open abrahamezzeddine opened 2 months ago

abrahamezzeddine commented 2 months ago

Hello,

I am wondering if this app is rendering all the splats, even for though that are behind other splats or not inside the camera view. (Frustrum Culling)

I want to know if it’s possible to only render what the camera see, and not render what is behind a splat. This can perhaps save GPU resources.

Could you please confirm?

Thank you.

dylanebert commented 2 months ago

It has simple camera clipping, so points behind the camera aren't rendered (RenderProgram.ts)

However, no occlusion culling, since theoretically points at all depths contribute to the final render

mateusz-malicki commented 2 months ago

Frustum Culling could be beneficial if performed before sorting splats - less splats to sort (but we have to "pay" for index mapping), smaller buffer to write to gpu (if writebuffersubdata is being used), vertex shader has less work to do. BUT to do it reasonably fast splats needs to clustered, so we can discard many splats at once. Mkkellogg (in his threejs implementation) is wrapping splats in octree for exactly this reason. And yeah, no occlusion culling for splats ;)