Quantcast
Channel: Question and Answer » hlsl
Viewing all articles
Browse latest Browse all 69

When does DirectX convert a vertex/pixel's depth from range Near-Far to 0-1?

$
0
0

When I output a vertex from a vertex shader, it seems to have a world-space-ish mapping. Vertices about 1 unit away have about 1 unit as their Z value.

When we input into the pixel shader, the depth values are mapped from 0..1 as defined in the viewport state.

Where does this conversion occur? It’s late and I’m forgetful, but I can’t find a place where I told DirectX what my depth range even was (other than implicitly in the projection matrix). How does it know how to convert it?


Viewing all articles
Browse latest Browse all 69

Trending Articles