Skip to content

Documentation / device / ClipSpaceCorrection

Type Alias: ClipSpaceCorrection

ClipSpaceCorrection = "none" | "gl2zo" | "zo2gl"

Defined in: libs/device/src/builder/programbuilder.ts:1103

Clip-space depth correction applied at the end of the vertex shader main function to map the engine's canonical clip space to the device clip space.

  • Standard-Z canonical clip space is GL style ([-1, 1] depth); WebGPU needs gl2zo (z' = (z + w) / 2).
  • Reverse-Z canonical clip space is zero-to-one; devices whose clip space is already zero-to-one (WebGPU, WebGL with EXT_clip_control activated) need no correction, otherwise zo2gl (z' = 2z - w) maps back to GL clip space so the fixed-function [0,1] window remap restores the original zero-to-one depth.

Released under the MIT License.