TransformedTextured depth (Z) values

I am using 2 TransformedTextured vertex buffers in my scene:

1 for the background

1 prop

I assumed that the Z value was a value between 0 and 1; where 1.0 was the back of the scene. This works well for the background, so with this thought, I also assumed then that z=0.5 would place the plane halfway between the front clipping plane. But this does not appear to be the case. The Z value definitely has an impact on the plane's position between the front and back clipping planes, but does not behave as I would have expected.

Can anyone shed some light as to how the Z value of a TransformedTextured buffer is used



Answer this question

TransformedTextured depth (Z) values

  • hammerstein06

    What do you expect to happen and what happens (Please give more details. As is your question is too vague for me to try to answer.)

  • Numan azam

    All I needed was Wessam's answer ... thanks for responding.
  • moebiusproject

    This value gets divided by w then it is stored directly in your depth buffer...

     

    Sorry, but that's a false answer... In the case of TransformedTextured, the z-value you specify is directly used in z-testing and will be stored in the depth buffer if the z-test succeeds...

    The w-divide happens for vertices that use the T&L pipeline or vertex shaders. So in a vertex shader, you output normalized values that will be subsequently divided by w and then scaled to the viewport's size...

    Sorry for the confusion...



  • TransformedTextured depth (Z) values