Skip to content

fix(ifc): a surface style leaves a transparency it did not read unset instead of writing it opaque (#1820) - #1826

Merged
DrunkOnJava merged 4 commits into
mainfrom
fix/1820-unread-transparency
Nov 12, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
fix/1820-unread-transparency

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

An IFC surface style no longer writes a transparency of 0, fully opaque, for a material whose colour was read but whose transparency was not. IfcSurfaceStyleRendering.Transparency is optional in IFC4, so it is now left unset ($). Closes #1820.

Motivation

A material decoded from Global/Latest reads its colour and its transparency from two separate fields (elements::styling::Material::from_decoded), so the colour can be read without the transparency. step_writer then wrote mat.transparency.unwrap_or(0.0), a value no file gave. Revit's own export writes the material's own transparency (revit-ifc CategoryUtil). #1818 marks the same case alphaSource: "rvt-rs" in the GLB, and this PR makes the IFC fail closed on it.

Changes

  • src/ifc/step_writer.rs, the material loop: an unread transparency is written $, and a read one as before ({:.6}).
  • changelog.d/fixed/1820-unread-transparency.md.

Testing

Unit tests are banned here. The evidence is one Measure run.

The count first. #1818's probe marks each GLB material file or rvt-rs for its colour and its alpha. A model material is marked file/rvt-rs exactly when its colour was read and its transparency was not, which is the case this PR changes. Run 43291027145 found no such material on any of the 100 models whose probe output it keeps (#1818, comment 6834758003). Its six racadv shards and the held-out models were not counted.

Rows, registered before the run, for one unfiltered Measure of this head against main. It covers the samples of every year, the BIM4LCA models, the R2025 set, rac_advanced and the held-out models:

  1. Unchanged where the transparency was read. On every model, ifc.sha256 and every scorer file equal main's, or the only lines that differ are IFCSURFACESTYLERENDERING lines whose second attribute goes from 0.000000 to $. A model where an export moves is counted, and named unless it is held out, with how many lines moved. That count completes IFC surface styles: a material whose transparency was not read is written fully opaque (0) #1820's.
  2. The colour scorer holds. material_colours_vs_ifc is unchanged on every model. It reads Transparency or 0, so an unset value scores as the 0 it replaces. This row checks that the scorer still reads the file.
  • rustfmt --edition 2024 --check passes. CI runs the rest of the gate.
    Result, Measure 43298971854, 7f825b2c against main at eaf22753. It covered the samples of every year, the BIM4LCA offices and housing, the R2025 set, rac_advanced and the held-out models (counts only for the held-out ones):
  1. Holds, with no line moved. 125 of 125 ifc.sha256 and 101 of 101 diagnostics.json equal main's. No measured model has a material whose colour is read and whose transparency is not, so IFC surface styles: a material whose transparency was not read is written fully opaque (0) #1820's count is 0 on the measured corpus. The change is exercised only by the synthetic project, whose concrete now has no transparency read; CI validates its surface style there.
  2. Holds. The scorer diff holds only output that the head alone writes: probe output and areas_across_saves*. material_colours_vs_ifc is unchanged on every model.

Since that run, the branch has had a clean merge of main (75a4b423), the support-matrix line (b2dbabe7) and the synthetic fixture's assertions (d7f740f0). No export path changed, so the run carries.

  • Verified end to end on real Revit files: the Measure run above.
  • If this touches the IFC exporter: Core Interior's witness observations change only if one of its materials is read this way, and row 1 says whether one is.
  • N/A: not a performance change.

Audit-honesty checklist

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content. revit-ifc is cited by file and class only.
  • No new test fixtures

Breaking changes

None to the API. An IFC consumer that required Transparency to be set gets $ for a material whose transparency rvt-rs did not read. No measured model has one (row 1).

Screenshots or output samples

Before: #46=IFCSURFACESTYLERENDERING(#45,0.000000,$,$,$,$,$,$,.FLAT.);. After, for a material with no transparency read: #46=IFCSURFACESTYLERENDERING(#45,$,$,$,$,$,$,$,.FLAT.);.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Two commits since 7f825b2c, neither of which changes what Measure 43298971854 measures:

The synthetic project is not a Measure model, so the run's rows are unaffected.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 12, 2026 21:29
@DrunkOnJava
DrunkOnJava merged commit 63aacee into main Nov 12, 2026
63 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1820-unread-transparency branch November 12, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IFC surface styles: a material whose transparency was not read is written fully opaque (0)

1 participant