bevyengine / bevyengine/bevy

Unify `RenderLayers` and `TargetCamera` and provide a single way to configure which camera entities are rendered to

Open
#12,468 33 comments 3 reactions 0 assignees View on GitHub
A-Rendering A-UI C-Usability D-Complex
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

`TargetCamera` (UI) and `RenderLayers` (not UI) both do the same thing: control which cameras objects are rendered to.

We should have one way, that works in a consistent manner across both.

## What solution would you like?

Just use a `HashSet` of cameras in an extended `TargetCamera` component. This is simple, doesn't have an arbitrary limit and doesn't involve coordination. It can also be cleanly replaced with a custom relation.

## What alternative(s) have you considered?

Move everything over to `RenderLayers`. This may be faster: there's less lookup involved. It's also more traditional: this is how other engines have historically handled this.

Use dynamic components and queries to get a fast archetype-level filter: bespoke fragmenting relations!

## Additional context

A [new user was bitten by this today](https://discord.com/channels/691052431525675048/691052431974465548/1217672343111860295), and the behavior seems buggy, especially in mixed UI and non-UI trees. This idea came up independently in [`ui-dev` discussions](https://discord.com/channels/691052431525675048/1217481411175649340/1217516897411661925) with @aevyrie.

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.