Question about texture mapping especially for metallic and microSurface texture in PBRMaterial

Sphere Examples | Babylon.js Playground (babylonjs.com)

I have a texture pack contains 6 files downloaded from AmbientCG

    const textureColor
    const texturDisplacement
    const textureNormalGL
    const textureNormalDX
    const textureRoughness
    const textureAmbientOcclusion

But I’m not sure am I applying them correctly to the according texture of PBRMaterial from the playground i shared above.

I tried to apply textureRoughness to only microSurfaceTexture, and set metallic and roughness to 1.0, however if I apply it with the Terrazzo texture in my playground, it seems a little darker

cc @sebavan

Could you try and pack roughness with metalness in the same texture similarly to what GLTF is doing ?

Sorry, so does that mean that it is okay to just apply the roughness texture file to metallicTexture only if there is no metalness texture file available?
if so, do I still need to set the roughness and metalness to 1.0 for applying either roughness texture file only or with both packed in the same texture file?

Saw thes code from one of the playground in the documentation

    pbr.metallic = 1.0; // set to 1 to only use it from the metallicRoughnessTexture
    pbr.roughness = 1.0; // set to 1 to only use it from the metallicRoughnessTexture

you would still need to fill the metal channel with a value even if constant.

the roughness et metalness factor are multiplied with the values in the texture so at 1 you would directly use the texture value.

2 Likes

By the way, technically I can have the Roughness, Metalness and Ambient Occlusion texture separated instead of needing to pack them into a same texture in order to use the certain texture information with RGB channel.
So basically I just need to apply with these methods below right?..

Roughness texture to metallicTexture
Metalness texture to microSurfaceTexture
Ambient Occlusion texture to ambientTexture

Then set

pbr.metallic = 1.0; // set to 1 to only use it from the metallicRoughnessTexture
pbr.roughness = 1.0; // set to 1 to only use it from the metallicRoughnessTexture

Your setup should be:

Roughness texture to microSurfaceTexture
Metalness texture to metallicTexture
Ambient Occlusion texture to ambientTexture

with roughness = 1 and metalic = 1