Skip to content

Commit 7f679ba

Browse files
agviegasclaude
andcommitted
feat(IfcImporter): add doubleSidedMaterials option
Some exporters (e.g. certain Revit pipelines) produce geometry whose winding is not consistent, so front-face-only rendering can hide those faces. Add an opt-in doubleSidedMaterials flag on IfcImporter that makes the generated materials render both sides (renderedFaces TWO). Defaults to false to keep the previous front-face behavior. Refs #233 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9985277 commit 7f679ba

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

packages/fragments/src/Importers/IfcImporter/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ export class IfcImporter {
130130
*/
131131
replaceSiteElevation = true;
132132

133+
/**
134+
* Whether the generated materials should render both faces (double-sided)
135+
* instead of just the front face.
136+
* @remarks Some exporters (e.g. certain Revit pipelines) produce geometry
137+
* whose winding is not consistent, so front-face-only rendering can hide
138+
* those faces. Enable this to render both sides. Defaults to false
139+
* (front-face only) to match the previous behavior.
140+
*/
141+
doubleSidedMaterials = false;
142+
133143
/**
134144
* If set, ignores the items that are further away to the origin than this value.
135145
* Keep in mind that if your IFC is correctly georreferenced, this value should never

packages/fragments/src/Importers/IfcImporter/src/geometry/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,11 @@ export class IfcGeometryProcessor {
466466

467467
materialsLocalIds.push(nextId++);
468468

469-
TFB.Material.createMaterial(
470-
builder,
471-
r,
472-
g,
473-
b,
474-
a,
475-
TFB.RenderedFaces.ONE,
476-
0,
477-
);
469+
const renderedFaces = this._serializer.doubleSidedMaterials
470+
? TFB.RenderedFaces.TWO
471+
: TFB.RenderedFaces.ONE;
472+
473+
TFB.Material.createMaterial(builder, r, g, b, a, renderedFaces, 0);
478474
}
479475

480476
const materials = builder.endVector();

0 commit comments

Comments
 (0)