Screenshot tool does not seem to respect camera argument?

If I use the BABYLON.Tools.CreateScreenshot function and pass it a camera which is not in the scene.activeCameras list it seems to silently ignore it and uses the active camera instead.

At least that’s what I thought and I was going to ask if perhaps we could post a warning to the console that the camera passed is not an active camera, or we could error, or return a blank screenshot or add the camera to the list of active cameras, or something else? Demo playground.

The resulting scene I see is:

The view from the camera I was hoping to take a screenshot from should be (though it actually has the UI on it as well so … :person_shrugging: ):

So I was expecting the final scene to look like this:

However if you add both cameras to the active camera list it takes a composite image of both the active cameras: https://playground.babylonjs.com/#M6HFGB#1 So again it still ignores the camera you request be used and instead uses whatever the final rendered scene is.

1 Like

Hi! I’ll look into this ASAP.

2 Likes

PR up! Force render with just that camera on CreateScreenshot by carolhmj · Pull Request #12656 · BabylonJS/Babylon.js (github.com)

2 Likes