diff --git a/Scripts/Format/VRMMaterialImporter.cs b/Scripts/Format/VRMMaterialImporter.cs index 73cffe612..12d2d9556 100644 --- a/Scripts/Format/VRMMaterialImporter.cs +++ b/Scripts/Format/VRMMaterialImporter.cs @@ -9,7 +9,7 @@ namespace VRM public class VRMMaterialImporter : MaterialImporter { List m_materials; - public VRMMaterialImporter(ImporterContext context, List materials) : base(new ShaderStore(context, "VRM/UnlitTexture"), context) + public VRMMaterialImporter(ImporterContext context, List materials) : base(new ShaderStore(context), context) { m_materials = materials; } diff --git a/Scripts/Format/glTF_VRM_Material.cs b/Scripts/Format/glTF_VRM_Material.cs index 71fc7f0dc..664a701da 100644 --- a/Scripts/Format/glTF_VRM_Material.cs +++ b/Scripts/Format/glTF_VRM_Material.cs @@ -27,6 +27,14 @@ namespace VRM // "Queue", }; + private static readonly string[] VRMExtensionShaders = new string[] + { + "VRM/UnlitTransparentZWrite", + "VRM/MToon" + }; + + private static readonly string VRM_USE_GLTFSHADER = "VRM_USE_GLTFSHADER"; + protected override void SerializeMembers(GLTFJsonFormatter f) { f.KeyValue(() => name); @@ -112,6 +120,12 @@ namespace VRM renderQueue = m.renderQueue, }; + if (!VRMExtensionShaders.Contains(m.shader.name)) + { + material.shader = VRM_USE_GLTFSHADER; + return material; + } + var prop = PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name); if (prop == null) { diff --git a/UniGLTF b/UniGLTF index fae0f5e1f..8f04b09b5 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit fae0f5e1f44f8c0fe06c9fd2c61ac99e513c7141 +Subproject commit 8f04b09b5cb7c12ad0f49b6aaa66800029258f77