Skip to content

Break dependency from bevy_anti_alias on bevy_post_process by splitting PostProcess set#23098

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
Zeophlite:aa-no-pp
Mar 18, 2026
Merged

Break dependency from bevy_anti_alias on bevy_post_process by splitting PostProcess set#23098
alice-i-cecile merged 1 commit intobevyengine:mainfrom
Zeophlite:aa-no-pp

Conversation

@Zeophlite
Copy link
Copy Markdown
Contributor

@Zeophlite Zeophlite commented Feb 21, 2026

Objective

Solution

  • Split PostProcess set into EarlyPostProcess and PostProcess sets
  • Move taa and dlss into EarlyPostProcess
aa-no-pp

Testing

  • CI
  • cargo run --example anti_aliasing

@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-23098

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
@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-23098

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.

@Zeophlite Zeophlite added A-Rendering Drawing game state to the screen D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 21, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Feb 21, 2026
Copy link
Copy Markdown
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the naming of the new sets needs some more thinking. Taa running in PostProcess doesnt make sense. How about
EarlyPostProcess
AntiAlias
PostProcess

So the anti aliasing actually runs in the AntiAlias set?

@atlv24
Copy link
Copy Markdown
Contributor

atlv24 commented Feb 22, 2026

the anti aliasing example crashes on a dependency cycle:

thread '<unnamed>' (8214412) panicked at crates/bevy_ecs/src/schedule/schedule.rs:536:13:
Error when initializing schedule Core3d: schedule has 0 before/after cycle(s):

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_core_pipeline::schedule::camera_driver`!
Encountered a panic in system `bevy_render::renderer::render_system`!
Encountered a panic in system `bevy_render::run_render_schedule`!

@Zeophlite Zeophlite force-pushed the aa-no-pp branch 2 times, most recently from f47c8c1 to 78937aa Compare February 22, 2026 14:28
@Zeophlite
Copy link
Copy Markdown
Contributor Author

Definitely made a mistake with the ordering, anti_aliasing example worked

Copy link
Copy Markdown
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably put the rest of the anti aliasing solutions into the AntiAlias set

Comment thread crates/bevy_core_pipeline/src/schedule.rs Outdated
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 23, 2026
@alice-i-cecile alice-i-cecile changed the title bevy_anti_alias doesn't depend on bevy_post_process Break dependency from bevy_anti_alias on bevy_post_process Feb 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-23098

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.

@Zeophlite
Copy link
Copy Markdown
Contributor Author

Hmm, TAA flickers with anti_aliasing example now :(

In crates/bevy_anti_alias/src/taa/taa.wgsl there's

// TAA is ideally applied after tonemapping, but before post processing
// Post processing wants to go before tonemapping, which conflicts
// Solution: Put TAA before tonemapping, tonemap TAA input, apply TAA, invert-tonemap TAA output

I think this might be a little more complicated to complete

@Zeophlite Zeophlite added S-Needs-Help The author needs help finishing this PR. and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Feb 24, 2026
@Zeophlite Zeophlite added this to the 0.19 milestone Feb 25, 2026
@Zeophlite
Copy link
Copy Markdown
Contributor Author

Hmm, TAA flickers with anti_aliasing example now :(

In crates/bevy_anti_alias/src/taa/taa.wgsl there's

// TAA is ideally applied after tonemapping, but before post processing
// Post processing wants to go before tonemapping, which conflicts
// Solution: Put TAA before tonemapping, tonemap TAA input, apply TAA, invert-tonemap TAA output

I think this might be a little more complicated to complete

This is resolved my merging main

@Zeophlite Zeophlite added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Needs-Help The author needs help finishing this PR. labels Mar 3, 2026
Copy link
Copy Markdown
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the explicit AntiAlias step. Can you update the PR description and title?

@Zeophlite Zeophlite changed the title Break dependency from bevy_anti_alias on bevy_post_process Break dependency from bevy_anti_alias on bevy_post_process by splitting PostProcess ser Mar 3, 2026
@Zeophlite Zeophlite changed the title Break dependency from bevy_anti_alias on bevy_post_process by splitting PostProcess ser Break dependency from bevy_anti_alias on bevy_post_process by splitting PostProcess set Mar 3, 2026
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just have some questions about the ordering of the systems that seem to have changed, but also I’m not too familiar with rendering so if I’m asking about dumb things (or worse, I’m incapable of reading system ordering 🙈 ), feel free to disregard

Comment thread crates/bevy_anti_alias/src/dlss/mod.rs
Comment thread crates/bevy_anti_alias/src/taa/mod.rs
Comment thread crates/bevy_post_process/src/motion_blur/mod.rs
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 14, 2026
@Zeophlite
Copy link
Copy Markdown
Contributor Author

@kfc35 Thanks for your review, this has made me check this PR from first principles.

My read of the relevant systems is as follows:

aa-no-pp
  • blue are bevy_anti_alias
  • red are bevy_post_process
  • grey are bevy_core_pipelines (which is the common ancestor)

The goal is to remove blue/red edges (all others are fine).

Therefore, we only really need two sets, EarlyPostProcess which has taa and dlss , and PostProcess which is the rest.

Graph generation

digraph G {

  // bevy_anti_alias = blue
  cas [color=blue];
  dlss [color=blue];
  fxaa [color=blue];
  smaa [color=blue];
  taa [color=blue];

  // bevy_post_process = red
  bloom [color=red];
  motion_blur [color=red];

  // other = grey
  tonemapping [color=grey];


  fxaa -> cas;         // crates/bevy_anti_alias/src/contrast_adaptive_sharpening/mod.rs
  dlss -> bloom;       // crates/bevy_anti_alias/src/dlss/mod.rs
  tonemapping -> fxaa  // crates/bevy_anti_alias/src/fxaa/mod.rs
  tonemapping -> smaa; // crates/bevy_anti_alias/src/smaa/mod.rs
  taa -> motion_blur;  // crates/bevy_anti_alias/src/taa/mod.rs
  taa -> bloom;        // crates/bevy_anti_alias/src/taa/mod.rs

  bloom -> tonemapping; // crates/bevy_post_process/src/bloom/mod.rs
  motion_blur -> bloom; // crates/bevy_post_process/src/motion_blur/mod.rs
}

@Zeophlite Zeophlite marked this pull request as draft March 17, 2026 03:41
@Zeophlite Zeophlite force-pushed the aa-no-pp branch 2 times, most recently from 354e44f to 927e0d5 Compare March 17, 2026 03:53
@Zeophlite Zeophlite added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Mar 17, 2026
@Zeophlite Zeophlite marked this pull request as ready for review March 17, 2026 03:54
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this looks great! Thanks for making the graph; I should keep https://graph.flyte.org/ handy too. This just motivates me to start thinking about automatic schedule visualizations for bevy systems...

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 17, 2026
Copy link
Copy Markdown
Member

@tychedelia tychedelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice investigation, thanks.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 18, 2026
Merged via the queue into bevyengine:main with commit c36ea11 Mar 18, 2026
44 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Mar 18, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Mar 29, 2026
# Objective

Fixes #23472 (and a similar issue for wireframes)

When `EarlyPostProcess` was created in #23098, some existing systems
that were scheduled between `MainPass` and `PostProcess` weren't
updated. This caused them to race with TAA, which causes flickering and
other artifacts.

## Solution

Order them relative to `EarlyPostProcess` instead.

## Testing

`cargo run --example scrolling_fog`  for volumetric fog.

For wireframes you can see flickering on main if you add TAA to
`wireframe.rs`:
```diff
index 74376ab..4ac71fcdc 100644
--- a/examples/3d/wireframe.rs
+++ b/examples/3d/wireframe.rs
@@ -114,6 +114,8 @@ fn setup(
     commands.spawn((
         Camera3d::default(),
         Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
+        Msaa::Off,
+        TemporalAntiAliasing::default(),
     ));
```
splo pushed a commit to splo/bevy that referenced this pull request Mar 31, 2026
…itting `PostProcess` set (bevyengine#23098)

# Objective

- During bevyengine#22144 , we slightly
linearlised the crate build, by explicit dependency on system ordering.
[See this
comment](https://github.com/bevyengine/bevy/pull/22144/changes#r2697878715)

## Solution

- Split `PostProcess` set into `EarlyPostProcess` and `PostProcess` sets
- Move `taa` and `dlss` into `EarlyPostProcess`

<img width="309" height="539" alt="aa-no-pp"
src="https://github.com/user-attachments/assets/bb32b71a-4743-46e4-ad2c-f06ef7db854f"
/>

## Testing

- CI
- `cargo run --example anti_aliasing`
splo pushed a commit to splo/bevy that referenced this pull request Mar 31, 2026
# Objective

Fixes bevyengine#23472 (and a similar issue for wireframes)

When `EarlyPostProcess` was created in bevyengine#23098, some existing systems
that were scheduled between `MainPass` and `PostProcess` weren't
updated. This caused them to race with TAA, which causes flickering and
other artifacts.

## Solution

Order them relative to `EarlyPostProcess` instead.

## Testing

`cargo run --example scrolling_fog`  for volumetric fog.

For wireframes you can see flickering on main if you add TAA to
`wireframe.rs`:
```diff
index 74376ab..4ac71fcdc 100644
--- a/examples/3d/wireframe.rs
+++ b/examples/3d/wireframe.rs
@@ -114,6 +114,8 @@ fn setup(
     commands.spawn((
         Camera3d::default(),
         Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
+        Msaa::Off,
+        TemporalAntiAliasing::default(),
     ));
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants