Skip to content

Configurable camera color target size and format#24280

Open
beicause wants to merge 11 commits into
bevyengine:mainfrom
beicause:configurable-camera-color-target
Open

Configurable camera color target size and format#24280
beicause wants to merge 11 commits into
bevyengine:mainfrom
beicause:configurable-camera-color-target

Conversation

@beicause
Copy link
Copy Markdown
Member

@beicause beicause commented May 13, 2026

Objective

Remake #22637. Fixes #21530. This makes texture size, format and whether the main texture is shared by multiple cameras configurable.

Solution

  1. To get consistent rendering results on any main texture size (with only the resolution differing), by default the size of main texture is changed to viewport size instead of render target size. MainPassResolutionOverride should be still supported.
  2. To make sharing textures among multiple cameras explicit, cameras use a relationship to point to the ColorTarget (which is a subset of texture descriptor) they use (which can point to itself). Each ColorTarget will be extracted and produce a ColorTargetTextures for ViewTarget
  3. For camera that owns a main texture, I also added CameraColorTarget for compatibility with existing Msaa and Hdr and allows the size to be set with a factor relative to the viewport size.
  4. The info about main texture per camera is moved from ExtractedCamera/ExtractedView to a new ViewTargetInfo componet.

What this PR doesn't include and can be follow-ups:

  1. Split Hdr into two: one for setting Rgba16Float for some rendering features and one for controlling tonemap in shader or tonemap in post-processing.
  2. Allow configuring the texture view format used by camera. Currently the texture view is always the default view.

Testing

Tested split_screen, bloom_3d with some CameraColorTarget settings.

Showcase

anti_aliasing example now has a resolution settings:

Details 屏幕截图_20260513_201601 屏幕截图_20260513_201613 屏幕截图_20260513_201544

Generally only 3D content should be scaled and UI shouldn't be affected but currently users may be able to render the UI to a fixed-resolution texture themselves.

@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-24280

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.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen X-Contentious There are nontrivial implications that should be thought through D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 13, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering May 13, 2026
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-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Contentious There are nontrivial implications that should be thought through

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Support resolution scaling and configuring main texture size of Camera

2 participants