vrm shader fallback fix

This commit is contained in:
junichi_hirose 2018-10-10 23:22:44 +09:00
parent 185f6b8f3d
commit de2d83d01e
3 changed files with 16 additions and 2 deletions

View File

@ -9,7 +9,7 @@ namespace VRM
public class VRMMaterialImporter : MaterialImporter
{
List<glTF_VRM_Material> m_materials;
public VRMMaterialImporter(ImporterContext context, List<glTF_VRM_Material> materials) : base(new ShaderStore(context, "VRM/UnlitTexture"), context)
public VRMMaterialImporter(ImporterContext context, List<glTF_VRM_Material> materials) : base(new ShaderStore(context), context)
{
m_materials = materials;
}

View File

@ -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)
{

@ -1 +1 @@
Subproject commit fae0f5e1f44f8c0fe06c9fd2c61ac99e513c7141
Subproject commit 8f04b09b5cb7c12ad0f49b6aaa66800029258f77