defineGlassPbrMaterial#

Fully qualified name: usdex::core::defineGlassPbrMaterial

pxr::UsdShadeMaterial usdex::core::defineGlassPbrMaterial(
pxr::UsdPrim parent,
const std::string &name,
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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what arguments it accepts.

Note

This function generates an OpenPBR Surface MaterialX shader for the MaterialX render context and a UsdPreviewSurface shader for the universal render context. Material inputs are created to control the look:

  • 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:
  • parent – Prim below which to define the Material

  • name – Name of 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