Skip to content

Clarify that a Camera without RenderLayers only renders RenderLayers::layer(0) #18874

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

Open
FrTerstappen opened this issue Apr 18, 2025 · 0 comments
Labels
A-Rendering Drawing game state to the screen C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@FrTerstappen
Copy link

How can Bevy's documentation be improved?

The documentation of RenderLayers in

/// Describes which rendering layers an entity belongs to.
///
/// Cameras with this component will only render entities with intersecting
/// layers.
///
/// Entities may belong to one or more layers, or no layer at all.
///
/// The [`Default`] instance of `RenderLayers` contains layer `0`, the first layer.
///
/// An entity with this component without any layers is invisible.
///
/// Entities without this component belong to layer `0`.
contains the following part:

/// Cameras with this component will only render entities with intersecting
/// layers.

This lead me to assume that a camera without this component renders entities without regard to the layer they belong to. This does not work as a camera without RenderLayers only renders entities belonging to RenderLayers::layer(0).

This can be seen in

let view_mask = maybe_view_mask.unwrap_or_default();
where a missing RenderLayers is replaced with the default.

While it could be argued that the line

/// Entities without this component belong to layer `0`. 

also applies to the camera this was not clear to me.

I propose expanding the camera related section of the docs to something like this:

/// Cameras with this component will only render entities with intersecting
/// layers.
/// Cameras without this component will only render entities belonging to the default render layer (RenderLayers::layer(0)).

A further improvement would be to describe how to create a camera that renders all layers (if that is even possible).
I currently create a RenderLayers component containing all layers I use.
This feels like a workaround and is error prone because I have to remember to add new layers.

@FrTerstappen FrTerstappen added C-Docs An addition or correction to our documentation S-Needs-Triage This issue needs to be labelled labels Apr 18, 2025
@janhohenheim janhohenheim added D-Trivial Nice and easy! A great choice to get started with Bevy A-Rendering Drawing game state to the screen S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! and removed S-Needs-Triage This issue needs to be labelled labels Apr 23, 2025
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-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

2 participants