From 8e4cfafcf5993e348d2565c1fee96ea09a69c30f Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 24 Jun 2021 15:20:39 +0900 Subject: [PATCH] change condition to defencive --- .../Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs index 2a85d3e22..3def3963d 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialExporter.cs @@ -39,10 +39,10 @@ namespace UniGLTF if (m.HasProperty("_MainTex")) { - var hasTransparency = string.Equals(material.alphaMode, "MASK", StringComparison.Ordinal) || - string.Equals(material.alphaMode, "BLEND", StringComparison.Ordinal); + // Don't export alpha channel if material was OPAQUE + var unnecessaryAlpha = string.Equals(material.alphaMode, "OPAQUE", StringComparison.Ordinal); - var index = textureManager.RegisterExportingAsSRgb(m.GetTexture("_MainTex"), hasTransparency); + var index = textureManager.RegisterExportingAsSRgb(m.GetTexture("_MainTex"), !unnecessaryAlpha); if (index != -1) { material.pbrMetallicRoughness.baseColorTexture = new glTFMaterialBaseColorTextureInfo()