dynamic texture loading

14 November 2014 12:41

I´m playing around with your great framework and now search a way to change the texture of an object (plane) dynamicaly after export just in javascript.. Is there aa way to use images that where not introduced to blender as a texture? let´s say a just take images from a local folder or from a remote server and change the texture on the plane evey minute?

I can access the exported objects texture filename and path like so:

var obj = m_scenes.pick_object(x, y);
var texture_filenam =[0].texture_slots[0]
var texture_filepath =[0].texture_slots[0].texture.image.filepath

but if I try to set them, nothing changes.
Is there an Api call I missed, or do you have any other idea how to handle this?
many thanks in advance,

14 November 2014 14:55
Hi b0,

For now the only possibility to use texture from outside exported scene is to dynamically load another exported json (for example material library) and inherit material from some object.

It's not really comfortable way so in 14.11 we'll introduce canvas textures which will perfectly suit your needs. They are used for dynamic images/videos/GIFs upload. It will be possible to even type some text on top of them from API.

So it's better to wait till the end of this month I think.
14 November 2014 17:33
Thank you very much for the quick response.
It sounds very promising and I´m looking forward to the new release.
In the meantime I will stick with good old three.js.
Or maybe you need a beta tester ? :)

cheers b0
14 November 2014 19:48

We'll prepare a pre-release SDK version after weekend for everyone who wants this brand new feature now
The Founder | Twitter
15 November 2014 00:55
That would be to good to be true :)
Many props for this kind of responsiveness!!
17 November 2014 18:52
14.11 Developer Preview build is now available for registered Blend4Web developers. Enjoy!
The Founder | Twitter
18 November 2014 05:03
Damn! That´s absolutely amazing! That´s exactly what I needed.
It took me a while to realize that you even added a new example that explains everything perfectly,
(called "canvas_texture" for everybody else looking into this)
but this way I learnd a bit more about your code structure.
Thank you very much for this quick response.
I´m a big fan of yours :)

Cheers b0
18 November 2014 08:41
Yeah, forgot to specify the new API and the example . Glad you have successfully found it! BTW the camera panning feature and Blender-friendly video textures are on the way.
The Founder | Twitter
18 September 2015 19:21
mi question is i can load texture in material nodes with code javascript?
21 September 2015 10:23

You can use canvas textures in node materials as well. It will look similarly to what we have in this code snippet.
Please register or log in to leave a reply.