<p>The two are different because they do different things. Clipping and culling aren't the same thing at all. If an edge crosses a clip plane, the primitive has to be clipped to be within that plane. This means generating new primitives from the old one.</p>
<p>If all vertices of a primitive are outside of a cull plane, then the entire primitive is culled.</p>
<p>You use the cull planes when you want the VS to be able to cull out primitives based on some calculation. You use clip primitives when you want primitive rendering to be bounded to some non-clip-space region (though line and point width can violate those borders).</p>

CC BY-SA 4.0
2021-05-30T15:18:21.123Z
I ran this simple experiment on the triangle example from Sascha Willems' Vulkan repo. In the vertex shader `if(0 == gl_VertexIndex)   gl_CullDistance[0]=-1.0f`; and expected the whole triangle to disappear but it didn't. I had to set the gl_CullDistance[0] to -1.0f for all three vertices to make the triangle disappear. On the other hand, gl_ClipDistance[] worked as expected.
Vectorizer
CC BY-SA 4.0
2021-05-26T16:06:40.600Z
2021-05-30T15:26:05.090Z
2021-05-30T15:26:05.090Z
Nicol Bolas
<p>Why are there very similar yet distinct arrays: <code>gl_ClipDistance[]</code> vs <code>gl_CullDistance[]</code>?</p>
<p>What would be some use cases where the need for two distinct entities become apparent?</p>

<shader><glsl><rasterizer><fragment-shader>
gl_ClipDistance vs gl_CullDistance
Vectorizer
# gl_ClipDistance vs gl_CullDistance

(Asked by: username_0 on 2021-05-26)

Why are there very similar yet distinct arrays: `gl_ClipDistance[]` vs `gl_CullDistance[]`?

What would be some use cases where the need for two distinct entities become apparent?

**Tags:** shader, glsl, rasterizer, fragment-shader


---

## 1 answers

### Answer by username_1 on 2021-05-26. Score: 1 | Accepted answer

The two are different because they do different things. Clipping and culling aren't the same thing at all. If an edge crosses a clip plane, the primitive has to be clipped to be within that plane. This means generating new primitives from the old one.

If all vertices of a primitive are outside of a cull plane, then the entire primitive is culled.

You use the cull planes when you want the VS to be able to cull out primitives based on some calculation. You use clip primitives when you want primitive rendering to be bounded to some non-clip-space region (though line and point width can violate those borders).

> **Comments:**
> **username_0**: I ran this simple experiment on the triangle example from Sascha Willems' Vulkan repo. In the vertex shader `if(0 == gl_VertexIndex)   gl_CullDistance[0]=-1.0f`; and expected the whole triangle to disappear but it didn't. I had to set the gl_CullDistance[0] to -1.0f for all three vertices to make the triangle disappear. On the other hand, gl_ClipDistance[] worked as expected.  

---

