bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.03k stars 3.44k forks source link

SMAA looks extreme in split screen on non-top level viewports #14197

Open paul-hansen opened 2 months ago

paul-hansen commented 2 months ago

Bevy version

0.14.0

The release number or commit hash of the version you're using. b231ebbc195e12ae47616748e532c8dbc24218dd (branch release-0.14.0, also tried with crates.io version)

System information

Archi Linux (EndeavorOS) DE: KDE Plasma

AdapterInfo { name: "NVIDIA GeForce RTX 3080", vendor: 4318, device: 8726, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "555.58", backend: Vulkan }

What you did

I added the SmaaSettings to the cameras in my split screen game.

        SmaaSettings {
            preset: SmaaPreset::High,
        },

What went wrong

I was expecting SMAA to look the same on every camera but instead it looked stronger on the additional cameras.

Additional information

I was able to replicate this on the Bevy split_screen example: image

You can see it on the UI buttons the most.

I believe this is caused by the effect writing outside the camera's viewport causing a multiplying effect with the camera's layered on top of each other. Restricting it to the camera's viewport somehow would probably solve this.

If we get this solved, we should update the post_processing example too as it suffers from the same problem. It's not going to be obvious in that example, but it's used as an example for creating other fullscreen effects. I used it to create a film grain noise effect and it has the same problem of the noise being multiplied from other cameras depending on the order. Here's an example of it happening with my noise shader in case it helps make sense of the problem. The camera order decreases starting from the top left, so the effect is more pronounced on later cameras because, I assume, the previous camera's effect is rendered on top of them: image

paul-hansen commented 1 month ago

Might have been fixed in https://github.com/bevyengine/bevy/pull/14287 I need to test this one again though