bevyengine / bevyengine/bevy

Using a raw `Camera` component is a footgun

Open
#19,299 1 comment 0 reactions 0 assignees View on GitHub
A-Rendering C-Usability D-Modest S-Needs-Design X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

I don't outright _hate_ it (as it does resolve the Camera vs Camera2d concerns), but I do have a number of sticking points that make it feel like a major downgrade to me:

1. `Camera` to me does not feel like the "film". `RenderTarget` feels like the film (although the line _is_ blurry, especially for the `hdr` field). The majority of `Camera` feels like the "camera" domain to me: selecting _what_ film to write to (render target), selecting what lenses / filters / views of the world to use (CameraRenderGraph), choosing what part of the film is exposed (viewport), choosing whether or not the aperture is open (is_active), etc. Much like a camera, you can take out the film and put it in another camera (using render targets across multiple cameras, defining the order the cameras render in).
2. `RenderSurface` feels _way_ too ambiguous with `RenderTarget`. These both read as "the thing you render to" to me. People will find this confusing.

To me, it seems like the right "conceptual framing" is for something that has `Camera` to "be a camera". `CameraRenderGraph` is a bit like configuring the lens and choosing where to point. If you have those two things _you are ready to film with your camera!_. Camera2d and Camera3d are just the stock configurations with presets you buy off the shelf.

If `Camera` was a base class, I don't think we would be having this conversation. This whole conversation seems like resistance to the "required components / inheritance by composition" idea. And that is concerning because we have been using this pattern elsewhere (ex: MaterialNode requires Node, ImageNode requires Node, etc).

The concern that people will reach for an "empty" base `Camera` (ex: missing a lens) is reasonable. But I don't think the best solve to that problem is contorting the design to make _less_ sense. I think our "camera" just needs a warning light when you try to film without a lens.

_Originally posted by @cart in https://github.com/bevyengine/bevy/issues/16248#issuecomment-2463322287_

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.