From a682ee59c20fba4add22401aaf48896932710a2a Mon Sep 17 00:00:00 2001 From: yutopp Date: Mon, 11 Mar 2019 19:04:14 +0900 Subject: [PATCH 1/2] Fix #214. Set _Cutoff parameters when alphaMode is MASK --- Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs b/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs index 8e9cd4b03..ed16a76b1 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs @@ -38,7 +38,7 @@ namespace UniGLTF } /// StandardShader vaiables - /// + /// /// _Color /// _MainTex /// _Cutoff @@ -163,7 +163,7 @@ namespace UniGLTF var prop = "_MetallicGlossMap"; material.SetTexture(prop, texture.ConvertTexture(prop)); } - + material.SetFloat("_Metallic", 1.0f); material.SetFloat("_GlossMapScale", 1.0f - x.pbrMetallicRoughness.roughnessFactor); } @@ -240,11 +240,12 @@ namespace UniGLTF material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); material.SetInt("_ZWrite", 1); + material.SetFloat("_Cutoff ", x.alphaCutoff); material.EnableKeyword("_ALPHATEST_ON"); material.DisableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.renderQueue = 2450; - + break; default: // OPAQUE From 11d6178990838cb57609a8b5da9d7e6cd50dd7ce Mon Sep 17 00:00:00 2001 From: yutopp Date: Wed, 13 Mar 2019 17:53:30 +0900 Subject: [PATCH 2/2] Trim unnecessary spaces --- Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs b/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs index ed16a76b1..9963fbff2 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs @@ -240,7 +240,7 @@ namespace UniGLTF material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); material.SetInt("_ZWrite", 1); - material.SetFloat("_Cutoff ", x.alphaCutoff); + material.SetFloat("_Cutoff", x.alphaCutoff); material.EnableKeyword("_ALPHATEST_ON"); material.DisableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON");