static void Export_Metallic(Material m, TextureExportManager textureManager, GLTFMaterial material) { int index = -1; if (m.HasProperty("_MetallicGlossMap")) { index = textureManager.ConvertAndGetIndex(m.GetTexture("_MetallicGlossMap"), new MetallicRoughnessConverter()); if (index != -1) { material.pbrMetallicRoughness.metallicRoughnessTexture = new GLTFMaterialMetallicRoughnessTextureInfo() { index = index, }; } } if (index != -1 && m.HasProperty("_GlossMapScale")) { material.pbrMetallicRoughness.metallicFactor = 1.0f; material.pbrMetallicRoughness.roughnessFactor = 1.0f - m.GetFloat("_GlossMapScale"); } else { if (m.HasProperty("_Metallic")) { material.pbrMetallicRoughness.metallicFactor = m.GetFloat("_Metallic"); } if (m.HasProperty("_Glossiness")) { material.pbrMetallicRoughness.roughnessFactor = 1.0f - m.GetFloat("_Glossiness"); } } }
static void Export_Normal(Material m, TextureExportManager textureManager, GLTFMaterial material) { if (m.HasProperty("_BumpMap")) { var index = textureManager.ConvertAndGetIndex(m.GetTexture("_BumpMap"), new NormalConverter()); if (index != -1) { material.normalTexture = new GLTFMaterialNormalTextureInfo() { index = index, }; } if (index != -1 && m.HasProperty("_BumpScale")) { material.normalTexture.scale = m.GetFloat("_BumpScale"); } } }
static void Export_Occlusion(Material m, TextureExportManager textureManager, GLTFMaterial material) { if (m.HasProperty("_OcclusionMap")) { var index = textureManager.ConvertAndGetIndex(m.GetTexture("_OcclusionMap"), new OcclusionConverter()); if (index != -1) { material.occlusionTexture = new GLTFMaterialOcclusionTextureInfo() { index = index, }; } if (index != -1 && m.HasProperty("_OcclusionStrength")) { material.occlusionTexture.strength = m.GetFloat("_OcclusionStrength"); } } }