-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DropInViewer seems to render but is invisible in three.js scene #357
Comments
I'm not familiar with the product, from what i see in your example the grid and axisHelper are Needle's? Is there a way to access/pass Needle's camera, renderer to the viewer? |
Yes, but since Needle is using three.js under the hood camera and renderer are already accessible to GaussianSplats3D in the If need be they can be accessed with |
Can you pass them to the DropInViewer? |
I tried that and it does not change the behaviour. GaussianSplats3D/src/DropInViewer.js Lines 13 to 19 in f6f4ade
GaussianSplats3D/src/DropInViewer.js Lines 123 to 125 in f6f4ade
|
As far as i understand: if you use the DropInViewer, the Viewer won't create new ones (camera, renderer) and they need to be passed in the options. Can you check the update in Viewer? |
As mentioned, they do get passed in by three.js in the onBeforeRender callback: GaussianSplats3D/src/DropInViewer.js Lines 123 to 125 in f6f4ade
I verified that the correct camera and renderer are passed into the update() call through the onBeforeRender callback. That's how DropInViewer works. I believe the issue here must be something else.
As expected, passing in those options does not change the behaviour. I updated the StackBlitz repro: |
If I knew I probably wouldn't have needed to open an issue :) @mkkellogg wanted to take a look directly: |
Sorry for the lack of movement on this one, I've been terribly busy with other things. I hope I can devote some time to it soon. |
After looking at your sample for a while, there's no obvious reason why it should not be working. There must be something happening under the hood with your engine that is affecting the rendering of the splats, and there's no way for me to debug that. |
Thanks for investigating. Needle is not doing anything special to the three.js renderer – it just adds objects to the scene graph. I'll see if I can find anything else. EDIT: I found the issue! 🎉 Carefully comparing the uniforms passed to the drawcall, this zero was suspicious: Turns out that Viewer/DropInViewer make a few assumptions that are not necessarily true:
I believe the latter is what breaks rendering here. The rootElement might have a different size, e.g. height = 0, and then no splats are visible because while the renderer has a specific size, the size of the parent element is used. If I replace this line with GaussianSplats3D/src/Viewer.js Line 306 in f6f4ade
Couple questions @mkkellogg:
I updated the StackBlitz page with vanilla three.js and DropInViewer and the broken case – // This breaks it, because then the assumptions made by Viewer about the rendered size are wrong
const div = document.createElement('div');
div.style.height = 1000000; // stretchy lines
div.style.height = 1; // giant vertical lines, very slow
div.style.height = 0; // nothing renders at all (as described in this issue)
document.body.appendChild(div);
div.appendChild(renderer.domElement); |
To be completely honest, I think I somewhat arbitrarily added the I'll remove it and do some quick testing. Thank you for digging into this! |
I have a branch with what I think should fix the issue (along with some other updates) here: https://github.com/mkkellogg/GaussianSplats3D/compare/minor-updates Want to try it out to see if it works for you? |
Tested & looking good! Thank you! |
Yeah that's the plan! |
This project uses Needle Engine (a component system for three.js).
I attempted to add the gaussian splat viewer, however, something seems to be missing - the splats are rendered (I can see the corresponding draw call, but no visuals, in spector.js) but nothing shows up.
Reproduction: https://stackblitz.com/edit/three-dev-n6xvbd?file=main2.js
The text was updated successfully, but these errors were encountered: