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
UsdShadeMaterialinterface that drives both an OpenPBR MaterialX render context and the universal render context.The resulting Material prim will have “Interface”
UsdShadeInputswhich 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
UsdPreviewSurfaceshader 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 (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:
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