Replies: 2 comments 2 replies
-
|
Hi. Thanks for the report 🙏 You actually discovered a bug, the bounding box calculations are wrong in the case where you apply a global transformation and a transformation for each instance and when one affect the other. I managed to reproduce it by changing the |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@asny |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I'm using InstancedMesh with a lot of instances to render 2D images to the screen. It works really well for the most part, but I wondered if I can somehow prevent the aabb from shrinking when I scale the instanced mesh down, which is what I suspect is what resulted in the weird behavior I ran into. Maybe it is something else tho, but this is what I suspect.
So, my images are too large and I applied a Mat4::from_scale transformation to the instancedMesh. This works fine for the most part, but it seems to shrink the aabb down aswell. I inspected this and it is way lower. I guess this is what results in this behavior when I run it (note that it is completely fine when I don't scale it down):
rendering.mp4
My guess what happens is that the aabb shrinks down due to the scaling but the Mat4::from_translation that I use on the instances doesn't result in correctly updating it? Different translations for my instances result in different sizes for the aabb, but as soon as I move them a bit further from the center, they very easily stop being rendered when I move the camera.
I tried manually setting the aabb, but
instanced_mesh.aabb()seems to create a new object and doesn't let me modify the one that is actually being used for rendering.Now, it works fine again, when I instead use the scale transformation on every single instance and remove it from the instanced mesh, the aabb then seems to be fine aswell. But I would like to know if I can set this once for all of the instances, which is what InstancedMesh::set_transformation seems to be meant for, and make it work in a way that is expected.
Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions