defineGlassPbrMaterial#
Fully qualified name: usdex::core::defineGlassPbrMaterial
- pxr::UsdShadeMaterial usdex::core::defineGlassPbrMaterial(
- pxr::UsdPrim prim,
- const pxr::GfVec3f &color,
- const float indexOfRefraction = 1.5f,
- const float roughness = 0.02f,
- const float previewOpacity = 0.2f,
Defines a Glass
UsdShadeMaterialinterface 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
UsdPreviewSurfaceshader for the universal render context. Material inputs are created to control the look:color- The glass color (drivestransmission_coloron OpenPBR anddiffuseColoron UsdPreviewSurface)ior- Index of Refraction (drivesspecular_ioron OpenPBR andioron UsdPreviewSurface)roughness- Specular roughness for the glass surface (drivesspecular_roughnesson OpenPBR androughnesson UsdPreviewSurface)opacity- Controls UsdPreviewSurfaceopacityonly; OpenPBR glass transparency is handled viatransmission_weight
- Parameters:
prim – Prim to define the material on. The prim’s type will be set to
UsdShadeMaterial.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