From d9588fcac2d1ded13f964e1b3a84a6eee002522d Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Fri, 7 May 2021 19:43:00 +0900 Subject: [PATCH] Specify color space in exporting glTF Material. --- .../UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs index b0fc0a210..461c011ee 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs @@ -38,7 +38,7 @@ namespace UniGLTF { if (m.HasProperty("_Color")) { - material.pbrMetallicRoughness.baseColorFactor = m.color.linear.ToArray(); + material.pbrMetallicRoughness.baseColorFactor = m.GetColor("_Color").ToFloat4(ColorSpace.sRGB, ColorSpace.Linear); } if (m.HasProperty("_MainTex")) @@ -161,7 +161,7 @@ namespace UniGLTF { color /= color.maxColorComponent; } - material.emissiveFactor = new float[] { color.r, color.g, color.b }; + material.emissiveFactor = color.ToFloat3(ColorSpace.Linear, ColorSpace.Linear); } if (m.HasProperty("_EmissionMap"))