Vertex Post-Processing
- Vertex Specification
- Vertex Processing
- Vertex Post-Processing
- Primitive Assembly
- Rasterization
- Fragment Shader
- Per-Sample Processing
Vertex Post-Processing is the stage in the OpenGL Rendering Pipeline where the vertex outputs of the Vertex Processing undergo a variety of operations. Many of these are setup for Primitive Assembly and Rasterization stages.
This article is a stub. You can help the OpenGL Wiki by expanding it. |
Transform Feedback
Clipping
Primitives generated by previous stages are collected and then clipped to the view volume. For each vertex in the clip-space position (the gl_Position output of the last Vertex Processing stage), the viewing volume is defined by:
$ {\begin{aligned}-w_{c}&\leq x_{c}&\leq w_{c}\\-w_{c}&\leq y_{c}&\leq w_{c}\\-w_{c}&\leq z_{c}&\leq w_{c}\end{aligned}} $
This volume can be modified by depth clamping as well as the addition of user-defined clip-planes. The total volume that primitives are clipped to, including user-defined clip planes, is the clipping volume.
The way primitives are clipped to this clipping volume depends on the basic Primitive type:
- Points
- Points are not really "clipped". If a point is in any way outside of the clipping volume, then the primitive is discarded (ie: not rendered). Points can be bigger than one pixel, but the clipping remains; if the center of the point (the actual gl_Position value) is outside of the clipping range, it is discarded. Yes, this means that point sprites will disappear when the center moves off-screen.
Platform Issue (NVIDIA): These cards will not clip points "properly". That is, they will do what people generally want (only discard the point if it is fully off-screen), rather than what the OpenGL specification requires. Be advised that other hardware does what OpenGL asks.
- Lines
- If the line is entirely outside of the volume, it is discarded. If the line is partially outside of the volume, then it is clipped; new vertex coordinates are computed for one or both vertices, as appropriate. The end-point of such a clipped vertex is on the boundary of the clipping volume.
- Triangles
- A triangle is clipped to the viewing volume by generating appropriate triangles who's vertices are on the boundary of the clipping volume. This may generate more than 1 triangle, as appropriate. If a triangle is entirely outside of the viewing volume, it is culled.
When primitives are clipped, new per-vertex outputs must be generated for them. These are generated via linear interpolation (in clip-space) of the output values. Flat-shaded outputs don't get this treatment.
Depth clamping
The clipping behavior against the Z position of a vertex (ie: $ -w_{c}\leq z_{c}\leq w_{c} $) can be turned off by activating depth clamping. This is done with glEnable(GL_DEPTH_CLAMP). This will cause the clip-space Z to remain unclipped by the front and rear viewing volume.
The Z value computations will proceed as normal through the pipeline. After computing the window-space position, the resulting Z value will be clamped to the glDepthRange.
Clip planes
This section is missing information. Further details can be found on the talk page. |