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.
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.
@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
"base64String":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="
it does work
If I do
var brownEyes="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="
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.
Thanks
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!