Light Creation Helpers

Utility functions to define and manipulate UsdLux Light Prims.

Defining a USD Light

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.

UsdLux Light API and Schema Compatibility

Utility functions for handling UsdLux Light API and Schema compatibility because many existing USD files contain lights that were authored with the older light schema that didn’t include "inputs:".

In USD 21.02 many UsdLux Light attributes changed:

Input attributes for UsdLux Light and UsdLuxLightFilter schemas are now connectable and have been renamed to include the “inputs:” prefix.

UsdLux Light CHANGELOG note

These utility “create” functions will author both the old (no "inputs:") and new (with "inputs:") light schema attributes.

eg. both “intensity” and “inputs:intensity” are exported

The “get” function will provide the “correct” light attribute depending on which attributes are authored and a preference boolean.

Functions

void omni::connect::core::createColorAttr(pxr::UsdLuxLight &prim, const pxr::GfVec3f &value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the color attribute for a prim with UsdLuxLight[API] applied.

void omni::connect::core::createColorTemperatureAttr(pxr::UsdLuxLight &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the color temperature attribute for a prim with UsdLuxLight[API] applied.

void omni::connect::core::createDistantAngleAttr(pxr::UsdLuxDistantLight &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the distant angle attribute for a UsdLuxDistantLight prim.

void omni::connect::core::createDomeTextureFileAttr(pxr::UsdLuxDomeLight &prim, const pxr::SdfAssetPath &value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the dome texture file attribute for a UsdLuxDomeLight prim.

void omni::connect::core::createDomeTextureFormatAttr(pxr::UsdLuxDomeLight &prim, const pxr::TfToken &value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the dome texture format attribute for a UsdLuxDomeLight prim.

void omni::connect::core::createEnableColorTemperatureAttr(pxr::UsdLuxLight &prim, bool value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the "enable color temperature" attribute for a prim with UsdLuxLight[API] applied.

void omni::connect::core::createIntensityAttr(pxr::UsdLuxLight &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the intensity attribute for a prim with UsdLuxLight[API] applied.

void omni::connect::core::createLightExtentAttr(pxr::UsdPrim prim, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the extent attribute for a UsdLuxCylinderLight, UsdLuxDiskLight, UsdLuxRectLight, UsdLuxSphereLight, or UsdLuxPortalLight.

void omni::connect::core::createRectHeightAttr(pxr::UsdLuxRectLight &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the height attribute for a UsdLuxRectLight prim.

void omni::connect::core::createRectTextureFileAttr(pxr::UsdLuxRectLight &prim, const pxr::SdfAssetPath &value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the texture file attribute for a UsdLuxRectLight prim.

void omni::connect::core::createRectWidthAttr(pxr::UsdLuxRectLight &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the width attribute for a UsdLuxRectLight prim.

void omni::connect::core::createShapingConeAngleAttr(pxr::UsdLuxShapingAPI &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the cone angle attribute for a prim with UsdLuxShapingAPI applied.

void omni::connect::core::createShapingConeSoftnessAttr(pxr::UsdLuxShapingAPI &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the cone softness attribute for a prim with UsdLuxShapingAPI applied.

void omni::connect::core::createSphereRadiusAttr(pxr::UsdLuxSphereLight &prim, float value, pxr::UsdTimeCode time=pxr::UsdTimeCode::Default())

Author the sphere radius attribute for a UsdLuxSphereLight prim.

pxr::UsdLuxDomeLight omni::connect::core::defineDomeLight(pxr::UsdStagePtr stage, const pxr::SdfPath &path, float intensity=1.0f, const char *texturePath=nullptr, const pxr::TfToken &textureFormat=pxr::UsdLuxTokens->automatic)

Creates a dome light with an optional texture.

pxr::UsdLuxDomeLight omni::connect::core::defineDomeLight(pxr::UsdPrim parent, const std::string &name, float intensity=1.0f, const char *texturePath=nullptr, const pxr::TfToken &textureFormat=pxr::UsdLuxTokens->automatic)

Creates a dome light with an optional texture.

pxr::UsdLuxRectLight omni::connect::core::defineRectLight(pxr::UsdPrim parent, const std::string &name, float width, float height, float intensity=1.0f, const char *texturePath=nullptr)

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

pxr::UsdLuxRectLight omni::connect::core::defineRectLight(pxr::UsdStagePtr stage, const pxr::SdfPath &path, float width, float height, float intensity=1.0f, const char *texturePath=nullptr)

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

const pxr::TfTokenVector & omni::connect::core::getDistantLightAttrNames()

Get a list of both current version and forward/reverse compatible UsdLuxDistantLight attribute names.

const pxr::TfTokenVector & omni::connect::core::getDomeLightAttrNames()

Get a list of both current version and forward/reverse compatible UsdLuxDomeLight attribute names.

const pxr::TfTokenVector & omni::connect::core::getLightAPIAttrNames()

Get a list of both current version and forward/reverse compatible UsdLuxLight[API] attribute names.

pxr::UsdAttribute omni::connect::core::getLightAttr(const pxr::UsdAttribute &defaultAttr, bool preferNewSchema=true)

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

const pxr::TfTokenVector & omni::connect::core::getRectLightAttrNames()

Get a list of both current version and forward/reverse compatible UsdLuxRectLight attribute names.

const pxr::TfTokenVector & omni::connect::core::getShapingAPIAttrNames()

Get a list of both current version and forward/reverse compatible UsdLuxShapingAPI attribute names.

const pxr::TfTokenVector & omni::connect::core::getSphereLightAttrNames()

Get a list of both current version and forward/reverse compatible UsdLuxSphereLight attribute names.

bool omni::connect::core::isLight(const pxr::UsdPrim &prim)

Determines if a UsdPrim is a UsdLuxLight[API].