bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Mix of HDR and non-HDR cameras breaks rendering

Open djeedai opened this issue 3 years ago • 7 comments

Bevy version

0.9 and main

Relevant system information

AdapterInfo { name: "NVIDIA GeForce RTX 2070", vendor: 4318, device: 7938, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "517.48", backend: Vulkan }

What you did

Change the split_screen.rs example to add hdr: true on one camera but not the other (doesn't matter which one).

What went wrong

Background becomes black, default clear color (grey) not applied anymore. I both cases (whether hdr is set on left or right), only the right camera shows something.

image

Testing this on another 4-camera 🎆 Hanabi example, where things animate, I can confirm clearing doesn't work (all particles render on the previous frame) and the HDR camera stops rendering:

image

Although the latter could be a bug in 🎆 Hanabi, the similarity of artifacts might help diagnosing the issue.

Additional information

I'm guessing the cameras have incompatible render target, and there's no "smart" resolution applying tonemapping only to HDR ones.

It's unclear if this is supposed to work in the first place but logged as bug because @superdump said it should "maybe" be supported.

djeedai avatar Nov 25 '22 18:11 djeedai

There are two problems:

  • The upscaling render pass unconditionally clears the RenderPassColorAttachment
  • The UpscalingPipeline RenderPipelineDescriptor configures None for the colour attachment's blend state

If I instead unconditionally load the colour attachment texture, and alpha blend it, then the desired result is produced. I think the following should be done as a proper solution:

  • Clear the out texture only for the initial upscale into it, otherwise load it (or make this configurable)
  • Use alpha blending for composing one camera on top of another - not sure whether other options make more sense?

superdump avatar Nov 28 '22 16:11 superdump

Think I found the same issue.

I'll copy paste my question from Discord:

image

torsteingrindvik avatar Mar 11 '23 19:03 torsteingrindvik

https://github.com/bevyengine/bevy/pull/10325 should let us implement a proper fix for this now

JMS55 avatar Jan 08 '24 01:01 JMS55

We don't need clear_color: ClearColorConfig::None in the split screen example anymore.

JMS55 avatar Jan 26 '24 21:01 JMS55

Also happening on 0.13.1. Here's a minimal example that replicates it.

Tested on M1: AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

migimunz avatar Apr 03 '24 14:04 migimunz

I'd like to tackle this tomorrow if no one is already working on it.

tychedelia avatar May 17 '24 04:05 tychedelia

No one else is working on it, feel free to.

JMS55 avatar May 17 '24 06:05 JMS55