bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Allow setting different targets for each layer of Camera

Open zaycev opened this issue 2 years ago • 2 comments

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

When rendering 2D scenes, sometimes you want to render objects placed on different layers into different targets. One example could be rendering the background and foreground into 2 separate textures and blurring background objects in post-processing. Right now this requires to setup 2 cameras and making sure that they are updated in the same way which is not very ergonomic.

What solution would you like?

Instead of having one global target per camera, allow assigning a target to render each layer.

zaycev avatar Jan 08 '23 19:01 zaycev

Example of a plugin where this would be useful for post-processing: https://github.com/zaycev/bevy-magic-light-2d

zaycev avatar Jan 08 '23 19:01 zaycev

Curious if this is doable by having two separate cameras, one a child of the other, targeting different layers. This is how I'd normally do this in Unity, and it (logically) seems like it would work in Bevy too.

james7132 avatar Mar 05 '23 13:03 james7132

Curious if this is doable by having two separate cameras, one a child of the other, targeting different layers. This is how I'd normally do this in Unity, and it (logically) seems like it would work in Bevy too.

Didn't really think about nesting one camera inside of the other in ECS hierarchy, but that might be a good workaround comparing to updating all of them manually.

zaycev avatar Mar 08 '23 19:03 zaycev