How to specify the detailTexture to use in a .babylon file

I currently export my assets from Maya and I am aware that there is no way to export a detail map to a .babylon file. See How to export detail map to .babylon file in Maya

So I thought I would just add the texture to the PBR material manually in the .babylon file.

However, the detailmap is specified differently to the other textures within the code. Most textures, such as metallicTexture are named within pbrMaterial.ts. The detailTexture is defined within the DetailMapConfiguration which itself is a member of pbrBaseMaterial.ts named detailMap so I’m not sure how to format the .babylon file json correctly to get it to load.

Can anyone explain the correct formatting for this?

Edit - I think this has something to do with the DetailMapConfiguration plugin: DetailMapConfiguration | Babylon.js Documentation - How can I ensure it is used as part of the .babylon file load process?

I think it should be specified like this:

"DetailMapConfiguration": {
  "detailTexture": {

To find out, I simply serialized a material :slight_smile:

Thanks for taking a look @sebavan :+1:

I also serialised a material (actually the whole scene) from the following playground:

and saw the DetailMapConfiguration too.

However, it seems to be nested within a “plugins” json object within the material and when I manually add this to my own .babylon file and try to load it the DetailMap is ignored.

In addition, within my own project when I use the inspector to manually assign a detail map and then export it to .babylon, the detail map is not within the json…

Is this because it is somehow treated as a material plugin and I need to do something within my project that automatically happens within the playground in order to get it to work?

It should work, it might be cause you have older versions or out of sync versions ?

@Evgeni_Popov fixed the plugins serialization a little while back but not years ago.

1 Like

I didn’t consider that… I’m on 6.7.0, so I am a bit behind. Will try updating to latest

@sebavan - upgrading to latest (6.21.2) fixed the issue :smiley:

Thanks for the help - the answer is to put the DetailMapConfiguration nested within a plugins object within the material definition :+1: