Jump to content

Uses of CreateScreenshot


JohnK
 Share

Recommended Posts

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.

 

 

Link to comment
Share on other sites

@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.

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...