-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Support for BENTLEY_materials_line_style glTF Extension #13110
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
Co-authored-by: Copilot <[email protected]>
…lZ/BENTLEY_materials_line_style
…aterials_line_style
|
Thank you for the pull request, @danielzhong! ✅ We can confirm we have a CLA on file for you. |
|
Your branch appears to contain all of the changes from #13093 too. That's unintentional, right? |
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.
Validation error: "VALUE_NOT_IN_RANGE | Value 1 is out of range. | /bufferViews/5/byteStride"
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.
Fixed. Thanks
|
Fixed silhouette normal decode issues: iTwin/itwinjs-core#8879 |
Description
BENTLEY_materials_line_stylegltfmaterial extension in CesiumJS. This extension enables CAD-style line visualization with variable width and dash patterns. The proposed specification can be found here.in this commit: fe13f48
EXT_mesh_primitive_edge_visibilitygltf extension by switching fromgl_linesto tessellated quads rendered asgl_triangles, enabling line-width support inOverview (
BENTLEY_materials_line_style)width: 5,pattern: 61680The BENTLEY_materials_line_style extension allows glTF materials to specify:
width: Line thickness in screen pixelspattern: A 16-bit repeating on/off dash pattern (each bit = 1 screen pixel)This PR allows CesiumJS to process and apply the above extension when loading glTF files. This means lines and edges will be able to have customizable width and pattern properties specified and respected in CesiumJS when loaded via glTF.
Implementation Details:
Because variable line width is required (and many graphics APIs including WebGL do not support
gl_lineprimitives with width > 1), this PR refactors theEXT_mesh_primitive_edge_visibilityimplementation to use quad-based rendering instead of the previous gl_line approach. Each line segment is tessellated into a quad (two triangles) that is dynamically expanded perpendicular to the edge direction based on the material'swidthproperty.The 16-bit dash pattern is applied in the fragment shader by testing individual bits against the screen-space position along the line, providing pixel-perfect pattern rendering that remains stable under camera movement.
Changes:
Added support for
BENTLEY_materials_line_styleinGltfLoader.jsandMaterialPipelineStage.jsRefactored edge rendering from line primitives to quad-based geometry in
EdgeVisibilityPipelineStage.jsImplemented vertex shader expansion logic for variable-width lines in
EdgeVisibilityStageVS.glslImplemented fragment shader pattern matching using bit extraction in
EdgeVisibilityStageFS.glslAdded
u_lineWidthandu_linePatternuniforms to the edge rendering pipelineTo test these changes locally:
http-server ./ --cors=X-Correlation-Idline_style.zip
line&point_style.zip
npm run build-sandcastleand in sandcastle search for theStyled glTF Linesexample.Note:
This PR may include changes from other currently open PRs, this PR was built on top of the following PRs:
EXT_mesh_primitive_edge_visibility's material and line string:(This PR supersedes the previous PR (#12859). All changes have been moved here and mainly focus on completing the material and line string support for EXT_mesh_primitive_edge_visibility. Please refer to the links for more details.)
Implementation for
BENTLEY_materials_point_style:Waiting for this PR to be merged before removing the unnecessary changes shown in this PR:
#13093
Issue number and link
#12889
Testing plan
Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my change