5

I'd like to create a portal-like effect using Bevy. It seems Unity has a render texture to achieve that.

Is there a way to do the equivalent in Bevy? If not, is there a plan to support that in the future?

whale9490
  • 67
  • 5
  • Do you mean something like that: https://mrk.sed.pl/bevy-showcase/#render_to_texture – frankenapps Mar 08 '21 at 13:09
  • @frankenapps Thank you for the comment. I think I need the ability to render what a camera sees to a texture. I don't know if the example (your link) is doing so... do you have any idea how it's created (or any source code)? – whale9490 Mar 08 '21 at 16:59
  • The code for the posted sample can be found here: https://github.com/mrk-its/bevy/blob/render_to_texture/examples/3d/render_to_texture.rs If you want to render the camera viewport to a texture you can find some information here: https://github.com/bevyengine/bevy/issues/1207 It seems to more or less work for jpg files as of now: https://github.com/rmsc/bevy/blob/render_to_file/examples/3d/render_to_file.rs – frankenapps Mar 08 '21 at 17:13
  • @frankenapps Ohhh.. thank you! I will check it out. – whale9490 Mar 08 '21 at 17:22

1 Answers1

3

This has become very easy with Bevy 0.8's Camera Driven Rendering

You simply assign an image render target to a camera:

camera.target = RenderTarget::Image(image_handle);

For a complete example see the official render to texture example.

Maccesch
  • 1,998
  • 1
  • 18
  • 27