How to use the PBRmaterial.metallic property in 3DS Max export to glb?

Hi everyone,

In Babylon I’m using the PBRmaterial.metallic and PBRmaterial.roughness values to set the strength of the PBRmaterial.metallicTexture.

It would be nice to be able to set the same strength in a glb document, after exporting from 3DS Max.

The manual says: “Remember that in 3DS MAX, when a map is assigned to a parameter, the basic parameter value is ignored. This behaviour is kept when exporting.”

Is there another way to export those settings along with the glb document? Maybe with a custom attribute?

Reading the glTF 2.0 reference, I’m seeing “metallicFactor” and “roughnessFactor”, but I can’t figure out how to export those values using a custom attribute.

It would be great to mimic the Babylon.js look as much as possible!

Thank you :relaxed:

Pinging @Guillaume_Pelletier

Hey guy’s,
Sorry for the delay, i’m off for a week and had limited Net access.
MettalicFactor is coming from
image
the Metalness input into the PhysicalMaterial properties.
This value is take in account if NO Metalness map are set. If metalness map is set, then the value is set to 1.0. Note that this value can generate artifact if you’re using JPG texture for the the ORM map. Use PNG in all case for a better result.
Hope this help.
G.

Hi @Guillaume_Pelletier , thank you for the info. But in the glb document, I would like to set the intensity of the metallic and roughness textures, and not set it to 100%. Can this somehow be achieved with a custom attribute during export?

Not has it. This is the Metalness value OR the map (which is the behavior of Max). We must add a specific option into the material attribute but we have to be sure about how to introduce this into the flow for Babylon, then GLTF. I will discuss with the team on the topic. This is related to issue #923 to add others specific parameters.

Okay @Guillaume_Pelletier , so the GLTF/GLB format can do this, but the exporter still has to be adapted to this. That would be too late for my current project. Can you refer me to a tool (e.g. DOS/command line) that I can use to convert my 3D models and textures into a glb file, a tool that has the option to set the strength of the texture? Thank you so much for your help!

@FernandoConti I’m not aware of such tool. If you have an FBX as source file you can try FBX2GLTF, but do not know about how this tool process the “xxxxfactor”.
What is your project timeline?

@Guillaume_Pelletier , ideally I would need the possibility the set the strength/intensity of the the metalness and roughness texture by Monday 15th. So that is fairly quick unfortunately. Do you maybe see a way for a quick fix?

A quick & (probably very :sweat_smile:) dirty way could be to use material naming.

Example with myMaterial_m0.75-r0.125

const mtl = mesh.material;
mtl.metallicTexture.level = parseFloat(mtl.name.split("_")[1].split("-")[0].split("m")[1]); // give 0.75
mtl.roughnessTexture.level = parseFloat(mtl.name.split("_")[1].split("-")[1].split("r")[1]); // give 0.125
1 Like

@FernandoConti Ok, i will add a temporary “use Babylon Factors” under the specific babylon properties of the Material, and then lets the user to choose between Max Behavior (MAP OR SCALAR) or Babylon/GLTF (MAP*SCALAR OR SCALAR) way. I will work on this tomorrow morning (my time which is CET+1). Keep u posted.

1 Like

Thank you so much @Guillaume_Pelletier and @Vinc3r !

The support around here is just incredible :star: :star: :star: :star: :star: :smile:

@FernandoConti just published a PR. Wait for the team to review and merge. Hope it will save your project :slight_smile:

1 Like

Thanks a million @Guillaume_Pelletier !! Super excited about this !! :+1: :+1:

using Physical material, you set the metalness and roughness under the basic parameters
image
And at the bottom check the box “Use Scalar Factors” to force the exporter to export also the basic parameter even in presence of map.
image
Note : the new Full PBR xxx are specific to babylon format, and use only when “Use Full PBR” is checked in main exporter panel. Nothing to deal with GLTF here.

@Guillaume_Pelletier, just to be clear, this also works for the GLB output (which would be my project output)?

Also, do I need to keep an eye on “GitHub - BabylonJS/Exporters: Exporters for Babylon.js and gltf file formats” for the new update, or am I looking at the wrong page? :relaxed:

You may wait for release 242. This is work for Babylon, Gltf AND glb.

1 Like

Okay thanks!

Hi @Drigax and @Guillaume_Pelletier , I saw your discussion over at Github (Add material specific attributes by pandaGaume · Pull Request #930 · BabylonJS/Exporters · GitHub).

I just wanted to ask if you think this new feature will be added to the exporter.

I feel very bad asking you this since you all do such great work and I really don’t to press anything at all.

It’s just that my entire project hinges on this texture strength setting which would allow me to mimic Babylon’s live-scripted look inside the glb format.

Thank you for your consideration!

1 Like

The change is in now :slight_smile:
Thanks!

2 Likes

Awesome! Thank you @Drigax and @Guillaume_Pelletier!!! :1st_place_medal: :1st_place_medal: :1st_place_medal: :1st_place_medal: :1st_place_medal: