bevy/release-content/migration-guides/camera_restructure.md
Emerson Coskey 7ab00ca185
Split Camera.hdr out into a new component (#18873)
# Objective

- Simplify `Camera` initialization
- allow effects to require HDR

## Solution

- Split out `Camera.hdr` into a marker `Hdr` component

## Testing

- ran `bloom_3d` example

---

## Showcase

```rs
// before
commands.spawn((
  Camera3d
  Camera {
    hdr: true
    ..Default::default()
  }
))

// after
commands.spawn((Camera3d, Hdr));

// other rendering components can require that the camera enables hdr!
// currently implemented for Bloom, AutoExposure, and Atmosphere.
#[require(Hdr)]
pub struct Bloom;
```
2025-05-26 19:24:45 +00:00

13 lines
514 B
Markdown

---
title: Camera Restructure
pull_requests: [18873]
---
As part of the rendering crate reorganization, we've been working to simplify Bevy `Camera`s:
- `Camera.hdr` has been split out into a new marker component, `Hdr`
- before: `commands.spawn((Camera3d, Camera { hdr: true, ..default() });`
- after: `commands.spawn((Camera3d, Hdr));`
- rendering effects can now `#[require(Hdr)]` if they only function with an HDR camera.
This is currently implemented for `Bloom`, `AutoExposure`, and `Atmosphere`