As the title suggest, I have just discovered the wonderful blend4web, the current project I'm working on requires me to be able to change the image on my render outside of blender.

I've been able to achieve this somewhat with babylon.js, but being the complete novice I am at javascript it's difficult to fully impliment what I want.

So basically, I have a plane for example, with a image mapped onto it, export out to blend4web, and I would now like a way to change that image via the code inside the html document, without needing to go back into Blender and change it?

Is this possible?


First, check version of blend4web:

Before 17.08:

//load modules:
var m_tex       = require("textures");
var m_scenes    = require("scenes");

//get object
var obj = m_scenes.get_object_by_name("_object_name_");

//change texture in object
m_tex.change_image(obj, "_texture_name_", "_image_URL_" );

After 17.08:

var m_scenes  = require("scenes");
var m_tex = require("textures");

var obj = m_scenes.get_object_by_name("_object_name_");
var image = new Image();
image.onload = function() {
    m_tex.replace_image(obj, "_texture_name_", image);
image.src = "_image_URL_";


_object_name_ is the name of your plane in Blender:

enter image description here

_texture_name_ is the name of texture data block in Blender:

enter image description here

_image_URL_ url of your image in web.

More information:


Live example:


  • $\begingroup$ Thanks for the quick reply! Nice to know it can be done, just need to decipher your answer and figure out how haha. $\endgroup$ – Facity Dec 12 '17 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.