Where is roughnessTexture

In the sandbox, you can set the settings and attributes of materials, etc. in the inspector panel. In that panel, there includes various textures that you can add to a material, as seen below.

However, in the documentation, only certain textures appear.
(It should be noted that the attributes listed in the sandbox are sometimes that named or expressed in the same way in the documentation, which is sometimes a bit frustrating).

I am trying to make sure that all of my attributes are added to a material as a process it when I load it from glb. However, I am not sure what to do about the Roughness Texture (pictured as listed as an attribute in the image below), since there is no “roughnessTexture” listed in the documentation under PBRMaterial. Any tips on which property to set in code for the roughnessTexture? I know that there is useRoughnessFromMetallicAlpha and useRoughnessFromMetallicGreen, but I don’t think this is the same thing, and if it is, I wouldn’t know whether to use the alpha or the green channel of the metallic texture.

Also, bumpStrength is an attribute listed in the sandbox but not in the documentation, so I am not sure what to use/do there, and realTimeFilteringQuality() is listed in both, but in the documentation it says it takes a number as input, but in the sandbox, lists the parameter setting as “low”. The documentation does not explain which number is the “low” setting. The “Use detailmap” setting is also not found in the documentation, from what I could tell.

Any help elucidating this would be much appreciated.

1 Like

adding @Evgeni_Popov

@Evgeni_Popov Is this a documentation mistake, or am I just not looking in the right spot? Thanks for the help in advance!

In a PBRMaterial material, the metallic and roughness textures are in fact a single texture accessible through the property named metallicTexture: the roughness is in the alpha channel. Note that when loading a gltf/glb, the roughness is in the green channel instead because it is how it is defined in the spec. So, in the inspector, the Metallic and Roughness channels point to the same texture: when setting/deleting one, you automatically set/delete the other as it is really the same.

useRoughnessFromMetallicTextureAlpha / useRoughnessFromMetallicTextureGreen / useMetallnessFromMetallicTextureBlue all allow you to indicate which channel to use to get the metallic/roughness values from the PBRMaterial.metallicTexture texture. Note that if useMetallnessFromMetallicTextureBlue is false the metallic values are read from the red channel, and if both useRoughnessFromMetallicTextureAlpha and useRoughnessFromMetallicTextureGreen are false the texture is considered to contain no roughness data.

bumpStrength is not a specific PBR value, it is simply the bump texture level property, which is a property that exists on all textures and that let you modulate its intensity. It’s a property you can change for each texture in the LEVELS section of the inspector:
image

realTimeFilteringQuality can take any value, which is the number of samples to use to perform the filtering, but there are 3 predefined values, that’s why there are 3 entries in the inspector:
image

The 3 predefined values are BABYLON.Constants.TEXTURE_FILTERING_QUALITY_LOW (=8), BABYLON.Constants.TEXTURE_FILTERING_QUALITY_MEDIUM (=16) and BABYLON.Constants.TEXTURE_FILTERING_QUALITY_HIGH (=64) but you are free to set any value to realTimeFilteringQuality.

The detail map doc is here: More Materials | Babylon.js Documentation

Hope it clears things up.

1 Like