Cameras Book Page - #2545
Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
Lots to fix, but it's a good place to start. Really need to nail the central dogma (core data flow), and then use that throughout to thread the pedagogical structure. How about big idea -> simple one camera case -> tools for working with multiple cameras -> a few worked examples of multiple camera setups?
More suggested additions:
- Clear color (really easy to footgun yourself with multiple cameras)
- Viewport-to-world / world-to-viewport + viewport node widget breadcrumb
|
i would also still like to see the section on |
cookie1170
left a comment
There was a problem hiding this comment.
i'm happy with the contents now, just a few nits from a final pass
|
|
||
| However, a `Camera` component doesn't contain enough information on it's own. | ||
| Like we mentioned above, a [`CameraRenderGraph`] component also needs to be present in order for the camera to actually produce a rendered image. | ||
| If you forget to include a `CameraRenderGraph` component, your game will emit an `error` at runtime. |
There was a problem hiding this comment.
| If you forget to include a `CameraRenderGraph` component, your game will emit an `error` at runtime. | |
| If you forget to include a `CameraRenderGraph` component, your game will emit an error at runtime. |
| } | ||
| ``` | ||
|
|
||
| A render layer is just a `bitmask` value, which means we aren't limited to only a single render layer. |
There was a problem hiding this comment.
| A render layer is just a `bitmask` value, which means we aren't limited to only a single render layer. | |
| A render layer is a bitmask value, which means we aren't limited to only a single render layer. |
| ) { | ||
| // Add all entities with a `RenderLayers` component to layer 3. | ||
| layer_query.iter_mut().for_each(|mut layers| { | ||
| layers.with(3); |
There was a problem hiding this comment.
This function doesn't modify the RenderLayers itself, instead, it consumes the value and returns a new instance
|
|
||
| If you start using multiple cameras, you can use the [`UiTargetCamera`] component to indicate a specific camera to render the UI to. | ||
| `UiTargetCamera` is a wrapper around an `Entity` id value for a `Camera` entity. | ||
| Add it to the entity containing the UI elements and your UI will be rendered to the `Camera`s [`RenderTarget`] while also respecting the `Camera`s `Viewport` and scale. |
There was a problem hiding this comment.
| Add it to the entity containing the UI elements and your UI will be rendered to the `Camera`s [`RenderTarget`] while also respecting the `Camera`s `Viewport` and scale. | |
| Add it to the entity containing the UI elements and your UI will be rendered to the `Camera`'s [`RenderTarget`] while also respecting the `Camera`'s `Viewport` and scale. |
Last "core" part of the rendering chapter, Cameras! I would appreciate some reviews on this, as information is scattered and buried for the intricacies of cameras in Bevy. I think I have a good understanding and laid out everything relevant, but let me know if I've missed anything.
I also went back and added in links to this page from the Render Pipelines page to better link them together. Might still have to expand and clarify some of the connections, but I think they currently work.