Screenshot of scene

05 September 2016 10:51 #11614

Thanks you again for this amazing tool.

I would like to know if it's possible to make a screenshot of a generated scene ?
I have the idea to use blend4web for product configurator and could be cool to have the thumbnail in cart (instead of reloading the 3d product in it)

Programmaticaly ?
I saw it in scene viewer so thinks there is something to do…

Any idea?
05 September 2016 16:42 #11621

We have a special button for making screenshots from a scene. You can find it in tools&debug panel in the viewer.
Blend4web and that kind of thing.
05 September 2016 16:56 #11623
sorry, i will explain better.

I know that this button exist, i want to use it in a production scene, without using the viewer
I have custom javascript code on my scene, i would like to be able to make screenshot like the viewer does (programmaticaly)

Sorry for bad english.
07 September 2016 17:14 #11665
You could use the canvas_data_url method from the main module.

Then you can pass this data to a php file and use file_put_contents function to write the data string to a file.

Sorry for my bad english too.
07 September 2016 18:40 #11669
thanks for you help.

Have you got an example of canvas_data_url use? Always get undefined…
07 September 2016 22:23 #11670
First you need to register the module:
var m_main = b4w.require("main");

Then you call the method when the scene has finished loading.
08 September 2016 09:17 #11676
that's i did :
var m_main = b4w.require("main");

and with jquery later :

var dataImage=m_main.canvas_data_url(url_cb);

got undefined…. version 16.06.01
[EDIT] Same on 16.08
08 September 2016 13:59 #11686
You need to create a function callback.
Then pick the data as parameter.
08 September 2016 16:27 #11689
thanks for your help, but i'm not enough good at programming for this…..
I know what is a callback, but i'm lost here….
09 September 2016 16:18 #11714
Look at the module file (screenshooter.js):

There is a exemple of canvas_data_url usage.

You will understand it better.
Please register or log in to leave a reply.