Sprite and Screenshot Using Render Target

Hello !

I’m trying to take a screenshot with a sprite created with a dynamicTexture containing some text.
Also in my app I use the CreateScreenshotUsingRenderTarget function.

However when I take my screenshot the sprite isn’t displayed and I don’t know what to change to display it without changing my screenshot function.

Here’s a playground that takes a screenshot when we click on the GUI Button :
https://www.babylonjs-playground.com/#3GPEIL#16

Thanks for helping

For the time being, the CreateScreenshotUsingRenderTarget function does not allow to render sprites into the RTT (the renderSprites property of the RTT is false by default and you can’t change it).

Will do a PR about this, but if it works for you you can use CreateScreenshot instead, that does work (as it takes a copy of the current canvas for the screenshot).

1 Like

PR here:

Not sure that it will be in 4.1, however, as the release data is less than two weeks from now.

@Evgeni_Popov Thanks a lot, well I will do a patch inside my project until the new release.

@Evgeni_Popov, as the parameter is not inside the Async function I added it in the following PR :

Ah yes, good catch!

All merged
Thanks team!!!

2 Likes

This may be a slightly broader issue with EffectRenderer: https://playground.babylonjs.com/#ZLB7Z2#7

You must allow rendering sprites in the RTT, see line 71:

https://playground.babylonjs.com/#ZLB7Z2#8

Or rather, in the correct RenderTargetTexture. :roll_eyes:

False alarm. Carry on, my friends…