Skip to content

Commit 2e01439

Browse files
authored
Merge pull request #271 from cabanier/deptsorting
Add support for depth testing across layers
2 parents 121dfbd + 66c8a90 commit 2e01439

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎webxrlayers-1.bs‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,18 @@ when the [=XR Compositor=] can no longer reproject the layer.
18781878

18791879
The author SHOULD redraw the content of the layer at the next [=XR animation frame=]. The event must be of type {{XRLayerEvent}}.
18801880

1881+
Depth sorting between layers {#depthsorting}
1882+
============================
1883+
By default, the {{XRRenderStateInit/layers}} array defines the order of the composition of the layers and each layer is drawn on top of the previous layer.
1884+
If an application wants to have layers that are sorted by depth, it MUST request a session with the "<dfn for="feature descriptor">depth-sorted-layers</dfn>" [=feature descriptor=].
1885+
1886+
If an {{XRSession}} is created with the "[=depth-sorted-layers=]" [=feature descriptor=], {{XRProjectionLayer}}, {{XRQuadLayer}} and {{XRCylinderLayer}} layers MUST be displayed based on their depth as opposed to the location in the {{XRRenderStateInit/layers}} array.
1887+
Other layers types MUST continue to be sorted as before.
1888+
1889+
{{XRQuadLayer}} and {{XRCylinderLayer}} layers MUST be sorted by their dimensions (for instance {{XRQuadLayerInit/width}} or {{XRCylinderLayerInit/centralAngle}}), transform and space.
1890+
1891+
{{XRProjectionLayer}} layers MUST be sorted according to the values in their {{XRWebGLSubImage/depthStencilTexture}}. This also implies that if "[=depth-sorted-layers=]" is enabled, the [=XR Compositor=] MUST make use of depth values and {{XRProjectionLayer/ignoreDepthValues}} MUST be set to `true`.
1892+
18811893
WebXR Device API Integration {#webxrintegration}
18821894
============================
18831895

@@ -1895,8 +1907,8 @@ instances of {{XRLayer}}.
18951907
The <dfn attribute for="XRRenderState">layers</dfn> attribute returns an array containing
18961908
the instances of {{XRLayer}} that are displayed by the [=XR Compositor=].
18971909

1898-
The {{XRRenderStateInit/layers}} array defines the order of the composition of the layers. The [=XR Compositor=] MUST draw each layer
1899-
in order of its position in the array using [=source-over=] blending. The [=XR Compositor=] MUST NOT apply any depth sorting of the layers.
1910+
By default, the {{XRRenderStateInit/layers}} array defines the order of the composition of the layers. The [=XR Compositor=] MUST draw each layer
1911+
in order of its position in the array using [=source-over=] blending. Unless the "[=depth-sorted-layers=]" [=feature descriptor=] is enabled, the [=XR Compositor=] MUST NOT apply any depth sorting of the layers.
19001912

19011913
NOTE: this means that each layer can potentially overwrite the previous layers whether or not the previous layers are virtually closer to the viewer.
19021914

@@ -1946,7 +1958,7 @@ monoscopic devices.
19461958

19471959
XRView changes {#xrviewchanges}
19481960
--------------
1949-
Each [=view=] MUST define a <dfn ignore=''>recommended WebGL texture resolution</dfn> which represents a best estimate of the WebGL texture
1961+
Each [=view=] MUST define a <dfn>recommended WebGL texture resolution</dfn> which represents a best estimate of the WebGL texture
19501962
resolution large enough to contain the view.
19511963

19521964
Animation frames changes {#animationframeschanges}

0 commit comments

Comments
 (0)