forked from KhronosGroup/glTF
-
Notifications
You must be signed in to change notification settings - Fork 9
BENTLEY_materials_line_style #89
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
Open
markschlosseratbentley
wants to merge
33
commits into
vendor-extensions
Choose a base branch
from
BENTLEY_materials_line_style
base: vendor-extensions
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
339604b
draft wip
markschlosseratbentley ab1e2b6
update README & schema
danielzhong 546eb74
Update README.md
danielzhong 915a7b0
Update README.md
danielzhong 1fbbb15
rename
danielzhong dd40552
Update material.BENTLEY_material_line_style.schema.json
danielzhong b93d51d
Update extensions/2.0/Vendor/BENTLEY_material_line_style/README.md
danielzhong 17f8c12
Update extensions/2.0/Vendor/BENTLEY_material_line_style/README.md
danielzhong d1cbb59
Update extensions/2.0/Vendor/BENTLEY_material_line_style/README.md
danielzhong f82a869
Update extensions/2.0/Vendor/BENTLEY_material_line_style/README.md
danielzhong 32923b7
Update README.md
danielzhong 00ad2d4
copyright
markschlosseratbentley 14bea10
contributor list
markschlosseratbentley 2b3fc30
Update material.BENTLEY_material_line_style.schema.json
danielzhong 0ec3508
materials plural
markschlosseratbentley 98d282c
materials plural
markschlosseratbentley 535c58b
plural
markschlosseratbentley e3db76e
update
danielzhong 2c4af97
Update README.md
danielzhong 7b35020
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
danielzhong 5bcbd1d
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
danielzhong 35e0630
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
danielzhong 4c4c1c4
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
danielzhong 384fe75
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
danielzhong c6a75f2
Update README.md
danielzhong 10ada04
Merge branch 'BENTLEY_materials_line_style' of https://github.com/Ces…
danielzhong 42e2055
Update README.md
danielzhong 28cfc25
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/schema/mate…
danielzhong 57d373b
Add CumulativeDistance
danielzhong 3368ec3
Update extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
danielzhong f8ed3d0
update
danielzhong 8563506
Update README.md
danielzhong 6823cd3
Update README.md
danielzhong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
extensions/2.0/Vendor/BENTLEY_materials_line_style/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| <!-- | ||
| Copyright 2026 Bentley Systems, Incorporated | ||
| SPDX-License-Identifier: CC-BY-4.0 | ||
| --> | ||
|
|
||
| # BENTLEY_materials_line_style | ||
|
|
||
| ## Contributors | ||
|
|
||
| * Paul Connelly, Bentley Systems, [@pmconne](https://github.com/pmconne) | ||
| * Daniel Zhong, Bentley Systems, [@danielzhong](https://github.com/danielzhong) | ||
| * Mark Schlosser, Bentley Systems, [@markschlosseratbentley](https://github.com/markschlosseratbentley) | ||
|
|
||
| ## Status | ||
|
|
||
| Draft | ||
|
|
||
| ## Dependencies | ||
|
|
||
| Written against the glTF 2.0 spec. | ||
|
|
||
| ## Overview | ||
|
|
||
| Lines are fundamental elements in many 3D modeling and computer-aided design (CAD) environments. They are used to annotate two- and three-dimensional visualizations, with variations in width and dash patterns conveying semantic meaning or emphasis. | ||
|
|
||
| The `BENTLEY_materials_line_style` extension defines a method for describing the visual style of lines within glTF material. It enables authors to specify line thickness and a repeating dash pattern. | ||
| The extension is also applied to line-type primitives to indicate the presence of a per-vertex cumulative distance attribute semantic used for stable dash alignment. | ||
|
|
||
| This extension introduces two primary properties controlling line appearance: | ||
|
|
||
| * `width`: the pixel width of the rendered line | ||
| * `pattern`: an unsigned integer whose bits represent a repeating on/off pattern along the line | ||
|
|
||
| ## Specifying Line Styles | ||
|
|
||
| The `BENTLEY_materials_line_style` extension is applied to a material. When that material is used by any line-type primitive, or by the edges described by the [`EXT_mesh_primitive_edge_visibility`](https://github.com/KhronosGroup/glTF/pull/2479) extension, it defines the **width** and **pattern** with which those lines are rendered. | ||
|
|
||
| When applied to a line-type primitive, the extension indicates that the primitive supplies the per-vertex cumulative distance attribute semantic defined below. | ||
|
|
||
| ### Width | ||
|
|
||
| The `width` property specifies the line's thickness **in screen pixels**. The value of `width` must be greater than `0`. | ||
|
|
||
| For each line segment, implementations should extrude geometry by half this width on each side of the segment's centerline, perpendicular to its direction. Implementations should also insert triangles at the joints between line segments comprising a continuous line string or line loop, when appropriate to visually round out the joints. | ||
|
|
||
| ### Pattern | ||
|
|
||
| The `pattern` property specifies a **repeating on/off bit pattern** applied along the length of the line, encoded as a 16-bit unsigned integer. Each bit corresponds to one screen pixel: | ||
|
|
||
| * Bit value `1`: lit (on) | ||
| * Bit value `0`: unlit (off) | ||
|
|
||
| The least significant bit (bit 0) corresponds to the start of the pattern. The pattern repeats cyclically after all 16 bits have been used. If a pattern requires fewer than 16 bits, its unused higher-order bits must be `0`. | ||
|
|
||
| The pattern must be applied continuously along each continuous line string or line loop so that connected segments remain visually consistent. Implementations must not restart the pattern at intermediate vertices within the same line string. | ||
|
|
||
| Example patterns: | ||
|
|
||
| | Bit Pattern (hex) | Binary | Description | | ||
| |--------------------|---------|----------------| | ||
| | `0xFFFF` | 1111111111111111 | solid line | | ||
| | `0xAAAA` | 1010101010101010 | dotted line | | ||
| | `0xF0F0` | 1111000011110000 | dashed line | | ||
| | `0xC3C3` | 1100001111000011 | custom pattern | | ||
|
|
||
| ### Cumulative Distance (Primitive Attribute) | ||
|
|
||
| When the extension is applied to a line-type primitive, the primitive must supply a vertex attribute with the semantic: | ||
|
|
||
| * `BENTLEY_materials_line_style:CUMULATIVE_DISTANCE` | ||
|
|
||
| This attribute provides a per-vertex **cumulative distance** from the start of the line string, expressed in model/world units. Implementations use this distance to align the dash pattern consistently along the full line string. | ||
|
|
||
| The accessor for this attribute: | ||
|
|
||
| * **MUST** be `SCALAR`. | ||
| * **MUST** have a count matching the primitive's vertex count. | ||
| * **MUST** use component type `FLOAT` **OR** a normalized integer type. | ||
|
|
||
| Values are expected to be non-decreasing along each line string. | ||
|
|
||
| ## Implementation Notes | ||
|
|
||
| Because many graphics APIs do not support line primitives with a width larger than 1, tessellation is generally required to draw wide lines. | ||
|
|
||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @danielzhong Consider adding "Known Implementations" section like https://github.com/CesiumGS/glTF/blob/vendor-extensions/extensions/2.0/Vendor/BENTLEY_materials_point_style/README.md#known-implementations |
||
| ## JSON Schema | ||
|
|
||
| * [material.BENTLEY_materials_line_style.schema.json](schema/material.BENTLEY_materials_line_style.schema.json) | ||
| * [mesh.primitive.BENTLEY_materials_line_style.schema.json](schema/mesh.primitive.BENTLEY_materials_line_style.schema.json) | ||
|
|
||
| ## Known implementations | ||
|
|
||
| * [iTwin.js](https://github.com/iTwin/itwinjs-core/pull/8856) | ||
| * [Cesium.js](https://github.com/CesiumGS/cesium/pull/13110) | ||
30 changes: 30 additions & 0 deletions
30
...dor/BENTLEY_materials_line_style/schema/material.BENTLEY_materials_line_style.schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "title": "BENTLEY_materials_line_style glTF Material Extension", | ||
| "type": "object", | ||
| "description": "glTF extension that specifies line width and a GPU-friendly dash pattern for CAD-style visualization.", | ||
| "allOf": [ | ||
| { | ||
| "$ref": "glTFProperty.schema.json" | ||
| } | ||
| ], | ||
| "properties": { | ||
| "width": { | ||
| "type": "integer", | ||
| "description": "Width of the line in screen pixels.", | ||
| "minimum": 1, | ||
| "default": 1, | ||
| "gltf_detailedDescription": "The thickness of the line in screen pixels. Must be greater than 0. Implementations typically render wide lines via tessellated geometry extruded from the line centerline." | ||
| }, | ||
| "pattern": { | ||
| "type": "integer", | ||
| "description": "Unsigned integer bitfield encoding a repeating on/off pattern along the line.", | ||
| "minimum": 0, | ||
| "default": 65535, | ||
| "gltf_detailedDescription": "An unsigned integer whose bits encode a repeating on/off pattern along the line. Bit value 1 indicates a lit (on) segment, and bit value 0 indicates an unlit (off) segment. The least significant bit (bit 0) corresponds to the start of the pattern and represents the first segment drawn along the line. The bit pattern repeats cyclically once all supported bits have been consumed. If a pattern uses fewer bits than the maximum supported width, unused higher bits MUST be set to zero. For example, a value of 0xFFFF produces a solid line, and a value of 0xAAAA produces a dotted line." | ||
| }, | ||
| "extensions": {}, | ||
| "extras": {} | ||
| }, | ||
| "required": [] | ||
| } |
16 changes: 16 additions & 0 deletions
16
...NTLEY_materials_line_style/schema/mesh.primitive.BENTLEY_materials_line_style.schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "title": "BENTLEY_materials_line_style glTF MeshPrimitive Extension", | ||
| "type": "object", | ||
| "description": "Indicates that a mesh primitive supplies the BENTLEY_materials_line_style cumulative distance attribute semantic.", | ||
| "allOf": [ | ||
| { | ||
| "$ref": "glTFProperty.schema.json" | ||
| } | ||
| ], | ||
| "properties": { | ||
| "extensions": {}, | ||
| "extras": {} | ||
| }, | ||
| "required": [] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.