How to add screenshot to a material

@yaustar Hello! I hope everything is well with you. Im using the new screenshot tutorial and trying to replicate the display screenshot on plane feature of your old project.

Did pretty much the same as your project and pass a material to the screenshot. but I cant manage to display anything to the plane.

I wonder if you can give me a hand with that please? I see that the render to texture tutorial use layer to link the buffer to. not too sure what is the best way to go.

Thanks

You should be able to add the the colorTexture to the material and use that in the world. You have to be careful about not having that material be captured in the screenshot because it will thrown an error that it’s trying to capture a texture to render on itself:

Example
https://playcanvas.com/project/991829/overview/screenshot-to-material

1 Like

Exactly what I needed! thank you so much

Mmm, image on the plane on first launch only stay for a few frames then diseapear. If I run again, it seems to stay longer on plane.

thank you for the support ! goodnight!

Looks like the screenshot code (where the capture is saved to a PNG) was causing that issue.

Removing that code seems to have fixed the issue: https://playcanvas.com/project/991829/overview/screenshot-to-material

1 Like

So managed to find the issues, I realise downloaded images where just fine event if the plane materiel was dead…

So just added an update() on the material when we recreating the buffers. That fixed the issue.