<p>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 <code>w</code> component (this is part of the render pipeline). As result everything between -1 and 1 for <code>x</code> and <code>y</code> and everything between 0 and 1 for <code>z</code> is visible.</p>

CC BY-SA 4.0
2022-08-29T03:59:28.633Z
so is it that devide by w is applied on all 4 components of vs output vector(xyz & w) and not just xyz?
VersesDev
CC BY-SA 4.0
2022-08-29T07:41:32.017Z
@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
Thomas
CC BY-SA 4.0
2022-09-02T10:43:56.380Z
The division is applied to all 4 components (x/w, y/w, z/w, w/w).
pmw1234
CC BY-SA 4.0
2022-09-06T12:28:16.883Z
I will require a bit more details and explanation here please.
VersesDev
CC BY-SA 4.0
2022-08-28T13:38:15.117Z
2022-09-06T14:56:14.233Z
2022-09-06T14:56:14.233Z
Thomas
<p>Hi I have a confusion in dx pipeline what is the range for a vertex to be visible?</p>
<p>Generally for a vertex to be visible vertex shader position output must be within -1 to 1 for both x &amp; y component and between 0 to 1 for z component but in the microsoft documents it shows a algo being used <a href="https://i.sstatic.net/VvsqO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VvsqO.png" alt="enter image description here" /></a> here it says x &amp; y needs to be between -w &amp; w for x&amp;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.</p>

CC BY-SA 4.0
2022-09-06T16:45:05.927Z
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?
Nathan Reed
<directx12><directx11>
what is the range for NDC coordinates to be visible in directx
VersesDev
# what is the range for NDC coordinates to be visible in directx

(Asked by: username_0 on 2022-08-28)

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](https://i.sstatic.net/VvsqO.png)](https://i.sstatic.net/VvsqO.png) 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.

**Tags:** directx12, directx11

> **Comments:**
> **username_1**: 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?  

---

## 1 answers

### Answer by username_2 on 2022-08-28. Score: 1

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.

> **Comments:**
> **username_0**: so is it that devide by w is applied on all 4 components of vs output vector(xyz & w) and not just xyz?  
> **username_2**: @username_0 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  
> **username_3**: The division is applied to all 4 components (x/w, y/w, z/w, w/w).  
> **username_0**: I will require a bit more details and explanation here please.  

---

