Repository navigation
Description
Summary
First, thanks — the material pipeline is in better shape than the docs suggest. On a Revit 2024
project, material_object_tag / scan_material_appearances recovered 192 materials, 60 of them
with transparency > 0, and model_to_glb emitted 37 alphaMode: "BLEND" materials whose
baseColorFactor[3] is exactly 1 − transparency (Glass 0.9, Fassade - Glas 0.75,
Glass - Clear, Grey 0.64, Glass - Frosted 0.55, …). Those bindings reach 438 glazing panels and
66 light-fixture glass panes. So graphics-tab transparency is read and exported correctly — this is
not an alpha-emission bug report.
Two gaps remain for consumers that treat the glTF as geometry+appearance data:
- View/graphics overrides (V/G) are not read at all. A view that sets a category or an element
to 50% transparency exports fully opaque. There is no research module, nosupport-matrix.json
row, and no mention in the changelog forVisibilityGraphics/OverrideGraphicSettings/
per-view transparency. (All "override" hits in the changelog are IFC Export As overrides.) - When the element→material binding fails, the fallback throws away transparency. The
fallback iscategory_material()→category_colour()(src/ifc/gltf.rs:640-664), which
hardcodes alpha per IFC type and otherwise1.0. On the same project:- 6,804 node primitives total, 580 transparent;
Category IFCDUCTSEGMENT728,Category IFCPIPESEGMENT488,
Category IFCLIGHTFIXTURE149,Category IFCDOOR124,Category IFCRAILING14,
Category IFCSTAIR8,Category IFCWALL2,Category IFCBUILDINGELEMENTPROXY1
→ ~1,500 primitives that can only ever be opaque or the hardcoded category alpha.- This overlaps the open element→material assignment issue (Revit 2015 to 2023: family instances' materials: 70 windows and 14 railings lack Revit's, the default material is written on 72 elements Revit gives none (Vitoria) #1603); I am reporting it here
because the rendering consequence is transparency loss, not just a missing colour.
A related small inconsistency: category_colour() invents alpha for IFCWINDOW/IFCPLATE
(0.45) and IFCSPACE (0.12). Those values are not in the file. For a viewer palette that may be
intentional, but the same function feeds the glTF/IFC data export, so a consumer cannot tell
"Revit says 45% opaque" from "rvt chose 45% for windows". See the downstream-consumer note below for
why that distinction matters to a CAD database.
Environment
rvt0.17.0 (also checked0.18.0andmain:src/ifc/gltf.rsis byte-identical, so this is
not fixed after 0.17.0)- Input: Autodesk's published Revit 2024 sample project
rmeadvancedsampleproject.rvt
(39,055,360 bytes; German UI), from the Revit Sample Project Files page
(https://help.autodesk.com/view/RVT/2024/ENU/?guid=GUID-61EF2F22-3A1F-4317-B925-1E85F138BE88) - Consumption path:
run_export(&mut file, &ExportOptions::default())→model_to_glb(&run.model)
→ glTF reader that mapsbaseColorFactor(linear) back to sRGB andalphaMode == BLEND+
a < 1.0to an explicit opacity - Measurements taken from
revit_version = 2024,declared = 29,390element ids,
scan_material_names= 192,scan_material_appearances= 192
How YACR uses this crate
YACR (https://github.com/zenglanmu/yacr) is a Rust CAD viewer that imports .rvt by depending on
this crate, pinned exactly at =0.17.0 (no fork, no patch). It calls run_export(...) +
model_to_glb(&run.model) and then reads the GLB as data: node world transforms become meshes,
baseColorFactor becomes the entity colour, and alphaMode: "BLEND" + alpha becomes an explicit
opacity attribute stored on the entity. That opacity is both rendered (transparent pass: 580 of
6,804 batches in the sample below) and plotted (PDF /ca), so it is database state rather than a
viewer tint: a lost material binding makes an element silently opaque, and a V/G override has no
representation — and no diagnostic saying it was dropped.
Reproduction
- Open the sample project with the default export path, write the GLB.
- Count materials and node primitives by
baseColorFactor[3]:- 212 glTF materials, 37 with alpha < 1.0;
- 6,804 primitives, 580 with alpha < 1.0;
- every primitive on a
Category IFC*material isa = 1.0exceptIFCSPACE(0.12).
- In Revit, create/observe a view with a V/G override that makes a category translucent
(e.g. Walls → 50%); re-export. The override has no effect on any material or primitive. - For the binding gap, compare a type that draws with one material against an instance whose
material is only in its own parameters: the former gets the material (and its alpha), the latter
falls back toCategory IFC*.
Expected
- A documented, machine-readable statement of whether view/graphics overrides are part of the
export contract (asupport-matrix.jsonrow plus a line in the glTF/IFC docs would be enough for
consumers to state the boundary honestly). - If feasible: read
OverrideGraphicSettingstransparency for the exported view and let it override
the element/category alpha, with the same "no invented values" rule used for materials. - Category fallback should not fabricate alpha for data exports, or should mark it (e.g. the
material name already saysCategory …; an extras flag or a documentedalphaSourcewould make
it unambiguous).
Companion PR I can send (small, zero decoder risk)
tests/element_materials.rs checks material names through the IFC export, but no test asserts
the glTF alpha path — the transparency claim currently rests on the external IFC-scored probes
(RE-53). I can add tests/gltf_material_alpha.rs, corpus-free and deterministic:
- build
IfcModel { materials: vec![..], ..Default::default() }with
MaterialInfo { transparency: Some(0.75) }and an opaque sibling; model_to_glb(&model), parse the JSON chunk withserde_json(already a regular dependency);- assert the translucent material emits
alphaMode == "BLEND"and
pbrMetallicRoughness.baseColorFactor[3] ≈ 0.25, and the opaque one emits noalphaModewith
1.0; - optionally pin the category fallback deliberately: an
IfcEntity::BuildingElementwith
ifc_type = "IFCWINDOW"and no material emitsCategory IFCWINDOWwith alpha0.45, so the
fabricated value is a documented decision rather than an accident.
No Cargo.toml change is needed: the upstream [dev-dependencies] already enables
rvt = { path = ".", features = ["unstable-research"] } for dev targets, and serde_json is
already a regular dependency.
I can also add a corpus-gated companion check in the style of tests/element_materials.rs
(RVT_PROJECT_CORPUS_DIR, skip when absent) that walks the sample project and asserts the
transparent-material count, so a future regression in pbr.rs/gltf.rs fails loudly.
Notes
- I am not asking for a fork; we pin an exact version and would bump to whichever release carries
this. - Happy to split the work: the test PR now, the V/G override reading as a separate issue once you
decide it is in scope.
Activity
DrunkOnJava commentedon Nov 12, 2026
Thank you for the careful report, and for measuring it on a real project before writing. Your reading of the material path is right, and so is the main point: a consumer reading the GLB as data cannot tell a colour read from the file from one rvt-rs chose. Here is where each part stands.
1. View/graphics overrides. rvt-rs does not read them. Revit's own IFC export does not apply them either. In Autodesk's open-source exporter (
revit-ifc):BodyExporter.GetBestColourAndOpacitytakes an element's colour and opacity from its material (found from its geometry or a parameter), or else from its category's material;CategoryUtilwritesIfcSurfaceStyleRendering.Transparencyfrom that material's own transparency.Neither reads a view's overrides. rvt-rs follows Revit's export, so view overrides are outside the export contract. I will state that boundary in
docs/support-matrix.jsonand the glTF section ofdocs/viewer-api.md, so it is written down in one place rather than left to be inferred.2. The category fallback. One correction on scope: the IFC export does not use
category_colour.step_writerwrites a surface style only for a material whose colour was read from the file, with that material's own transparency, and an element with no material gets no style. The category colours and their alphas (0.45 for windows and plates, 0.12 for spaces) exist only in the GLB, where they are the viewer's palette. The viewer draws that same GLB, which is why they are there.You are right that the
Category …name does not settle it, since a Revit material can be named anything. I will mark the palette materials in the GLB itself, with a materialextrasentry saying the colour and alpha are rvt-rs's rather than the file's, and document it next to the viewer's palette.Giving an element with no material of its own its category's material, which is what Revit's export does, is the larger fix. rvt-rs reads a category's material today only for the layers of walls, floors, roofs and ceilings that take it (RE-91, RE-115, RE-206). Extending that to ducts, pipes, light fixtures and the rest is a measured change against Revit's exports, and it belongs with #1603.
3. Tests. Thank you for offering, but this repository does not take unit tests: CONTRIBUTING.md ("Unit tests are banned, with one exception"). That rules out a test that builds an
IfcModelby hand and reads back its alpha, and one that pins the 0.45 we chose. A count of transparent materials on one project would only pin our own number.The check that fits here is end to end against Revit's export.
tools/re/glb_material_colours_vs_ifc.pyalready compares each family instance's GLB colour with the surface style colour in Revit's own IFC4 export of the same file. It does not yet compare transparency. A pull request that adds1 − alphaagainst Revit'sIfcSurfaceStyleRendering.Transparencyto that scorer would be welcome, and it would test exactly the claim you measured.I will link the pull request for (1) and (2) here when it is up.
DrunkOnJava commentedon Nov 12, 2026
The pull request for (1) and (2) is #1818. Every GLB material now carries
extras.colourSource:"file"where its colour and alpha are the Revit material's own,"rvt-rs"where rvt-rs chose them. The category palette is"rvt-rs", its translucent windows and faint rooms included. A support-matrix row states that view overrides are not read, with therevit-ifcreason. Its Measure run includes a probe on your file,rmeadvancedsampleproject2024, counting the materials and primitives by source and translucency; I will post those counts on the pull request.fix(ifc): a GLB material marks its colour and its alpha apart (#1812)
DrunkOnJava commentedon Nov 12, 2026
The counts from #1818's run are in (comment), along with one change since my last note.
The mark is now two fields. A decoded material can have its colour read and its transparency not. So
extrassays each separately:{ "colourSource": ..., "alphaSource": ... }, each"file"or"rvt-rs".On your file,
rmeadvancedsampleproject2024:file/file, 36 of them translucent.rvt-rs/rvt-rs, and one of those is translucent: the palette'sIFCSPACE(alpha 0.12).On all 100 models the run probed, no material had its colour read and its transparency not, or the reverse. Every export is byte-identical to
main's.The IFC side. The IFC used to write a transparency of 0 for a material whose transparency was not read, so it claimed opaque where nothing said so. #1826 leaves that attribute unset (
$) instead. No measured model has such a material, and its Measure run, held-out models included, will confirm that count.feat(ifc)!: each GLB material says whether its colour and its alpha a…
DrunkOnJava commentedon Nov 12, 2026
#1826 has landed. When rvt-rs has not read a material's transparency, the IFC now leaves
IfcSurfaceStyleRendering.Transparencyunset ($) rather than writing 0.Its Measure run (43298971854) confirms the count from my last note. It covered the samples of every year, the BIM4LCA models, the R2025 set,
rac_advancedand the held-out models:main's byte for byte;So no real file measured so far shows the change. Only CI's synthetic project has such a material, and CI validates its surface style there.
With #1818 and #1826 in, rvt-rs marks every colour and alpha it chose itself, in the GLB as data and in the IFC by leaving the value unset. The category-material fallback that Revit's export uses stays with #1603.
DrunkOnJava commentedon Nov 14, 2026
Closing, since every part of this is now in a release or tracked elsewhere:
docs/support-matrix.jsonrowview-graphics-overrides(unsupported) says they are not read, as Revit's own IFC export does not apply them (revit-ifc,BodyExporter.GetBestColourAndOpacity).extras: { colourSource, alphaSource },"file"or"rvt-rs"(feat(ifc)!: each GLB material says whether its colour and its alpha are the Revit file's or rvt-rs's (#1812) #1818, documented indocs/viewer-api.md). The IFC leavesIfcSurfaceStyleRendering.Transparencyunset where the transparency was not read, instead of writing 0 (fix(ifc): a surface style leaves a transparency it did not read unset instead of writing it opaque (#1820) #1826).Your offer of a transparency comparison in
tools/re/glb_material_colours_vs_ifc.py(1 − alphaagainst Revit'sIfcSurfaceStyleRendering.Transparency) still stands, if you want to send it. Thanks again for measuring it on a real project.zenglanmu commentedon Nov 14, 2026
thanks for your fix, i will try it later. Btw, viewports in revit can set its own transparency alpha for certain elements (or filtered out elements) if i remember correctly. Do your have plan for this or it's already implemented
DrunkOnJava commentedon Nov 14, 2026
@zenglanmu thanks for trying the fix. Per-view overrides are not implemented and not scheduled: transparency, colour, halftone and visibility set in a view, by category, element or filter, are not read, and the support matrix row
view-graphics-overridessaysunsupported.The file does declare them. Its schema has
OverrideGraphicSettings, with a surfaces-transparency override among its fields, and the filter classesParameterFilterElementandSelectionFilterElement. What is not known is where an instance sits and what it binds to. Revit's own IFC export ignores view overrides, so there is no export to measure against either.I opened #1973 to track it, with the first step (count the records) and what would make it measurable. If you can say what you need it for, and share a small model that is not confidential, with a view that sets a transparency override and a screenshot of that view, that gives the issue the oracle it lacks.
fix(ifc): keep material alpha for glTF bodies drawn whole
fix(ifc): a glTF body drawn whole whose materials are all transparent…