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
parent b044ddfaa2
commit 0ef14bad6f
+1 -1
View File
@@ -98,7 +98,7 @@ int GltfSerializer::writeMaterial(const ifcopenshell::geometry::taxonomy::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.transparency == style.transparency && style.transparency > 1.e-9) {
json_["materials"].back()["alphaMode"] = "BLEND";