You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extensions/2.0/Vendor/EXT_mesh_primitive_edge_visibility/README.md
+1-72Lines changed: 1 addition & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,77 +194,10 @@ Assume that the top edge is to be drawn using the same material as the vertical
194
194
195
195
### Silhouette Normals
196
196
197
-
The extension's `silhouetteNormals` property specifies the index of an accessor of `SCALAR` type and component type 5123 (unsigned short) providing normal vectors used to determine the visibility of silhouette edges at display time. For each edge encoded as a silhouette (visibility value `1`) in `visibility`, the silhouette normals buffer provides the two outward-facing normal vectors of the pair of triangles sharing the edge. Each normal vector is compressed into 16 bits using an "oct16" encoding. The ordering of the normal vector pairs corresponds to the ordering of the edges in `visibility`; that is, the first pair of normals corresponds to the first edge encoded with visibility `1`, the second pair to the second occurrence of visibility `1`; and so on. The accessor's `count`**MUST** be twice the number of edges encoded with visibility value `1`.
198
-
199
-
### oct16 encoding
200
-
201
-
Octahedral normal encoding projects a normal vector onto an octahedron and folds it in half, mapping to two signed normalized components in [-1, 1]. The "oct16" form of this encoding maps each component to the integer range [0, 255], permitting a normal vector to be encoded into two bytes.
202
-
203
-
TypeScript implementation of oct16 encoding and decoding:
// Decode a 16-bit unsigned integer into a normalized 3d vector.
245
-
function oct16DecodeNormal(oct16:number):Vec3d {
246
-
let x =oct16&0xff;
247
-
let y =oct16>>8;
248
-
x=x/255.0*2.0-1.0;
249
-
y=y/255.0*2.0-1.0;
250
-
const z =1- (Math.abs(x) +Math.abs(y));
251
-
252
-
const n:Vec3d= { x, y, z };
253
-
if (z<0) {
254
-
n.x= (1-Math.abs(y)) *signNotZero(x);
255
-
n.y= (1-Math.abs(x)) *signNotZero(y);
256
-
}
257
-
258
-
normalize(n);
259
-
returnn;
260
-
}
261
-
262
-
```
197
+
The extension's `silhouetteNormals` property specifies the index of an accessor of type `VEC3` providing normal vectors used to determine the visibility of silhouette edges at display time. For each edge encoded as a silhouette (visibility value `1`) in `visibility`, the silhouette normals buffer provides the two outward-facing normal vectors of the pair of triangles sharing the edge. The normal vectors **MUST** be normalized and use component type 5126 (float), 5120 (byte), or 5122 (short). The ordering of the normal vector pairs corresponds to the ordering of the edges in `visibility`; that is, the first pair of normals corresponds to the first edge encoded with visibility `1`, the second pair to the second occurrence of visibility `1`; and so on. The accessor's `count`**MUST** be twice the number of edges encoded with visibility value `1`.
263
198
264
199
The `silhouetteNormals` property **MUST** be defined *if and only if* at least one edge is encoded with visibility value `1` in `visibility`.
265
200
266
-
Engines **MUST** render a silhouette edge unless both adjacent triangles are front-facing or both are back-facing, as determined by their normal vectors.
267
-
268
201
## Rendering requirements
269
202
270
203
- Engines **MUST** render all edges according to their specified visibility values, though some engines may permit the user to toggle the display of edges on and off.
@@ -286,7 +219,3 @@ Engines **MUST** render a silhouette edge unless both adjacent triangles are fro
286
219
The [pull request](https://github.com/iTwin/itwinjs-core/pull/5581) that informed the design of this extension provides [an iterator](https://github.com/iTwin/itwinjs-core/blob/03b760e1e91bde5221aa7370ea45c52f966e3368/core/frontend/src/common/imdl/CompactEdges.ts#L42) over the `visibility` buffer.
287
220
288
221
iTwin.js [implements](https://github.com/iTwin/itwinjs-core/blob/03b760e1e91bde5221aa7370ea45c52f966e3368/core/frontend/src/internal/render/webgl/glsl/Edge.ts#L107) conditional display of silhouette edges. It also draws edges in a separate pass from surfaces to [mitigate z-fighting](https://github.com/iTwin/itwinjs-core/blob/03b760e1e91bde5221aa7370ea45c52f966e3368/core/frontend/src/internal/render/webgl/glsl/FeatureSymbology.ts#L426).
289
-
290
-
## References
291
-
292
-
- The oct16 normal vector encoding is described in detail in [A Survey of Efficient Representations for Independent Unit Vectors](https://jcgt.org/published/0003/02/01/).
0 commit comments