Light Prims#

Utility functions to define, manipulate, and read UsdLux Light Prims.

Defining UsdLux Lights#

When creating some USD light types it’s sometimes ambiguous as to what attributes should be set. These light definition helper functions provide an argument set that make these optional arguments clear.

Accessing UsdLux Light Attributes#

In USD 21.02 many UsdLux Light attributes changed. Input attributes for UsdLuxLight and UsdLuxLightFilter schemas are now connectable and have been renamed to include the inputs: prefix.

The getLightAttr() function provides the “correct” light attribute depending on which attributes are authored, favoring the newer inputs: attributes. This is to help with existing USD files containing lights that were authored with older light schema that didn’t include inputs: attributes.

UsdLux Light CHANGELOG note for 21.02

Functions#

pxr::UsdLuxDomeLight usdex::core::defineDomeLight(pxr::UsdPrim parent, const std::string &name, float intensity=1.0f, std::optional< std::string_view > texturePath=std::nullopt, const pxr::TfToken &textureFormat=pxr::UsdLuxTokens->automatic)

Creates a dome light with an optional texture.

pxr::UsdLuxDomeLight usdex::core::defineDomeLight(pxr::UsdStagePtr stage, const pxr::SdfPath &path, float intensity=1.0f, std::optional< std::string_view > texturePath=std::nullopt, const pxr::TfToken &textureFormat=pxr::UsdLuxTokens->automatic)

Creates a dome light with an optional texture.

pxr::UsdLuxRectLight usdex::core::defineRectLight(pxr::UsdStagePtr stage, const pxr::SdfPath &path, float width, float height, float intensity=1.0f, std::optional< std::string_view > texturePath=std::nullopt)

Creates a rectangular (rect) light with an optional texture.

pxr::UsdLuxRectLight usdex::core::defineRectLight(pxr::UsdPrim parent, const std::string &name, float width, float height, float intensity=1.0f, std::optional< std::string_view > texturePath=std::nullopt)

Creates a rectangular (rect) light with an optional texture.

pxr::UsdAttribute usdex::core::getLightAttr(const pxr::UsdAttribute &defaultAttr)

Get the "correct" light attribute for a light that could have any combination of authored old and new UsdLux schema attributes.

bool usdex::core::isLight(const pxr::UsdPrim &prim)

Determines if a UsdPrim has a UsdLuxLightAPI schema applied.