From 0ef14bad6fda1354d1686fd2c4781b1194f722a6 Mon Sep 17 00:00:00 2001 From: Chetan Date: Mon, 31 Jul 2023 15:38:51 +0800 Subject: [PATCH] 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. --- src/serializers/GltfSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serializers/GltfSerializer.cpp b/src/serializers/GltfSerializer.cpp index ef8c8c92f1..d6d88442c4 100644 --- a/src/serializers/GltfSerializer.cpp +++ b/src/serializers/GltfSerializer.cpp @@ -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";