Fix: USD: Use color3f for color nodes

Blender was writing out color attributes on USDPreviewSurface as
float3 instead of the more accurate color3f.  While this is somewhat
technically okay, since color3f is a role alias for float3, it does cause
issues in applications that are correctly expecting color3f.

The material writer code actually expects color3f in other
sections, but was using float3 in this section erroneously.

Co-authored-by: Dhruv Govil <dgovil2@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113695
This commit is contained in:
Michael B Johnson
2023-10-18 14:52:06 +02:00
committed by Michael Kowalski
parent ad0b9dbdd2
commit 686487ca17

View File

@@ -301,9 +301,9 @@ static void create_usd_viewport_material(const USDExporterContext &usd_export_co
static InputSpecMap &preview_surface_input_map()
{
static InputSpecMap input_map = {
{"Base Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Float3, true}},
{"Emission Color", {usdtokens::emissive_color, pxr::SdfValueTypeNames->Float3, true}},
{"Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Float3, true}},
{"Base Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Color3f, true}},
{"Emission Color", {usdtokens::emissive_color, pxr::SdfValueTypeNames->Color3f, true}},
{"Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Color3f, true}},
{"Roughness", {usdtokens::roughness, pxr::SdfValueTypeNames->Float, true}},
{"Metallic", {usdtokens::metallic, pxr::SdfValueTypeNames->Float, true}},
{"Specular IOR Level", {usdtokens::specular, pxr::SdfValueTypeNames->Float, true}},