diff --git a/Assets/VRM/Runtime/IO/VRMMToonMaterialImporter.cs b/Assets/VRM/Runtime/IO/VRMMToonMaterialImporter.cs index 21ce7553d..56c9c95a9 100644 --- a/Assets/VRM/Runtime/IO/VRMMToonMaterialImporter.cs +++ b/Assets/VRM/Runtime/IO/VRMMToonMaterialImporter.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using UniGLTF; using UnityEngine; using VRMShaders; @@ -8,6 +9,19 @@ namespace VRM { public static class VRMMToonMaterialImporter { + static string[] MToonTextureSlots = new string[]{ + "_MainTex", + "_ShadeTexture", + "_BumpMap", + "_EmissionMap", + "_OutlineWidthTexture", + "_ReceiveShadowTexture", + "_RimTexture", + "_ShadingGradeTexture", + "_SphereAdd", + "_UvAnimMaskTexture", + }; + public static bool TryCreateParam(GltfData data, glTF_VRM_extensions vrm, int materialIdx, out MaterialDescriptor matDesc) { @@ -60,7 +74,10 @@ namespace VRM foreach (var kv in vrmMaterial.vectorProperties) { // vector4 exclude TextureOffsetScale - if (vrmMaterial.textureProperties.ContainsKey(kv.Key)) continue; + if (MToonTextureSlots.Contains(kv.Key)) + { + continue; + } var v = new Vector4(kv.Value[0], kv.Value[1], kv.Value[2], kv.Value[3]); vectors.Add(kv.Key, v); } diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/Material/Importer/MaterialFactory.cs b/Assets/VRMShaders/GLTF/IO/Runtime/Material/Importer/MaterialFactory.cs index a349269a1..6c6c39e4a 100644 --- a/Assets/VRMShaders/GLTF/IO/Runtime/Material/Importer/MaterialFactory.cs +++ b/Assets/VRMShaders/GLTF/IO/Runtime/Material/Importer/MaterialFactory.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using UnityEngine;