-
Notifications
You must be signed in to change notification settings - Fork 3.7k
EXT_mesh_primitive_edge_visibility's material and line string #13002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for the pull request, @danielzhong! ✅ We can confirm we have a CLA on file for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements missing material and line string functionality for the EXT_mesh_primitive_edge_visibility glTF extension, extending edge rendering capabilities to support per-edge colors and explicit line string definitions.
- Parses
materialsandlineStringssections from the extension, extracting edge colors frombaseColorFactorand supporting per-lineString color overrides - Updates edge visibility pipeline to merge bitfield and line-string edges, generate edge-color attributes, and apply material colors in the shader
- Simplifies edge fragment shader to use override colors and remove debug color coding
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| EdgeVisibilityStageFS.glsl | Simplified fragment shader to apply edge colors from attributes instead of debug color coding |
| ModelComponents.js | Added edgeVisibility property to Primitive for storing extension data |
| EdgeVisibilityPipelineStage.js | Extended pipeline to handle line strings, generate edge color attributes, and process vertex colors |
| GltfLoader.js | Added parsing of material colors and line strings from extension during glTF load |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Description
This is a follow up PR to #12859. Primarily implementing the missing functionality for the material and line string section of
EXT_mesh_primitive_edge_visibility:Parse
EXT_mesh_primitive_edge_visibilitymaterialsandlineStringsduring glTF load, extractingbaseColorFactoras the default edge color and honoring per-lineString overrides.Expand the edge visibility pipeline to merge the bitfield and line-string edge data, generate optional edge-color attributes, and pass them through to the edge-rendering shader.
Update the edge fragment stage to use the override colors from
materialsectionMaterial:
Defines an accessor to the glTF material that supplies the edge color. This field is optional, when it is omitted the edges fall back to the mesh’s per‑vertex colors.
LineStrings
Defines accessors containing one or more line strings. Each entry may reference its own material; if not specified, the material defined in the section above is used, or otherwise the mesh’s vertex colors. Edges listed in this section must not be duplicated in the visibility bitfield (Handling during encoding: https://github.com/iTwin/imodel-native-internal/pull/888).
For more details please check:
EXT_mesh_primitive_edge_visibility README: Edge Visibility
Issue number and link
Previous PR: #12859
backlog issues: https://github.com/iTwin/itwin-graphics-backlog/issues/742
EXT_mesh_primitive_edge_visibility README: Edge Visibility
Khronos Group PR: Edge Visibility
Testing plan
Example Test files:
Two triangles: both have red fill color — one with a green outline and the other with a blue outline.

example.zip
2. Expecting: 1 blue cylinder (Both outline and fill color are the same)

cylinder.zip
Live DEMO
Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my change