Skip to main content

perspective_infinite_reverse

Function perspective_infinite_reverse 

Source
pub fn perspective_infinite_reverse(
    vertical_fov: f32,
    aspect_ratio: f32,
    near: f32,
) -> Mat4
Expand description

Creates an infinite perspective projection matrix with reversed depth for use with Vulkan.

Maps near to depth 1 and infinity to depth 0.

Reversed Z improves depth precision when used with a floating-point depth buffer.

Expects a right-handed Y-up view space input. Outputs NDC with Z in [0, 1] and Y-down.

ยงPanics

Will panic if near is less than or equal to zero when glam_assert is enabled.