bevyengine / bevyengine/bevy

The behavior of `CameraOutputMode::Write { blend_state: None, .. }` is debatable

Open
#24,263 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version and features

main and before

## What you did

Multiple cameras output to the same render target, with default `CameraOutputMode::Write { blend_state: None, .. }`.

## What went wrong

The docs say that camera with `blend_state: None` will overwrite existing data:
https://github.com/bevyengine/bevy/blob/05ed7615632f2ced4efa394be103ec5fc543cabd/crates/bevy_camera/src/camera.rs#L819-L820

However the comment says the mode is alpha blending except the first camera:
https://github.com/bevyengine/bevy/blob/05ed7615632f2ced4efa394be103ec5fc543cabd/crates/bevy_core_pipeline/src/upscaling/mod.rs#L67-L70

I prefer to treat `blend_state: None` as disabling blend which is consistent with wgpu. Additionally we can change the default value to `ALPHA_BLENDING` to keep the behavior unchanged.

## Additional information

Posted by @beicause in https://github.com/bevyengine/bevy/pull/23422#issuecomment-4088849676:
>I think you're right from the intention of the original code. But the behavior of blend state None result in alpha blending seems a bit odd to me, at least in wgpu it means no blending.

>[tychedelia](https://github.com/tychedelia): I agree, and this relates to some of our previous discussions about multi-camera state. I would prefer if we did not have these implicit behaviors, or at least implicitly initialized some higher level configuration that controlled this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.