How should i create the specular/glossiness map

Hello guys, I’ve created a viewer that loads a specular/glossiness model (I can’t convert it to metal/roughness for various reasons, I have to use specular/glossiness), but I’m not able to figure out how to set up the texture for the material to achieve 3 effects, on 3 different elements of the texture, symbols for example:

  • Glossy
  • Metallic-like
  • Matte

How should I set up the texture to achieve this?
I followed this guide for setting up the material (Babylon.js docs)

@bghgary any tips here?

I’m assuming you mean specular glossiness from PBR and not Blinn/Phong (which is what StandardMaterial uses).

I’m not exactly sure what you are asking. The doc you pointed to is showing the mapping between PBRSpecularGlossinessMaterial and PBRMaterial. PBRMaterial can be either metal/rough or spec/gloss workflow depending on whether certain properties are set. PBRSpecularGlossinesMaterial is only for spec/gloss workflow and exposes the properties with slightly different names.

Are you setting this on a PBRMaterial or a PBRSpecularGlossinessMaterial?

If you provide a playground link with what you are trying to do, it will be much easier to help.

Hi guys, I’ve actually only been using Babylon for a short time; I come from three.js. I’ve just discovered that even with a .glb model containing specular/glossiness materials, I can use Babylon’s PBR material and set the workflow to metallic/roughness, which I prefer. Just to be sure… can you confirm what I just wrote?

Yes, we still support the old specular/glossines extension for glTF.

I don’t know what you mean by this. If you can provide a playground, that would really helpful.

From what I understand, whether the loaded model has metal/roughness or specular/glossiness materials doesn’t matter since Babylon’s standard PBRmaterial supports both. Could I then, once a model with specular/glossiness materials is imported, convert the workflow for that model to metal/roughness? Of course, by changing the texture maps and using PBRmaterial.

If you set one of the properties I noted in the code above (metallic, roughness, or metallicTexture), the workflow will become metal/rough the next time the material is used in rendering. It will not automatically convert any of the textures, though we do have some code in the serializers that do this for glTF export that could in theory be factored out. This conversion is potentially lossy, so it’s not going to be a perfect conversion.