JohnK Posted November 24, 2017 Share Posted November 24, 2017 On updating the page on Rendering with CreateScreenshot to PNG I came across two facilities that I could not get to work as stated and so have not repeated them in the edit. The first is Another cool aspect of using this feature is that you can use a non-active camera to create the screenshot, so you can produce many screenshots, without switching cameras! I can only capture the canvas screen shown by the active camera. The second is an implication that you can produce a screen shot giving a different aspect ratio than that displayed by browser. If you need a square screenshot (ratio 1:1) simply use this: size = number;. If you want to have a custom width and height (like 600x400), use this format: size = { width: 600, height: 400}; If you provide only one parameter within those braces, BabylonJS will compute the missing dimension... and maintain canvas aspect ratio. The best I can do is get an image of the given size with a correct aspect ratio of the canvas in the center of this image. Perhaps I am misunderstanding something or perhaps it is that my graphics card is not capable enough. If anybody can provide an example of the above two features working as stated I will amend the documentation to add these back in. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Kesshi Posted November 24, 2017 Share Posted November 24, 2017 The way CreateScreenshot is working has changed internally. I think this tutorial was not updated. If you want the old behaviour, you have to use CreateScreenshotUsingRenderTarget. JohnK 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 24, 2017 Author Share Posted November 24, 2017 @Kesshi have tried but the only image that is created just contains the background color of the canvas not any meshes on the canvas. PG is https://www.babylonjs-playground.com/#IDCCE7 This is true in FF, Chrome and Edge. Graphics for my laptop are from Intel(R) HD Graphics Family. Driver 20.19.15.4642 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted November 24, 2017 Share Posted November 24, 2017 8 hours ago, JohnK said: I can only capture the canvas screen shown by the active camera. Here is a PG I made that screen captures from non-active camera to GUI. Note: meshes not rendered by active camera need to have alwaysSelectAsActiveMesh = true.https://www.babylonjs-playground.com/#HJI09Z#2 Arte 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 24, 2017 Author Share Posted November 24, 2017 @brianzinn thank you that helped. Having read your PG I have now worked out that using CreateScreenshotUsingRenderTarget cannot be used before giving time for a frame to be rendered. so this PG https://www.babylonjs-playground.com/#IDCCE7#1 works. Will start to work on examples using this knowledge. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 24, 2017 Share Posted November 24, 2017 @JohnK I added information on the github issue. JohnK 1 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.