From 4d89c5ca4b4b669042f1ce734a0a1d8ec45d5d10 Mon Sep 17 00:00:00 2001 From: junichi_hirose Date: Wed, 3 Oct 2018 18:20:10 +0900 Subject: [PATCH] standard material fix --- Scripts/Format/VRMMaterialImporter.cs | 10 +--------- Scripts/Format/glTF_VRM_Material.cs | 11 +++++------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Scripts/Format/VRMMaterialImporter.cs b/Scripts/Format/VRMMaterialImporter.cs index f505b2636..7f205db58 100644 --- a/Scripts/Format/VRMMaterialImporter.cs +++ b/Scripts/Format/VRMMaterialImporter.cs @@ -26,14 +26,6 @@ namespace VRM "VRM/UnlitTransparentZWrite", }; - static bool UseConverted(bool isPlaying, string shader, string prop) - { - if (isPlaying && prop == "_BumpMap") return true; - if (prop == "_MetallicGlossMap") return true; - if (prop == "_OcclusionMap") return true; - return false; - } - public override Material CreateMaterial(int i, glTFMaterial src) { if(i==0 && m_materials.Count == 0) @@ -92,7 +84,7 @@ namespace VRM var texture = Context.GetTexture(kv.Value); if (texture != null) { - if(UseConverted(Application.isPlaying, shaderName, kv.Key)) + if(texture.UseConverted(Application.isPlaying, shaderName, kv.Key)) { material.SetTexture(kv.Key, texture.Converted); } diff --git a/Scripts/Format/glTF_VRM_Material.cs b/Scripts/Format/glTF_VRM_Material.cs index ccc6d59fa..71fc7f0dc 100644 --- a/Scripts/Format/glTF_VRM_Material.cs +++ b/Scripts/Format/glTF_VRM_Material.cs @@ -119,6 +119,11 @@ namespace VRM } else { + foreach (var keyword in m.shaderKeywords) + { + material.keywordMap.Add(keyword, m.IsKeywordEnabled(keyword)); + } + // get properties //material.SetProp(prop); foreach (var kv in prop.Properties) @@ -175,12 +180,6 @@ namespace VRM throw new NotImplementedException(); } } - - } - - foreach (var keyword in m.shaderKeywords) - { - material.keywordMap.Add(keyword, m.IsKeywordEnabled(keyword)); } foreach (var tag in TAGS)