View Full Version : culling stage
At what stage of the rendering pipeline culling is done? (before/after matrix transformation?before/after clipping? ...)
04-22-2006, 12:35 AM
I believe the culling is performed after matrix transform and after clipping.
Please look at OpenGL pipeline diagram in the redbook for more details.
Modelview transform > Projection transform > View Volume clipping > Division by w > Viewport transform > Polygon Culling > Raterization
I can not find the culling stage at this diagram. Can you please direct me to the specific location?
Does it mean that clipping is done for culled polygons??
04-22-2006, 03:16 AM
The OpenGL specification describes culling as the first part of rasterization (Section 3.5.1 "Basic Polygon Rasterization"). This would place culling after the clipping process.
It is done during the fragment operation:
Texturing -> Fog -> Scissor -> Alpha -> Stencil -> Depth -> Color -> Dithering -> Logic and Mask Op => Pixel Buffer
What you mean by culling is I guess the depth test, isn't it ?
04-22-2006, 09:02 AM
@jide: no, culling is discarding back-facing triangles, see the ref :
Oups... as much for me :)
So, this happens during the privitive assembly:
clipping -> perspective division -> viewport (?) -> depth-> culling (HERE !)
So this is the last step of the primitive assembly. Afterward, this is the mode point operation then the fragment operation.
04-22-2006, 09:59 AM
Culling certainly comes before the depth test, as it is a primitive operation, whereas depth test is a fragment operation. If a primitive is culled, no fragments are generated.
What I meant here by depth is the calculation of the z value (of the depth). Sorry for this misunderstanding.
Depth test happens during the fragment operations but for early depth test which happens before (don't really remember)
04-22-2006, 11:26 AM
There are only two "depth tests" that i know about.
The first is the vertex level clipping test against near and far plane. It can modify the primitive's vertices, or drop the entire primitive if all vertices lie outside the same clipping plane. It's not really a "depth test", as it works against all six frustum planes equally.
The second is the fragment level depth test. It tests fragment depth values against depth buffer content, and thus lies behind the rasterizer. It can, however, be applied in various stages of the fragment pipeline. In the FFP or with fragment shaders that do not modify fragment depth, for example, the depth test can be applied early, thus skipping texture lookups/shader runs for discarded fragments. I think this is what "early z-test" refers to.
Culling could theoretically come before or after the clipping test, however the missing perspective division would make the test unnecessarily expensive, i think.
04-22-2006, 12:55 PM
The diagram which I was talking about is a large foled chart at the back of the red or bluebook.
I think the order of processing was well clarified by valuable members, memfr0b, jide, and ZbuffeR :)
memfrOb, depth is ranged between 0 and 1. This is what I meant. I guess this join your first paragraph (about the frustum planes).
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.