Is there a way to capture camera view into a texture file to show in a UI Panel?

Right now I’m working in a app that once you finishes the game it should “take a picture” of my level and store somewhere to show in an album menu.

In Unreal Engine all i had to do is to use Render Targets assets with Scene Capture Components to save everything this camera saw and convert it to bytes then to texture asset to be able to store it in a array for future uses.

Does playcanvas have something like this or should I adapt this idea to get a pre rendered image asset instead taking a picture in game?

Hi @MuriloCamargo,

That’s definitely doable! What you are looking for is to render your camera view to a render target, instead on the main colorbuffer.

You can take a look at the take a screenshot example, and instead of downloading the render target texture, us it on an UI element like this:

this.entity.element.texture = this.renderTarget.colorBuffer;

https://developer.playcanvas.com/en/tutorials/capturing-a-screenshot/

2 Likes

Awesome! I will check it now!

1 Like

There’s also Render 3D World to UI | Learn PlayCanvas which shows how to render the world into a UI element

1 Like