When creating a GLTF file, make the material double sided to fix a bug where some surfaces were transparent. This will allow surfaces created from a mesh to be be viewed from all angles regardless of the shape of the mesh or the directions of the normals.

This commit is contained in:
Chetan
2023-07-31 15:38:51 +08:00
committed by Thomas Krijnen
parent e0b4c1a810
commit 08d8657588
+1 -1
View File
@@ -98,7 +98,7 @@ int GltfSerializer::writeMaterial(const IfcGeom::Material& style) {
base[3] = 1. - style.transparency();
}
json_["materials"].push_back({ {"pbrMetallicRoughness", {{"baseColorFactor", base}, {"metallicFactor", 0}}} });
json_["materials"].push_back({ {"doubleSided", true}, {"pbrMetallicRoughness", {{"baseColorFactor", base}, {"metallicFactor", 0}}} });
if (style.hasTransparency() && style.transparency() > 1.e-9) {
json_["materials"].back()["alphaMode"] = "BLEND";