Jump to content

Is it possible to make a screenshot with options in BABYLONJS?


Borislav
 Share

Recommended Posts

Is it possible to make an in-game screenshot option with post processing effects in BABYLONJS?

For example, I press a button and 2 options appear: Focus, and brightness. And also the Finish screenshot button.  I adjust them and press the finish screenshot button and the screenshot is saved on my computer.

Link to comment
Share on other sites

Quote

 

Hi Borislav!  14 hours, no answers?  Hmmm.  Sorry for slow/no replies.

I'm not an expert... but here is a playground with godrays, and after 10 seconds, it offers screen shot view/save.  It DOES save godrays post-process (according to my picture viewer).

I have "inserted" two functions into the top of that playground.  I "borrowed" them from BJS source code.  I borrowed them because... you will need to interrupt them... if you want to make any adjustments to the image... before saving.  And I don't know IF you even CAN make adjustments to the image before viewing/saving.  Maybe others will know.

See the "do work here" alert?  Of course.  THERE... might be a good place to make some GUI with some sliders and buttons.  It could be done with our BABYLON.GUI system.

At line 83... you would remove the alert, and instead... call launchGUI() function.  Of course, you would need to program launchGUI() yourself, but there are many great examples in our cool Babylon.GUI overview doc.  By the way, I don't KNOW if line 83 area is a good place to launch your picture-adjusting GUI.  Perhaps it needs to be earlier in the process.

If you move this "stuff" to YOUR project, copy lines 1-86 from the above playground, and paste that into your project, somehow.  In lines 168-171 is where the 10-second timer and CreateScreenshot() call... happens.  Line 170 CALLS the two functions that are located in lines 1-86.  I hope you understand.

By copying these two functions from normal BABYLON source (babylon.js)... into your project., you have "overridden" the two "default" funcs (watch console to prove to yourself that you have overridden defaults.)  Doing this override... gives you the power to STOP the process in the middle (AT or near line 83)... and launch some GUI.  It gives you the power to interrupt.  :)

Anyway, I hope this helps.  Perhaps others will comment, too.  Be well, party-on.

edit:  I had an incorrect playground link, above... now fixed.  Sorry about that.

Link to comment
Share on other sites

8 hours ago, Wingnut said:

Hi Borislav!  14 hours, no answers?  Hmmm.  Sorry for slow/no replies.

I'm not an expert... but here is a playground with godrays, and after 10 seconds, it offers screen shot view/save.  It DOES save godrays post-process (according to my picture viewer).

I have "inserted" two functions into the top of that playground.  I "borrowed" them from BJS source code.  I borrowed them because... you will need to interrupt them... if you want to make any adjustments to the image... before saving.  And I don't know IF you even CAN make adjustments to the image before viewing/saving.  Maybe others will know.

See the "do work here" alert?  Of course.  THERE... might be a good place to make some GUI with some sliders and buttons.  It could be done with our BABYLON.GUI system.

At line 83... you would remove the alert, and instead... call launchGUI() function.  Of course, you would need to program launchGUI() yourself, but there are many great examples in our cool Babylon.GUI overview doc.

If you move this "stuff" to YOUR project, copy lines 1-86 from the above playground, and paste that into your project, somehow.  In lines 168-171 is where the 10-second timer and CreateScreenshot() call... happens.  Line 170 CALLS the two functions that are located in lines 1-86.  I hope you understand.

By copying these two functions from normal BABYLON source (babylon.js)... into your project., you have "overridden" the two "default" funcs (watch console to prove to yourself that you have overridden defaults.)  Doing this override... gives you the power to STOP the process in the middle (AT or near line 83)... and launch some GUI.  It gives you the power to interrupt.  :)

Anyway, I hope this helps.  Perhaps others will comment, too.  Be well, party-on.

edit:  I had an incorrect link above... now fixed.  #13 has an alert added, and #12 has none.   Both begin screenshot procedure after 10 second wait, and can be activated with a keypress or button click, instead... as wanted.

Thank you for making such a detailed explanation and playground. Thank you, now I know this is possible at least!

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