Exporting from Blender to Sandbox

Hi!
I’m currently making some 3D assets in Blender, and I have to export them to the Sandbox, change some parameters and save them in .babylon format.
I’m able to import them to the Sandbox using .glb format, but after the import in the Nodes i can see that my mesh has been divided in multiple meshes, one for every material I used, and a TransformNode class is automatically made as a Parent object for the meshes.
I want that every object in the scene is a Mesh class object, how can i prevent the spawn of the TransformNode class object for the assets that use more than one material in a single mesh?

The glTF / glb format does not support multiple materials per mesh that I am aware. The only way i know would be to somehow to bake all the materials into one texture. If one of the materials combined has different metallic or roughness values, only one can be chosen, since those are not bake-able.

1 Like

What about .babylon format, is able to support multiple materials per mesh?
In that case, I’m having trouble installing the .babylon exporter addon for Blender. I’ve already download the zip file from github, and installed it from the preferences pannel in Blender, but doesn’t show in the addons list. Is this addon up to date? (I’m using Blender 2.83)

Yes, it supports multi-materials. It is in its own category 'BabylonJS` for historical reasons.

Edit: I managed to install the addon.
The export settings doesn’t show when I export, I want to export only the selected object, usually there is an option for that.
An info in the export panel tells to check the properties for the babylon export settings option, but I can’t find that particular option.

Another solution could be to manually change the parent of the meshes, is this possible in the Sandbox?

There are a whole series of custom property sections. World for global stuff, material types, decimal presision, etc.

For each mesh, light, camera, material, you can control individually, like environment intensity for material.

Properties can also be saved in the blend as well.

Also, as a direct answer, things for export are filtered by collection visibility. Have one mesh, put it in its own collection, & turn off all others.

During the conversion an error block the export.

Exporter version: 6.4.5, Blender version: 2.83.0
========= Conversion from Blender to Babylon.js =========
Scene settings used :
Inline textures : false
Material Type : PBR
Positions Precision : 4
Normals Precision : 3
UVs Precision : 3
Vert Color Precision: 3
Mat Weight Precision: 2
Keep Z-up r-handed : no
Texture directory : C:\Users\Alec\Desktop\Blender 2-8\Faretto\Muri\Test
Python World class constructor completed
processing begun of mesh: MuroEsternoProva
processing begun of material: Stucco2
WARNING: unsupported node type(ShaderNodeValue) will trigger baking
========= An error was encountered =========
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\json_exporter.py”, line 115, in execute
mesh = Mesh(object, scene, self)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\mesh.py”, line 146, in init
recipe = BakingRecipe(bpyMesh, exporter)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\baking_recipe.py”, line 43, in init
bjsMaterial = BJSMaterial(bpyMaterial, exporter)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\material.py”, line 63, in init
self.bjsNodeTree = AbstractBJSNode.readMaterialNodeTree(bpyMaterial.node_tree)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 254, in readMaterialNodeTree
return AbstractBJSNode.readNodeTree(node_tree, ‘ShaderNodeOutputMaterial’)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 274, in readNodeTree
return AbstractBJSNode(output, topLevelId, True)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 78, in init
bjsWrapperNode = AbstractBJSNode.GetBJSWrapperNode(nodeSocket.links[0].from_node, nodeSocket.name)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 328, in GetBJSWrapperNode
return PrincipledBJSNode(bpyNode, socketName)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\principled.py”, line 11, in init
super().init(bpyNode, socketName)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 78, in init
bjsWrapperNode = AbstractBJSNode.GetBJSWrapperNode(nodeSocket.links[0].from_node, nodeSocket.name)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 349, in GetBJSWrapperNode
return UnsupportedNode(bpyNode, socketName)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\unsupported.py”, line 12, in init
super().init(bpyNode, socketName)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 78, in init
bjsWrapperNode = AbstractBJSNode.GetBJSWrapperNode(nodeSocket.links[0].from_node, nodeSocket.name)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\abstract.py”, line 340, in GetBJSWrapperNode
return TextureImageBJSNode(bpyNode, socketName)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\nodes\tex_image.py”, line 24, in init
self.unAssignedBjsTexture = BJSImageTexture(self)
File “C:\Users\Alec\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\texture.py”, line 166, in init
self.uScale = mappingNode.scale.x
ERROR: ‘UnsupportedNode’ object has no attribute ‘x’
========= end of processing =========
elapsed time: 0 min, 0.019 secs

Except for the unsupported nodes (that only trigger the baking, i’m fine with that) can you tell what is the error that stops the export?

p.s. Is it possible to manually change the parent of an object in the sandbox? this would solve everything.

Put up a screen shot of the Stucco2 material.

Ok, the internal name of the node is ShaderNodeValue. Seemed strange, but there is a node type of Value that you are using for scaling. For now, just get rid of it, and replace with in-line values, though I am not sure what a negative value for scale does.

Not sure getting past this area is going to produce something you are going to like. AO and roughness as a texture are not really implemented for export this way In BJS, it is this AO-roughness-metalic in different channels thing. Also, the normal map node can likely be removed.

A mapping of nodes for PBR export is:

1 Like

I would do less work just separating the meshes and exporting in .glb. Thanks anyway.

@JCPalmer

when I just export a simple box with BJS exporter in
Blender 2.80 get this error. (need to work with 2.80 sometimes)


error3

is this a binding locations issue

This looks like you are using a version that is too old for Blender 2.80+. you need a 6.0+ exporter for that, and the last version 5 for 2.79

@JCPalmer 6.4.4 was already installed

Post first line of exporter .log file, please