Concurrent CreateScreenshot Using RenderTargetAsync breaks rendering

Engine: WebGL2
Version: 8.27.0
Playground: Babylon.js Playground

Steps to reproduce: Open the playground Babylon.js Playground

Expected: CreateScreenshotUsingRenderTargetAsync does not change rendering effect.

Actual:
It only renders a small area of the left-bottom corner

Possible fix:
Change engine.getRenderWidth = originalGetRenderWidth; to delete engine.getRenderWidth and the same height, but it generates typescript errors.
Reflect.deleteProperty(engine, 'getRenderWidth'); does not trigger ts error.
Or maybe override the getRenderWidth function only before scene.render.

And the function name seems too long for discourse

cc @sebavan, but I think it’s simply not supported because we change the state of the engine when we take the screenshot. You should just wait until the first screenshot is complete before taking the second one.

1 Like

Exactly this :slight_smile:

But I can’t find anywhere in docs states that, and users would assume there is no limit on concurrent usage by default

It’s an oversight in the doc: