Screenshot and layermask problems after #13040

Hi friends,

in my project i’m using babylonjs 5.23.0 and i can’t upgrade engine to a more recent version for a problem with CreateScreenshotUsingRenderTarget function;
I think the problem cames from version 5.27.0 to current version, because of changes in #13040 Don't alter the scene's active cameras in the middle of taking a scre… by carolhmj · Pull Request #13040 · BabylonJS/Babylon.js · GitHub

I use a specific camera for screenshots (camerascreenshot) and i set layermask in meshes and cameras to handle visibility.

I made an example here:
Hitting ‘space’, the generated .png image is correct if engine 4.2.1 is loaded, not with latest engine.
Correct result image should include only “bloc.000”(layermask 0x2) and “suzanne.000”(0x1) meshes for camerascreenshot(0x3); All other meshes with layermask 0x4 there shouldn’t be.

correct screenshot from 4.2.1 engine

wrong screenshot from latest version (5.39.0)

P.S.: in PG it would be useful to be able to choose between different versions, not just the latest one…

Thanks for reporting this, I’m taking a look now.

EDIT: PR up! Add a parameter to CreateScreenshotUsingRenderTarget(Async) to allow … by carolhmj · Pull Request #13384 · BabylonJS/Babylon.js ( now it’s possible to choose if the layer mask will be taken into account or not (by default, it is)

About choosing the PG version, I remember @RaananW had plans to save previous versions on the CDN to allow for this, so it’s in the works :slight_smile:

EDIT 2 Electric Boogaloo: Merged :smiley: