huggingface / gsplat.js

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

Question about redundant bufferData call #60

Open mateusz-malicki opened 4 months ago

mateusz-malicki commented 4 months ago

Im working on a PR with a little cleanup, and there are a few redundant gl calls. Particularly expensive is populating depthIndex. Is there any reason to do it twice in RenderProgram? Everythink works fine if we keep only one call with buffer data. And there is realy no need to write depthIndex with every _render cycle - we should be doing it only if there is a new one.

  1. on message from sortWorker: https://github.com/huggingface/gsplat.js/blob/9080a5a97140d842fbc4d85ee42987dd53de38e0/src/renderers/webgl/programs/RenderProgram.ts#L207

  2. in render method: https://github.com/huggingface/gsplat.js/blob/9080a5a97140d842fbc4d85ee42987dd53de38e0/src/renderers/webgl/programs/RenderProgram.ts#L405

@dylanebert So, the question is: Is it done on purpose?