Import material from blender to babylon

I’ve tried to import a material from blender to Babylon, but in the process it loses every characteristic. Do you know if, when managing material, we need to recreate the node structure in Babylon or if there’s a way to export and import them in a more efficient way?

For example, i’m using a Fresnel node in Blender and i know it exists on Babylon (Fresnel Paramaters | Babylon.js Documentation) but i think it doesn’t preserve it. I’m a little confused about where to find those specific parameters in the inspector.

This is blender setting:

And this is the playground with the imported materials:

Thank you very much for any kind of help :slight_smile:

Asking help from a friend @JCPalmer the blender exporter Daddy :slight_smile:

1 Like

thank you :slight_smile:
In the meanwhile I found this glTF 2.0 — Blender Manual that could help.
I need to see how far can i go until the texture infos are preserved in the glb format.

If you are constructing materials for the purpose of export,using Principled node is the way to go. Blender has many types of node which do not have a BJS equivalent. The nodes this exporter supports to varying a degree are can be represented by the list of python files in this repo directory, BlenderExporter/src/babylon_js/materials/nodes at master · BabylonJS/BlenderExporter · GitHub.

Glass, & light path have no equivalent for sure. RGB is probably addable, but not currently being done. What will result is the exporter will try to bake to textures. Check your exporter log file to see that this is being done, and why.

As said before, you want to look to using principled, if possible. This will mean no textures, which also has these side effects in addition:

  • UV’s required.
  • Somethings cannot be baked, like metallic.
  • Increased download time & most likely draw time.
  • Multiple objects cannot share the same material, since they would need to have the exact same UV. That is unknown.

Think GLB is largely in the same need to bake boat.

1 Like

thank you very much for the detailed answer.
I guess I need to rethink the creation of material, according to what can have a BJS equivalent.
I’ll start from a basic approach and will build on that.
Thank you again for your time

I think you are approaching this from the wrong direction, understandable, but not optimal.

The materials between Blender & Babylon PBR is actually an intersection. There are things in PBR which have no representation or are too different to line up to Blender. Now if you were using GLB, just getting the things GLB & Blender have in common is probably optimal.

For the 2.93 exporter, I revisited the source code & documentation for PBR, and tried to pull out everything which might be useful, whether it had any meaning in Blender or not. That is where you also will get the most out of the exporter.

In 2.93, the number of custom properties has vastly increased.

Now using them will not make any visible change while in blender, but does it really matter that something like Parallax is not in Blender? Of course, using any of these would have to be done in an iterative work flow of:

  • Export
  • Use sandbox to see if desirable
  • Set in Blender & repeat

Many are really kind of special situation things, like Disable Lights, but being able to do them without code can be much easier. Specular Anti-Aliasing is a very good way to handle unstable reflections on smooth shaded meshes in XR. I was not even aware of most of these myself. On any material with a normals texture, I now always check if Normals Forward gives a better result.