Yo @bghgary … this is how i am emulating render type for alpha mode on a standard material in my GLTF Extension… baseColorAlpha = material.pbrMetallicRoughness.baseColorFactor[3];
// ALPHA PROPERTIES
babylonMaterial.alpha = baseColorAlpha; // Note: Default Base Color Alpha
const alphaMode = material.alphaMode || BABYLON.GLTF2.MaterialAlphaMode.OPAQUE;
switch (alphaMode) {
case BABYLON.GLTF2.MaterialAlphaMode.OPAQUE: { // Note: Normal-Mode (OPAQUE)
babylonMaterial.alpha = 1.0; // Note: Reset Alpha To Opaque
break;
}
case BABYLON.GLTF2.MaterialAlphaMode.MASK: { // Note: Transparency-Cutout (ALPHATEST)
babylonMaterial.alpha = baseColorAlpha; // Reset To Base Color Alpha
babylonMaterial.alphaCutOff = (material.alphaCutoff == undefined ? 0.5 : material.alphaCutoff);
// Dunno About This
//if (babylonMaterial.diffuseTexture) {
// babylonMaterial.diffuseTexture.hasAlpha = true;
//}
break;
}
case BABYLON.GLTF2.MaterialAlphaMode.BLEND: { // Note: Transparency (ALPHABLEND)
babylonMaterial.alpha = baseColorAlpha; // Reset To Base Color Alpha
// Dunno About This
//if (babylonMaterial.diffuseTexture) {
// babylonMaterial.diffuseTexture.hasAlpha = true;
// babylonMaterial.useAlphaFromDiffuseTexture = true;
//}
break;
}
default: {
throw new Error(`${context}/alphaMode: Invalid value (${material.alphaMode})`);
}
}
Am i close or WAY OFF in trying to emulate the Transparency (BLEND) and Transparency-Cutoff (MASK)
???