math docs
    Preparing search index...

    Function perspectiveReverseZ

    • Generates a reverse-Z perspective projection matrix with the given bounds. The near plane maps to a normalized device coordinate Z of 1 and the far plane to 0, using WebGPU/Vulkan/DirectX/Metal's [0, 1] clip volume. Pair with a floating point depth buffer, a depth clear of 0 and a greater depth compare for much better depth precision than a standard projection. Passing Infinity for far will generate an infinite projection matrix, where depth approaches 0 as distance approaches infinity.

      Parameters

      • out: mat4.Mat4

        mat4 frustum matrix will be written into

      • fovy: number

        Vertical field of view in radians

      • aspect: number

        Aspect ratio. typically viewport width/height

      • near: number

        Near bound of the frustum

      • far: number

        Far bound of the frustum, can be Infinity

      Returns mat4.Mat4

      out