-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
InstancedMesh: Incorrect bounding volumes. #18334
Comments
With "whole instance" you mean an AABB that encloses all instances of |
@Mugen87 Yes. |
Similar to the conversation in #8953 about SkinnedMesh, I've been getting multiple issues reported on my viewer (donmccurdy/three-gltf-viewer#147) because the viewport (determined with I'm not sure that |
I think we have a design problem in the library since bounding volumes not only depend on pure geometry data. Classes like What bothers me is the fact that |
I agree -- there are cases even with just a mesh where being able to specify the bounding volume per-object rather than per-geometry would be beneficial. Materials can change the apparent bounds of geometry, as well, with custom vertex shaders, instancing, and displacement maps (which I also think don't work correctly at the moment). I still think it's valuable to store the bounding volume on the geometry, though, to share the volume instances. Maybe the responsibility of checking for frustum intersection should shift to the objects? Should the Mesh class define an Mesh.prototype.intersectsFrustum = function ( frustum ) {
var geometry = this.geometry;
var box = this.boundingBox || geometry.boundingBox;
return frustum.intersectsBox( box );
} This would allow a bounding box to optionally be set on the Mesh to account for cases where the material changes the visual bounds of the shape. Of course raycasting would also have to be updated to support custom intersections if desired but that's already override-able. |
I'm not sure about the best design right now. This needs some experimenting and studying. I think it's also worth to check how other engines solve this issue. |
Actually,I do some tries about InstancedMesh's boudingBox and boundingSpere. In my program,I make two bounding that one represents geometry data and other represents the mesh's real volume. I use mesh's real volume to render sort ,which make transparent rendering isn‘t right in some cases. I think maybe the method of sorting return Z should also be encapsulated under the subclass of mesh, such as instancedmesh, to make correct calculation and sorting according to different situations. These are just some of my thoughts,I hope useful. |
I can appreciate that. I do think it's worth noting that the design pattern chosen for Edit: |
As a (temporary?) workaround I changed |
Should the same temporary fix be done for Also I do hope this is just temporary and that we can come up with a better solution for frustum culling and raycasting in these cases. |
|
Closed via #25591. |
This is still a problem for skinned mesh, correct? |
Geometry bounding box gives a somewhat misleading result when used in an InstancedMesh.
Using new Box3().setFromObject(mesh) only gives you the Box3 for the single geometry, and not for the whole instance.
The text was updated successfully, but these errors were encountered: