Shouldn’t it be fairly simple to take the [-1,1] z value after the modelview and projection transforms, divide by 2, and then add 1/2?
For some reason I’m getting either 0 or 1, nothing in between.
This isn’t verbatim, but pretty close to what I want to do.
DP4 UnitSpace.x, mvp[0], Input.x;
DP4 UnitSpace.y, mvp[1], Input.y;
DP4 UnitSpace.z, mvp[2], Input.z;
DP4 UnitSpace.w, mvp[3], Input.w;MUL r0.z, half.z, UnitSpace.z;
ADD r1.z, half.z, r0.z;MOV oColor.x, r1.z;
I just want to color the vertices based on their distance from the near plane, to compare to my rough front-to-back bounding volume sort.
Maybe I’m missing some fundamental understanding here.
Thanks.
Edit: if I try to take the x or y coordinates, the same thing happens. One half of the model is red, the other black. There is nothing in between. Yes, there’s enough tesselation
[This message has been edited by CatAtWork (edited 08-28-2003).]