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

BatchedMesh does not accurately compute bounding box when instancing geometry #29242

Closed
gfodor opened this issue Aug 27, 2024 · 1 comment
Closed
Milestone

Comments

@gfodor
Copy link
Contributor

gfodor commented Aug 27, 2024

Description

There seems to be an obvious bug in BatchedMesh#computeBoundingBox. The routine BatchedMesh#computeBoundingSphere routine properly sets the for loop bounds to be 0 to drawInfo.length, but the BatchedMesh#computeBoundingBox routine sets the loop bounds to be 0 to geometryCount, which cuts the loop short if you have multiple instances of the same geometry.

https://github.com/mrdoob/three.js/blob/dev/src/objects/BatchedMesh.js#L308

The net result is you get an inaccurate bounding box if you instance the same geometry more than once in a batched mesh.

Reproduction steps

  1. Add several instances of the same geometry to a batched mesh, at different transforms
  2. Compute the bounding box
  3. Notice the box is wrong

Code

No code or example, bug seems clear.

Live example

No code or example, bug seems clear.

Screenshots

No response

Version

r167

Device

No response

Browser

No response

OS

No response

@gfodor
Copy link
Contributor Author

gfodor commented Aug 27, 2024

#29243

@mrdoob mrdoob closed this as completed Aug 28, 2024
@Mugen87 Mugen87 added this to the r169 milestone Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants