Mapping roughness/metallic/AO from one texture file

Hi,

I’m creating a Mesh Standard Material with multiple maps. This has been working great for me and I have had each texture in a separate file. Now I have the Ambient occlusion, Roughness and Metalness combined in one texture file.

After trying to load this file I seem to only get one of the channels. I’m not sure if I’m doing this correctly, as I have been trying to map the same texture to each map as below:

const winchMaterial = new THREE.MeshStandardMaterial({
      map: textureLoader.load(winchBaseColor),
      normalMap: textureLoader.load(winchNormal),
      roughnessMap: textureLoader.load(winchORM),
      aoMap: textureLoader.load(winchORM),
      metalnessMap: textureLoader.load(winchORM),
      envMap: cubeCamera.renderTarget.texture
    });

How do I map this texture file correctly?

The code looks right, although it’d be better to reuse one reference to the texture for all three.

If it’s not working, beyond that it depends on the texture. Channel order needs to be RGB —> AO/roughness/metalness. And the model will need two sets of identical UVs (2nd is for the AO).

Thanks, the channel order is correct on the file.

I changed it so its using the same resource and I get different results depending If I load the texture these two ways:

const winchORMTexture = textureLoader.load(winchORM);
const winchORMTexture = new THREE.Texture(textureLoader.load(winchORM));

Would this effect how my texture is displayed?

The first should work, the second will not. So:

const ormMap = textureLoader.load(winchORM);

const winchMaterial = new THREE.MeshStandardMaterial({
      map: textureLoader.load(winchBaseColor),
      normalMap: textureLoader.load(winchNormal),
      roughnessMap: ormMap,
      aoMap: ormMap,
      metalnessMap: ormMap,
      envMap: cubeCamera.renderTarget.texture
});

If that’s not working, you’ll need to share more details to reproduce the problem.

2 Likes