defineGlassPbrMaterial#

Fully qualified name: usdex::core::defineGlassPbrMaterial

pxr::UsdShadeMaterial usdex::core::defineGlassPbrMaterial(
pxr::UsdStagePtr stage,
const pxr::SdfPath &path,
const pxr::GfVec3f &color,
const float indexOfRefraction = 1.5f,
const float roughness = 0.02f,
const float previewOpacity = 0.2f,
)#

Defines a Glass UsdShadeMaterial interface that drives both an OpenPBR MaterialX render context and the universal render context.

The resulting Material prim will have “Interface” UsdShadeInputs which drive both render contexts. See Material and Shader Prims for details.

Note

This function generates an OpenPBR Surface MaterialX shader for the MaterialX render context and a UsdPreviewSurface shader for the universal render context. The created Material inputs reflect a subset of the available parameters commonly used when authoring glass materials:

  • color - The glass color (drives transmission_color on OpenPBR and diffuseColor on UsdPreviewSurface)

  • ior - Index of Refraction (drives specular_ior on OpenPBR and ior on UsdPreviewSurface)

  • roughness - Specular roughness for the glass surface (drives specular_roughness on OpenPBR and roughness on UsdPreviewSurface)

  • opacity - Controls UsdPreviewSurface opacity only; OpenPBR glass transparency is handled via transmission_weight

Parameters:
  • stage – The stage on which to define the Material

  • path – The absolute prim path at which to define the Material

  • color – The color of the Material

  • indexOfRefraction – The Index of Refraction to set, minimum 1.0; soft maximum 3.0

  • roughness – The Roughness Amount to set, 0.0-1.0 range where 1.0 = flat and 0.0 = glossy

  • previewOpacity – The Opacity Amount to set on UsdPreviewSurface, 0.0-1.0 range where 1.0 = opaque and 0.0 = transparent

Returns:

The newly defined UsdShadeMaterial. Returns an Invalid prim on error