Exemplo n.º 1
0
        public MaterialDescriptor Get(GltfData data, int i)
        {
            // mtoon URP "MToon" shader is not ready. import fallback to unlit
            // unlit "UniUnlit" work in URP
            if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out var matDesc))
            {
                return(matDesc);
            }
            // pbr "Standard" to "Universal Render Pipeline/Lit"
            if (GltfPbrUrpMaterialImporter.TryCreateParam(data, i, out matDesc))
            {
                return(matDesc);
            }
            // fallback
#if VRM_DEVELOP
            Debug.LogWarning($"material: {i} out of range. fallback");
#endif
            return(new MaterialDescriptor(
                       GltfMaterialDescriptorGenerator.GetMaterialName(i, null),
                       GltfPbrMaterialImporter.ShaderName,
                       null,
                       new Dictionary <string, TextureDescriptor>(),
                       new Dictionary <string, float>(),
                       new Dictionary <string, Color>(),
                       new Dictionary <string, Vector4>(),
                       new Action <Material>[] {}));
        }
        public MaterialDescriptor Get(GltfData data, int i)
        {
            // mtoon
            if (Vrm10MToonMaterialImporter.TryCreateParam(data, i, out MaterialDescriptor matDesc))
            {
                return(matDesc);
            }
            // unlit
            if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc))
            {
                return(matDesc);
            }
            // pbr
            if (GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc))
            {
                return(matDesc);
            }
            // fallback
#if VRM_DEVELOP
            Debug.LogWarning($"material: {i} out of range. fallback");
#endif
            return(new MaterialDescriptor(
                       GltfMaterialDescriptorGenerator.GetMaterialName(i, null), GltfPbrMaterialImporter.ShaderName,
                       null,
                       new Dictionary <string, TextureDescriptor>(),
                       new Dictionary <string, float>(),
                       new Dictionary <string, Color>(),
                       new Dictionary <string, Vector4>(),
                       new Action <Material>[] {}));
        }
        public MaterialDescriptor Get(GltfData data, int i)
        {
            // mtoon
            if (!Vrm10MToonMaterialImporter.TryCreateParam(data, i, out MaterialDescriptor matDesc))
            {
                // unlit
                if (!GltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc))
                {
                    // pbr
                    if (!GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc))
                    {
                        // fallback
#if VRM_DEVELOP
                        Debug.LogWarning($"material: {i} out of range. fallback");
#endif
                        return(new MaterialDescriptor(GltfMaterialDescriptorGenerator.GetMaterialName(i, null), GltfPbrMaterialImporter.ShaderName));
                    }
                }
            }
            return(matDesc);
        }
Exemplo n.º 4
0
        public MaterialDescriptor Get(GltfData data, int i)
        {
            // legacy "VRM/UnlitTransparentZWrite"
            if (VRMUnlitTransparentZWriteMaterialImporter.TryCreateParam(data, m_vrm, i, out var matDesc))
            {
                return(matDesc);
            }

            // mtoon
            if (VRMMToonMaterialImporter.TryCreateParam(data, m_vrm, i, out matDesc))
            {
                return(matDesc);
            }

            // unlit
            if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc))
            {
                return(matDesc);
            }

            // pbr
            if (GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc))
            {
                return(matDesc);
            }

            // fallback
            Debug.LogWarning($"fallback");
            return(new MaterialDescriptor(
                       GltfMaterialDescriptorGenerator.GetMaterialName(i, null),
                       GltfPbrMaterialImporter.ShaderName,
                       null,
                       new Dictionary <string, TextureDescriptor>(),
                       new Dictionary <string, float>(),
                       new Dictionary <string, Color>(),
                       new Dictionary <string, Vector4>(),
                       new Action <Material>[] {}));
        }