Skip to content

EntropyCanvas::UsdLightSerializer

Serializes Light components to USD using native UsdLux types. More…

#include <UsdLightSerializer.h>

Name
boolwrite(pxr::UsdStageRefPtr stage, const pxr::SdfPath & path, const Light & light)
Write a Light component to a USD stage at the given path.
boolread(pxr::UsdStageRefPtr stage, const pxr::SdfPath & path, Light & outLight)
Read a Light component from a USD prim.
class EntropyCanvas::UsdLightSerializer;

Serializes Light components to USD using native UsdLux types.

Maps Light components to:

  • LightType::Sphere -> UsdLuxSphereLight (with UsdLuxShapingAPI for spot behavior)
  • LightType::Distant -> UsdLuxDistantLight

Extension fields (range, bounceFactor, shadowResolution, shadowCascadeCount) are written as dynamic attributes with the entropyRender: namespace prefix.

static bool write(
pxr::UsdStageRefPtr stage,
const pxr::SdfPath & path,
const Light & light
)

Write a Light component to a USD stage at the given path.

Parameters:

  • stage USD stage to write to
  • path Prim path for the light
  • light Light component data

Return: true if successful

Creates the appropriate UsdLux prim type based on lightType and sets all standard UsdLux attributes. Extension fields are written as custom attributes with entropyRender: prefix.

static bool read(
pxr::UsdStageRefPtr stage,
const pxr::SdfPath & path,
Light & outLight
)

Read a Light component from a USD prim.

Parameters:

  • stage USD stage to read from
  • path Prim path of the light
  • outLight Output light component

Return: true if successful

Reads UsdLux light attributes and extension fields back into a Light component structure.


Updated on 2026-01-26 at 17:14:35 -0500