You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple MeshInstance3D nodes are in the scene using the same Mesh resource, and some but not all of the nodes have a negative scale, the nodes at one scale have their cull direction flipped. Moving the camera so that the nodes go in or out of view causes the directions to flip. Continuing to move the camera causes the nodes to repeatedly flip back and forth.
2022-02-25_19-46-22.mp4
If all nodes using the same mesh are at a negative scale, they render normally, with negative scale only mirroring the object without affecting its cull direction. The issue also does not occur on the mobile backend, only clustered.
Steps to reproduce
Create a MeshInstance3D node in the scene and add a mesh. Duplicate it a few times and scatter them around. Set the scale to -1 on an axis for half of them. Half of them will have their cull direction flipped. Move the camera around so they go in and out of view and the cull directions flip back and forth.
Calinou
changed the title
Cull direction flips as camera moves with multiple MeshInstance3Ds using the same mesh at negative and positive scales
Vulkan Clustered: Cull direction flips as camera moves with multiple MeshInstance3Ds using the same mesh at negative and positive scales
Feb 26, 2022
Negatively scaled objects should be mirrored. This is already implemented, but it breaks when mirrored and non-mirrored instances of the same object are visible together.
It turns out that the code that skips-over repeats in `RenderForwardClustered::_render_list_template` also skips the code that accounts for the culling mode of mirrored objects.
The solution here is to consider the `mirror` flag when determining repeats. This might result in more draw commands than necessary since a mirrored object can split a group of non-mirrored instances in two.
This problem doesn't appear in the mobile renderer because the repeat optimization isn't implemented there yet.
The problem still appears in MultiMeshInstance3D in *all* renderers.
Fixes#62879 and #58546.
Godot version
v4.0.alpha.custom_build [0393057]
System information
Linux (KDE Neon 5.24) w/ kisak-mesa ppa, Radeon R9 390x, amdgpu driver
Issue description
When multiple MeshInstance3D nodes are in the scene using the same Mesh resource, and some but not all of the nodes have a negative scale, the nodes at one scale have their cull direction flipped. Moving the camera so that the nodes go in or out of view causes the directions to flip. Continuing to move the camera causes the nodes to repeatedly flip back and forth.
2022-02-25_19-46-22.mp4
If all nodes using the same mesh are at a negative scale, they render normally, with negative scale only mirroring the object without affecting its cull direction. The issue also does not occur on the mobile backend, only clustered.
Steps to reproduce
Create a MeshInstance3D node in the scene and add a mesh. Duplicate it a few times and scatter them around. Set the scale to -1 on an axis for half of them. Half of them will have their cull direction flipped. Move the camera around so they go in and out of view and the cull directions flip back and forth.
Minimal reproduction project
ScaleIssue.zip
Same scene from the video.
The text was updated successfully, but these errors were encountered: