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_colorinput, and authors aUsdUVTextureshader driving the UsdPreviewSurfaceemissiveColorinput. Thefileinputs of both texture shaders are connected to a shared material interface input (EmissiveTexture).In addition to the texture, this also creates (or reuses) the
emissiveLuminancematerial interface input that drives the OpenPBRemission_luminanceshader input, so the texture is properly scaled by an emission strength. The suppliedluminancevalue will overwrite any value previously authored byaddEmissiveColorToPbrMaterial().Note
emissiveLuminanceis incd/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
SdfAssetPathto the texture fileluminance – 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