UsingRenderTarget Does not work for Layer

When taking screenshots using the CreatScreenshotUsingRenderTarget, the background image with a Layer was not captured

You can do it this way:

I found another way
pseudo code:

const rtt = new BABYLON.RenderTargetTexture("screenShot", { width: engine.getRenderWidth(), height: engine.getRenderHeight() }, scene);
rtt.renderList = scene.meshes;
scene.customRenderTargets.push(rtt);

//layer set up
var layer = new BABYLON.Layer('','https://upload.wikimedia.org/wikipedia/commons/0/0e/Ski_trail_rating_symbol-green_circle.svg', scene, true);
//RTT adds renderTargetTextures to the layer
layer.renderTargetTextures.push(rtt)

Please review:

Yes, it’s also a way to handle layers in the screenshot function. But if you want to support all features (like GUI) in your screenshots, it’s simpler to use the outputRenderTarget property of an additional camera.

Okay, okay, I learned it