definePreviewMaterial#

Fully qualified name: usdex::core::definePreviewMaterial

pxr::UsdShadeMaterial usdex::core::definePreviewMaterial(
pxr::UsdPrim parent,
const std::string &name,
const pxr::GfVec3f &color,
const float opacity = 1.0f,
const float roughness = 0.5f,
const float metallic = 0.0f,
)#

Defines a PBR UsdShadeMaterial driven by a UsdPreviewSurface shader network for the universal render context.

The input parameters reflect a subset of the UsdPreviewSurface specification commonly used when authoring materials using the metallic/metalness workflow (as opposed to the specular workflow). Many other inputs are available and can be authored after calling this function (including switching to the specular workflow).

Parameters:
  • parent – Prim below which to define the Material

  • name – Name of the Material

  • color – The diffuse color of the Material

  • opacity – The Opacity Amount to set, 0.0-1.0 range where 1.0 = opaque and 0.0 = invisible

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

  • metallic – The Metallic Amount to set, 0.0-1.0 range where 1.0 = max metallic and 0.0 = no metallic

Returns:

The newly defined UsdShadeMaterial. Returns an Invalid object on error.