I want to get the depth of vertex in 0 to 1 range(like it done in the shader) and I do it like this
D3DXVec3TransformCoord(&vertex, &vertex, &wvp);
depth = vertex.z;
It works(sometimes wrong) but when I write This
if (depth > 1.0f || depth < 0.0f)return false;
Sometimes it returns false. How can I get correct depth for vertex in 0 to 1 range??
I want to compare two vertexes and select the nearest
EDIT
wvp = worldmatrix*viewmatrix*projectionmatrix;
It works wrong when I zoom in
if(depth > 1.0f)
also returns false \$\endgroup\$v*M
. Do you have anything to back up your arbitrary swap of convention? \$\endgroup\$