omni::connect::core::createMdlShaderInput

Defined in omni/connect/core/MaterialAlgo.h

pxr::UsdShadeInput omni::connect::core::createMdlShaderInput(pxr::UsdShadeMaterial &material, const pxr::TfToken &name, const pxr::VtValue &value, const pxr::SdfValueTypeName &typeName, carb::cpp::optional<const ColorSpace> colorSpace = carb::cpp::nullopt)

Create an MDL shader input.

If the shader input already exists and is a different type, defined in the current edit target layer -> it will be removed and recreated.

If the shader input already exists and has a connected source -> the source will be disconnected before being set.

Note

When creating texture asset inputs (diffuse, normal, roughness, etc.) it is important to set the colorSpace parameter so that the textures are sampled correctly. Typically, diffuse is “auto”, which resolves to “sRGB”. Normal, roughness, and other textures should be “raw”.

Parameters
  • material – The UsdShadeMaterial prim that contains the MDL shader

  • name – Name of the input to be created

  • value – The value assigned to the input

  • typeName – The value type of the input

  • colorSpace – If set, the newly created input’s colorSpace attribute

Returns

The newly created UsdShadeInput input. Returns an Invalid UsdShadeInput on error.