From ee03fad739a092bf93692fced0fee089c3fac758 Mon Sep 17 00:00:00 2001 From: pwflocal Date: Fri, 12 May 2023 16:09:53 -0700 Subject: [PATCH] fixed task #107903 - added support for outputting emissiveColor in UsdPreviewSurface, mapped from Blender's Emission --- source/blender/io/usd/intern/usd_writer_material.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc index ed868338f91..4cbe5e6d0ae 100644 --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -39,6 +39,7 @@ namespace usdtokens { static const pxr::TfToken clearcoat("clearcoat", pxr::TfToken::Immortal); static const pxr::TfToken clearcoatRoughness("clearcoatRoughness", pxr::TfToken::Immortal); static const pxr::TfToken diffuse_color("diffuseColor", pxr::TfToken::Immortal); +static const pxr::TfToken emissive_color("emissiveColor", pxr::TfToken::Immortal); static const pxr::TfToken metallic("metallic", pxr::TfToken::Immortal); static const pxr::TfToken preview_shader("previewShader", pxr::TfToken::Immortal); static const pxr::TfToken preview_surface("UsdPreviewSurface", pxr::TfToken::Immortal); @@ -277,6 +278,8 @@ void create_usd_viewport_material(const USDExporterContext &usd_export_context, shader.CreateIdAttr(pxr::VtValue(usdtokens::preview_surface)); shader.CreateInput(usdtokens::diffuse_color, pxr::SdfValueTypeNames->Color3f) .Set(pxr::GfVec3f(material->r, material->g, material->b)); + shader.CreateInput(usdtokens::emissive_color, pxr::SdfValueTypeNames->Color3f) + .Set(pxr::GfVec3f(material->r, material->g, material->b)); shader.CreateInput(usdtokens::roughness, pxr::SdfValueTypeNames->Float).Set(material->roughness); shader.CreateInput(usdtokens::metallic, pxr::SdfValueTypeNames->Float).Set(material->metallic); @@ -289,6 +292,7 @@ static InputSpecMap &preview_surface_input_map() { static InputSpecMap input_map = { {"Base Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Float3, true}}, + {"Emission", {usdtokens::emissive_color, pxr::SdfValueTypeNames->Float3, true}}, {"Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Float3, true}}, {"Roughness", {usdtokens::roughness, pxr::SdfValueTypeNames->Float, true}}, {"Metallic", {usdtokens::metallic, pxr::SdfValueTypeNames->Float, true}}, -- 2.30.2