Pascal Bayer Posted June 29, 2018 Share Posted June 29, 2018 I'm currently facing a strange behavior of the CreateScreenshotUsingRenderTarget and not sure if that is on purpose or a bug. I want to create an image (rendering screenshot) that contains all meshes of the scene, however I have two cameras, one for rendering the viewport (only part of the overall scene) and one for the screenshot rendering (covers the whole scene). The PNG file rendered has the correct size but does only contain meshes that are visible (or partially visible) for the active viewport camera, all other meshes are missing. Is there a way to workaround or fix this behavior? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 29, 2018 Share Posted June 29, 2018 One workaround is : mesh.alwaysSelectAsActiveMesh = true; Here's a PG I made testing that on GUI. https://www.babylonjs-playground.com/#HJI09Z#1 If that kills performance too much, you can try enabling and disabling on all meshes before/after screenshot. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 29, 2018 Share Posted June 29, 2018 This is an "expected" behavior as the main camera defines the active meshes. @brianzinn solution is fine Quote Link to comment Share on other sites More sharing options...
Pascal Bayer Posted June 29, 2018 Author Share Posted June 29, 2018 @brianzinn Thanks for the solution, got it working after figuring out that I have to set `alwaysSelectedAsActiveMesh` not only on the parent mesh but also on all child meshes. @Deltakosh Thanks for clarification, might be worth to be added to the docs: https://doc.babylonjs.com/how_to/render_scene_on_a_png Quote Link to comment Share on other sites More sharing options...
Guest Posted June 29, 2018 Share Posted June 29, 2018 You are right, do you want to contribute? Quote Link to comment Share on other sites More sharing options...
Pascal Bayer Posted July 2, 2018 Author Share Posted July 2, 2018 @Deltakosh I've submitted the following PR: https://github.com/BabylonJS/Documentation/pull/1105 Quote Link to comment Share on other sites More sharing options...
Guest Posted July 2, 2018 Share Posted July 2, 2018 And it is merged! THanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.