addOpacityTextureToPreviewMaterial#
Fully qualified name: usdex::core::addOpacityTextureToPreviewMaterial
- bool usdex::core::addOpacityTextureToPreviewMaterial(
- pxr::UsdShadeMaterial &material,
- const pxr::SdfAssetPath &texturePath,
Adds a single channel opacity texture to a preview material.
It is expected that the material was created by
definePreviewMaterial()The texture will be sampled using texture coordinates from the default UV set (generally named
primvars:st).In addition to driving the
opacityinput, these additional shader inputs will be set explicitly, to produce better masked geometry:UsdPreviewSurface:
ior = 1.0UsdPreviewSurface:
opacityThreshold = float_epsilon(just greater than zero)
Note
If you intend to create a Material Interface, it is preferable to author all initial shader attributes (including textures) before calling
addPreviewMaterialInterface(). This function will not attempt to reconcile any existing inputs on the Material.- Parameters:
material – The material prim
texturePath – The
SdfAssetPathto the texture file
- Returns:
Whether or not the texture was added to the material