Skip to content
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

GLTFLoader: Provide geometry.boundingBox and geometry.boundingSphere #17937

Closed
donmccurdy opened this issue Nov 15, 2019 · 3 comments · Fixed by #17939
Closed

GLTFLoader: Provide geometry.boundingBox and geometry.boundingSphere #17937

donmccurdy opened this issue Nov 15, 2019 · 3 comments · Fixed by #17939

Comments

@donmccurdy
Copy link
Collaborator

(from discussion with @zeux)

A glTF file contains min/max bounds on mesh vertices. We should use those to set .boundingBox and .boundingSphere, so that computeBoundingBox() and computeBoundingSphere() can be optimized out.

@zeux
Copy link
Contributor

zeux commented Nov 15, 2019

I’ll take a closer look and provide further details - from memory when I looked at this before this seemed to require core changes but I may be wrong.

@zeux
Copy link
Contributor

zeux commented Nov 16, 2019

Submitted #17939 to fix this - this eliminates the guaranteed attempt to compute bounding sphere during rendering of glTF scenes on the first frame after load. Also submitted #17940 - this isn't directly related but this is why I thought that this needs core changes - my viewer demo application computed bbox of the entire scene to position the camera, and that goes through a path that always looks at each vertex and doesn't respect morph targets.

After both of these changes there's no per-vertex CPU impact during glTF load other than uploading the WebGL buffer and normalizing skin weights (which is skipped when they are quantized with gltfpack...). Saves 30-100ms on moderately complex models, and hundreds of msec on multi-million triangle models.

Courtesy of Air France (long flights are long).

@donmccurdy
Copy link
Collaborator Author

Thanks @zeux and Air France! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants