You should wait for all resources to be loaded before taking the screenshot. Also, it’s best to take it after the frame has been fully rendered: use engine.onEndFrameObservable
for that:
@Evgeni_Popov Is there any possibility that the blue background can be avoided while exporting. And also, I want some good clarity image (The text on the image should be seen and readable).
I’m basically looking for taking screenshot of mesh instead of scene.
I am not sure of doing it this way. But just giving a thought - let’s pick nodes from scene by making use of gltf and export it. Anyways mesh is also a type of node only right. Correct me if i’m wrong.
You can change the scene clearColor
just before creating the screenshot if you want to use another color (or fully transparent as in the PG below).
To improve the quality, you can use the sample
parameter that enables MSAA and/or increase the size of the screenshot:
https://www.babylonjs-playground.com/#JKA0QS#3
You should also make sure the book is taking as much space as possible in the screen.
You can’t make a screenshot of a single mesh individually, the screenshot feature is making a picture of the meshes that are rendered: you can disable the meshes you don’t want in the screenshot before calling CreateScreenshotUsingRenderTarget
.
Got it. Thanks much for all your responses.