Can albedoTexture be automatically exported in base64 format?

Good evening, new question:
I create some models using MakeHuman, import them in Blender and then export them in Babylon format.
I’d like to know if there is a way to convert automatically the texture in its base64 format when the model is exported to Babylon.
I’m asking because I found this issue base64String data · Issue #21 · BabylonJS/Editor · GitHub which had a behaviour very close to what I’d like to attain, so I wondered if there was a legit way to attain the result (if not, I’d need to convert the textures manually, no big deal, just a bit annoying).

It will probably all depends of the tool you are using. In which tool are you planning to do that ?

Right now, mostly in Blender.
I tried to search for any option in the exporter, but of course I didn’t manage to find any.
Anyway it was almost a curiosity, since I happened to see that issue in the editor that did almost what I needed, but if it requires some passages between Blender and the Babylon Editor, probably it will be easier to just convert them manually. :slight_smile:

Oh maybe @JCPalmer would have a trick for it but I guess, if not, as you mentioned converting manually or through a tiny script might be simpler.

1 Like

@sebavan Sorry to abuse of your time: do you know if it is possible to use a variable in the “base64String” of the albedoTexture?

If I use


it does work
If I do


and then, within the albedoTexture…

"base64String": brownEyes

it doesn’t.

Namely, I get a console error "Unable to load from data" and then the content of the mesh.

Since I’m converting them manually, would be easier to convert them all once and then use a reference.

Ok, I can reply to myself regarding this last point, in case someone else needs help in future.

The problem happened because I converted directly the babylon mesh in a string, like this
var mesh:string='BABYLON FILE CONTENT';
and then called
BABYLON.SceneLoader.Append("", "data:"+mesh, scene, function () {});

While this works, it creates the aforementioned problem when using variables within the mesh definition
Changing it to

var mesh:any=BABYLON FILE CONTENT; // now mesh is an object and I can use variable names within it
and then calling
BABYLON.SceneLoader.Append("", "data:"+JSON.stringify(mesh), scene, function () {});

Everything worked!

1 Like

The .babylon / JSON exporter in Blender can embed all texture types except for environment textures. It is a boolean custom property in World labeled inline. The tool tip give more info, but maybe changing it something embed as base-64 for for 3.0.3 would stand out more.

1 Like