addOpacityTextureToPbrMaterial#

Fully qualified name: usdex::rtx::addOpacityTextureToPbrMaterial

bool usdex::rtx::addOpacityTextureToPbrMaterial(
pxr::UsdShadeMaterial &material,
const pxr::SdfAssetPath &texturePath,
)#

Adds an opacity texture to the PBR material.

It is expected that the material was created by usdex::rtx::definePbrMaterial().

These shader parameters will be set to produce better masked geometry:

  • MDL OmniPBR: opacity_threshold = float_epsilon (just greater than zero)

  • UsdPreviewSurface: ior = 1.0

  • UsdPreviewSurface: opacityThreshold = float_epsilon (just greater than zero)

Note

The material prim’s “Opacity” input will be removed and replaced with “OpacityTexture”. Due to the input removal this function should be used at initial authoring time rather than in a stronger layer.

Parameters:
  • material – The UsdShadeMaterial prim to add the texture

  • texturePath – The SdfAssetPath to the texture file

Returns:

Whether or not the texture was added to the material