From 04c69a1ee2b0f42c1f36c3dda4bdebdf6c9f4837 Mon Sep 17 00:00:00 2001 From: hirose Date: Thu, 12 Dec 2019 15:39:54 +0900 Subject: [PATCH] baseColorFactor to linear color space. --- Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs | 2 +- Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs b/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs index 07f72b544..8824eb7ab 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs @@ -40,7 +40,7 @@ namespace UniGLTF { if (m.HasProperty("_Color")) { - material.pbrMetallicRoughness.baseColorFactor = m.color.ToArray(); + material.pbrMetallicRoughness.baseColorFactor = m.color.linear.ToArray(); } if (m.HasProperty("_MainTex")) diff --git a/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs b/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs index 7ee5008d4..9d87cf084 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs @@ -102,7 +102,7 @@ namespace UniGLTF if (x.pbrMetallicRoughness.baseColorFactor != null && x.pbrMetallicRoughness.baseColorFactor.Length == 4) { var color = x.pbrMetallicRoughness.baseColorFactor; - material.color = new Color(color[0], color[1], color[2], color[3]); + material.color = (new Color(color[0], color[1], color[2], color[3])).gamma; } //renderMode @@ -145,7 +145,7 @@ namespace UniGLTF if (x.pbrMetallicRoughness.baseColorFactor != null && x.pbrMetallicRoughness.baseColorFactor.Length == 4) { var color = x.pbrMetallicRoughness.baseColorFactor; - material.color = new Color(color[0], color[1], color[2], color[3]); + material.color = (new Color(color[0], color[1], color[2], color[3])).gamma; } if (x.pbrMetallicRoughness.baseColorTexture != null && x.pbrMetallicRoughness.baseColorTexture.index != -1)