-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Secondary Meshes from GLb disappearing based on camera movement #11131
Comments
Are you able to upload a scene that you can use to reproduce this issue? |
Thanks for the quick response @alice-i-cecile , its not an MVC but it should give the exact replication (project still super small). Notes:
|
Looks like a duplicate of #4971. The default pause is possibly not the "rest" pose of the mesh, moving the bounding box. |
@nicopap, in the last video that i recorded, i have added NoFrustrumCulling and also turned animations off, in theory by the other issue it should "mitigate" the issue, but i had no effect, the mesh still disappeared i initially had a theory that the culling algorithm was done by checking if the origin point of the mesh was hidden (which i think does not make much sense) and the ground plane was hidding it, but even with no ground plane or making the whole component on top of the plane did not change the behavior. The way it flickers makes me a little lost on trying to find the root cause. i also investigated the GLb but it seems fine too. |
After playing a little i found that the other GLb components vanish when the skeleton character is not facing (in some degree) the camera, Video.mp4 |
If you need any new information to aid fixing this issue, please let me know |
Here's a hack that might fix it (it worked on https://github.com/angelorodem/bevy_test and another project) pub fn recalculate_skinned_aabb(
inverse_bindposes: Res<Assets<SkinnedMeshInverseBindposes>>,
mut query: Query<(&Name, &SkinnedMesh, &mut Aabb), Added<Aabb>>,
) {
// HACK:
for (name, skinned_mesh, mut aabb) in query.iter_mut() {
let Some(inverse_bindposes) = inverse_bindposes.get(&skinned_mesh.inverse_bindposes) else {
continue;
};
let mut inverse_bindpose = inverse_bindposes[0]; // `0` probably won't work in all cases
// multiplying by `inverse_bindpose` seems to be the standard (https://github.com/KhronosGroup/glTF-Blender-IO/issues/1887)
aabb.center = (inverse_bindpose * aabb.center.extend(0.0)).into();
aabb.half_extents = (inverse_bindpose * aabb.half_extents.extend(0.0)).into();
}
} |
Hey @PixelDoted, I'm experiencing this exact same issue where animated entities in gltf scenes exported from Blender have incorrectly scaled / displaced AABBs within bevy causing culling issues. This seems like something the gltf loader should handle automatically? Those floating bounding boxes in space to the left of the scene come from the animated characters towards the center. If the camera orbits to the left, parts of the meshes of those characters are culled incorrectly. |
Bevy version
0.12.1
[Optional] Relevant system information
(Issue still happens on stable rust)
What you did
Spawned two entities, from two different GLb, they contain meshes, textures and animations.
There is no mesh changes, the camera code is:
extra code related to the camera just moves its transform to follow the player, and look at it.
Entity bundles:
i just
command.spawn
the entities, animate them using theAnimationPlayer
and move their transform around the scene, no other logic.What went wrong
If it's not clear, break this out into:
what were you expecting?
Skeleton helmet red mesh to behave normally
what actually happened?
Its vanishing, as the camera moves.
Additional information
Issue seems similar to this one:
Issue
But using the component NoFrustrumCulling did not have effect as indicated in the workarounds.
Video.mp4
Video.mp4
Video.mp4
The text was updated successfully, but these errors were encountered: