addEmissiveTextureToPbrMaterial#

Fully qualified name: usdex::core::addEmissiveTextureToPbrMaterial

bool usdex::core::addEmissiveTextureToPbrMaterial(
pxr::UsdShadeMaterial &material,
const pxr::SdfAssetPath &texturePath,
const float luminance = 1000.0f,
)#

Adds an emissive color texture to an OpenPBR material.

It is expected that the material was created by definePbrMaterial()

The texture will be sampled using texture coordinates from the default UV set (generally named primvars:st).

This authors a tiledimage shader for the MaterialX render context driving the OpenPBR emission_color input, and authors a UsdUVTexture shader driving the UsdPreviewSurface emissiveColor input. The file inputs of both texture shaders are connected to a shared material interface input (EmissiveTexture).

In addition to the texture, this also creates (or reuses) the emissiveLuminance material interface input that drives the OpenPBR emission_luminance shader input, so the texture is properly scaled by an emission strength. The supplied luminance value will overwrite any value previously authored by addEmissiveColorToPbrMaterial().

Note

emissiveLuminance is in cd/m^2 (Candelas per square meter, also known as Nits), per the OpenPBR Surface specification. UsdPreviewSurface does not have a separate luminance input, so the universal render context only receives the emissive texture (without luminance scaling).

Parameters:
  • material – The material prim

  • texturePath – The SdfAssetPath to the texture file

  • luminance – The emissive luminance in cd/m^2 (Nits). Must be at least 0.0 (no upper bound). Defaults to 1000.0, which is roughly the brightness of an indoor LED light panel and produces a clearly visible emission in most scenes.

Returns:

Whether or not the texture was added to the material