Repository navigation
fix(ifc): a glTF body drawn whole whose materials are all transparent takes their alpha (#1812) - #2109
Conversation
…y name and alpha, and each translucent element's materials (#2109)
…y name and alpha, and each translucent element's materials (#2109)
|
Thank you, @zenglanmu, for this and for #1812. What I read on Where it applies. The changed branch takes every element that has no material of its own and no single material ( Four things to settle before it can land.
Nothing is needed from you meanwhile. Once the rule below is decided, I push points 1, 3 and 4 to your branch, as "Allow edits" permits. The ruleset also checks a pull request's own commits for signatures, so a squash does not cure an unsigned one: that push carries your commit re-signed, with your authorship. What the runs can and cannot see. Its Measure (44734182906) cannot see an alpha: Measure deletes each GLB after its scorers run, and the GLB scorers read model materials and bodies, not category colours. So a probe on Rows, registered before either run is read.
The rule itself is a visual choice for the maintainer. A body drawn whole at its most transparent material's alpha shows a glass door as glass, and also a door with a small vision panel as see-through, or a wall with one thin glass layer. It goes to Griffin with the probe's counts beside it, and I will post his answer here. |
|
The probe, read against the rows above (44735619849, 101 models): rows 1, 2, 3, 4 and 6 are read; row 5 waits for the Measure. The Measure's held-out offices job failed fetching the held-out models, before this head's code ran; its failed jobs are rerun when the run ends.
So the rule reaches doors on 55 files and light fixtures on 32, not only the boxes the description names. That is the visual choice above, and it goes to Griffin with these counts now. |
…its type's tag-to-material map (#2109)
An element whose body the glTF exporter draws as one piece (Revit 2008-2023 box bodies, and any body with no layers) kept its category colour and the category's opaque alpha. The material's own transparency was lost whenever the element's type drew in several materials (a glass door's glass + frame), or a single material/profile whose colour was not read. Take the minimum alpha of the associated materials that were read: - material constituent sets of several materials, or one whose colour was not read; - single-profile material sets with an unread colour; - material layer sets whose layers the body is not drawn in. All-opaque or unread materials keep the category alpha. The chosen alpha is still marked extras.alphaSource = "rvt-rs", and the material becomes double-sided / BLEND only when translucent. Adds a tests/ contract target (gltf_element_alpha) that builds the IfcModel directly and checks the glTF document; no unit tests. Follow-up to DrunkOnJava#1812 (alpha emission) and the open DrunkOnJava#1603 (missing materials).
… it is made of is transparent, at the least transparent one's alpha; windows keep their tint (DrunkOnJava#2109)
c3c5b9a to
fef2b7a
Compare
|
Griffin's call on the rule: an element is drawn see-through only where every material it reads is transparent. A door or a lamp with a glass part keeps its category's colour, as on
The Measure's rerun is in (44734182906): rows 1 and 5 above hold, with all 120 exports and 102 What I pushed to your branch (
Rows, registered before any run of
Nothing is needed from you meanwhile. |
|
The rows for
So on the open models the rule reaches |
|
Merged as |
Summary
A body the glTF exporter draws whole, the shared box or its own mesh, in its category's colour, now takes the alpha of its materials where every one of them is transparent: on the open models,
rac_basic's 8 water glasses on each of its 13 saves. A door, lamp or window with a glass part stays as onmain, since which part of a saved mesh is the glass is not read. Before, such a body kept the category's alpha, so the transparency of its own materials was lost. @zenglanmu's Revit 2024 project showed it: by their count, 17 glass doors and 149 glass light fixtures drawn opaque in the GLB. #1818 fixed the emission of material alpha and addedextras.alphaSource; the element-to-material selection for whole bodies still fell back to the category material. #1603 (missing materials on 2015 to 2023 family instances) is separate and not addressed here.The rule, after review (Griffin's call): a body drawn whole in its category's colour takes the alpha of its materials only where it reads at least one and every one is read as transparent, and then the least transparent one's, so no part is drawn fainter than it is (
all_transparent_alpha). The materials are its constituent set (several materials, or one whose colour was not read), a single-profile set whose colour was not read, or a layer set it is not drawn in. A body that also holds an opaque material, a material whose transparency was not read or lies outside 0 to 1, or a layer or index that names no material, keeps its category's alpha. Drawn at its glass's alpha, a door with a glass panel would look all glass, and which part of a saved mesh is the glass is not read (#2112).main.Category <class> transparent,BLENDand double-sided, withcolourSource"rvt-rs"andalphaSource"file": its alpha is one minus a Revit material's own transparency.MaterialExtrasanddocs/viewer-api.mdsay so.main.Geometry, the IFC export and
diagnostics.jsonare unchanged.Original change by @zenglanmu (
5686cddd, re-signed with their authorship); the rule above, the docs and the tests by the maintainer on review (fef2b7ad).Testing
all_transparent_alpha's failure modes insrc/ifc/gltf.rs(no material; a transparency not read; an opaque frame beside glass; differing transparencies; a transparency outside 0 to 1, NaN or infinite; one fully transparent material). It is a pure helper, the one kind of unit test this repository takes; they run in CI's fast run onfef2b7ad, which is green. The hand-built-model test first proposed is removed.diagnostics.jsonidentical and no scorer line moving;probe_2109_whole_body_alphaon this head and onmain(44756695010, 44756704637) finds 104IfcBuildingElementProxyonrac_basic's 13 saves newly see-through (16 at alpha 0.05, 88 at 0.15), no other class, windows, curtain panels and rooms as onmain, and no category material written twice.Evidence boundary
The Revit 2024 project that exposed this is not redistributable. Which elements the rule reaches on the open models is the probe's count above: on @zenglanmu's project, the glass doors and fixtures stay opaque unless every material they read is transparent, so a downstream patch carrying the first rule still differs from this.