Issue when taking a screenshot with multi-cameras

I’ve created this discussion here to create an issue on GitHub to send the pull request correction.

I am working on a project that represents real industry models in a 3D environment. We use multi-cameras to represent different views of the model.

A user can add some remarks on the model as part of his work. This remark will be added to a further report together with a screenshot from the model. When the user creates that remark, an automated process rotates the camera to a better view and take a screenshot. However, that behaviour cannot be shown to the user.

In this case, I am using the method CreateScreenshotUsingRenderTarget. However, the multi-camera scene is not respecting the selected camera to do the screenshot.

I’ve used this playground to show the behaviour: Babylon.js Playground

Line 82-89 has the following method:

BABYLON.ScreenshotTools.CreateScreenshotUsingRenderTarget(
    engine,
    camera1,
    { width: engine.getRenderWidth(), height: engine.getRenderHeight() },
    (data) => {
        console.log(data);
    }
);

On line 84, I am using the camera1, that shows the “bigger” box. The result is the following screenshot:

However, the expected result should be:

The solution is pretty straightforward. I would like to validate it in order to create a issue ticket, and a pull-request.

Please go ahead and thanks a ton for your help!

1 Like

Great!

Issue #9201 and PR created.