Ensure default Gizmos start rendering the same frame they are requested (Take 2)#22964
Ensure default Gizmos start rendering the same frame they are requested (Take 2)#22964kfc35 wants to merge 7 commits intobevyengine:mainfrom
Gizmos start rendering the same frame they are requested (Take 2)#22964Conversation
| .init_resource::<GizmoStorage<Config, Swap<Fixed>>>() | ||
| // This ensures gizmos in this GizmoConfigGroup that are configured to update | ||
| // meshes in `PostUpdate` are rendered in the same frame. | ||
| .configure_sets(PostUpdate, GizmoMeshSystems.before(AssetEventSystems)) |
There was a problem hiding this comment.
first of two differences between init_group_with_mesh_sys_schedule and the former init_gizmo_group
| .in_set(bevy_app::RunFixedMainLoopSystems::AfterFixedMainLoop), | ||
| ) | ||
| .add_systems( | ||
| mesh_sys_schedule, |
There was a problem hiding this comment.
& this is the second difference
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
570e820 to
6f68625
Compare
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
1 similar comment
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
Objective
update_gizmo_meshesto run inPostUpdate) #22802PostUpdatebeforeAssetEventSystems.Solution
GizmoMeshSystems): InPostUpdatebeforeAssetEventSystems(new scheduling) or InLast(previous scheduling). Preparing the gizmos for rendering beforeAssetEventSystemsensures that that asset extractor receives an asset event message about a newly added gizmo asset within the same frame.DefaultGizmoConfigGroupuses the new schedule to ensure its gizmos can be drawn in the same frame they are requested (provided the request is beforeGizmoMeshSystemsinPostUpdate)I was unsuccessful in trying to port over Aabb, Frustum, and Light gizmos to this new schedule. If their
PostUpdatesystems were requested to run beforeGizmoMeshSystems, it would cause a cycle in thePostUpdateschedule, although the error message was completely unhelpful in this regard (there’s probably a bug in there somewhere):I was able to manually verify that Aabb would definitely have a cycle, but was unable to deduce the same for Frustum and Light gizmos. Since Aabb, Frustum, and Light gizmos work satisfactorily using the
Lastschedule without issue...Lastschedule forGizmoMeshSystems(the previous scheduling). They function just fine, it is just that they start rendering one frame later, which I presume does not matter as much since they would usually be rendering for more than one frame anyway. I added a comment about them still using theLastschedule.GizmoMeshSystemsinPostUpdatesince its gizmos are part of theDefaultGizmoConfigGroup.I’m open to hearing better names for
init_gizmo_group_delayed_renderTesting
split_screenexample toShowFrustumGizmo’s for each camera, rancargo run --example split_screen. The frustum gizmos look fine and does not lag when rotating the camera.cargo run --example debug_frustum_culling --features="free_camera”still looks good. Aabb’s correctly contain the shapes.