1
$\begingroup$

Hi I have a confusion in dx pipeline what is the range for a vertex to be visible?

Generally for a vertex to be visible vertex shader position output must be within -1 to 1 for both x & y component and between 0 to 1 for z component but in the microsoft documents it shows a algo being used enter image description here here it says x & y needs to be between -w & w for x&y component. Now I am confused vs output must be in what range to be visible?I understand that w component is usually kept 1.0f in vertex shader but that is not the case all the time(eg. when it holds the value for perspective devide).So can someoone clarify me which range is correct for vertex to be visible.

$\endgroup$
1
  • 1
    $\begingroup$ Clipping is done before the perspective divide. So the inequalities listed in the linked document are correct. A vertex is offscreen if its particular x or y value is larger in magnitude than its particular w value. If you still have further questions, can you clarify what you want to know? $\endgroup$ Commented Sep 6, 2022 at 16:45

1 Answer 1

1
$\begingroup$

Like you said... When using a perspective projection, your 'w' can be !=1. Between the vertex pocess stages (Vertex, Tessellation control, Tessellation evaluation, geometry) and the Fragment shader, the position vector gets divided by its w component (this is part of the render pipeline). As result everything between -1 and 1 for x and y and everything between 0 and 1 for z is visible.

$\endgroup$
4
  • $\begingroup$ so is it that devide by w is applied on all 4 components of vs output vector(xyz & w) and not just xyz? $\endgroup$
    – VersesDev
    Commented Aug 29, 2022 at 3:59
  • $\begingroup$ @VersesDev I am not sure... I am using OpenGL not DirectX... But on Pixelshader stage you can color out the w component... then you can see if it is always 1 $\endgroup$
    – Thomas
    Commented Aug 29, 2022 at 7:41
  • 1
    $\begingroup$ The division is applied to all 4 components (x/w, y/w, z/w, w/w). $\endgroup$
    – pmw1234
    Commented Sep 2, 2022 at 10:43
  • $\begingroup$ I will require a bit more details and explanation here please. $\endgroup$
    – VersesDev
    Commented Sep 6, 2022 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.