Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set scissor on upscale to match camera viewport #14287

Merged
merged 5 commits into from
Jul 20, 2024

Conversation

tychedelia
Copy link
Contributor

Objective

When the user renders multiple cameras to the same output texture, it can sometimes be confusing what ClearColorConfig is necessary for each camera to avoid overwriting the previous camera's output. This is particular true in cases where the user uses mixed HDR cameras, which means that their scene is being rendered to different internal textures.

Solution

When a view has a configured viewport, set the GPU scissor in the upscaling node so we don't overwrite areas that were written to by other cameras.

Testing

Ran the split_screen example.

By setting the gpu scissor on views that have a configured viewport,
we can avoid the need to set complicated clear color configs. This is
particularly helpful if the user is using mixed hdr (or msaa in the
future).
@BD103 BD103 added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jul 12, 2024
@tychedelia tychedelia mentioned this pull request Jul 12, 2024
1 task
Copy link
Contributor

@paul-hansen paul-hansen left a comment

Choose a reason for hiding this comment

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

Applying this PR as a patch to my game fixed so many split screen issues I've been having. E.g. #14389 and #14388

Thanks! Hope you keep going with it.

paul-hansen added a commit to paul-hansen/bevy that referenced this pull request Jul 19, 2024
@tychedelia tychedelia marked this pull request as ready for review July 19, 2024 16:56
@tychedelia tychedelia 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 Jul 19, 2024
@tychedelia tychedelia changed the title Improve camera clear behavior with viewports Set scissor on upscale to match camera viewport Jul 19, 2024
@mockersf mockersf added this pull request to the merge queue Jul 20, 2024
Merged via the queue into bevyengine:main with commit 3aa5258 Jul 20, 2024
27 checks passed
mmatvein pushed a commit to SomeGameCompany/bevy that referenced this pull request Aug 22, 2024
# Objective

When the user renders multiple cameras to the same output texture, it
can sometimes be confusing what `ClearColorConfig` is necessary for each
camera to avoid overwriting the previous camera's output. This is
particular true in cases where the user uses mixed HDR cameras, which
means that their scene is being rendered to different internal textures.

## Solution

When a view has a configured viewport, set the GPU scissor in the
upscaling node so we don't overwrite areas that were written to by other
cameras.

## Testing

Ran the `split_screen` example.
@BD103 BD103 added this to the 0.14.2 milestone Aug 22, 2024
mockersf pushed a commit that referenced this pull request Sep 5, 2024
# Objective

When the user renders multiple cameras to the same output texture, it
can sometimes be confusing what `ClearColorConfig` is necessary for each
camera to avoid overwriting the previous camera's output. This is
particular true in cases where the user uses mixed HDR cameras, which
means that their scene is being rendered to different internal textures.

## Solution

When a view has a configured viewport, set the GPU scissor in the
upscaling node so we don't overwrite areas that were written to by other
cameras.

## Testing

Ran the `split_screen` example.
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 C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants