1
\$\begingroup\$

At first I thought clipping happens before projection since new vertices may be added and the output of projection is in NDC which is 2D. However after a lot of googling, I found that some articles/presentations/images indicate that projection takes place before clipping which contradicting with other articles I've read and my initial thoughts.

Could anyone tell me which one is correct and why?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I don't know which platform you're working on, but on most modern platforms, all culling and clipping happens after vertex transformations, but before fragment shading.

You can do some custom pre-culling, and not issue draw commands for objects you know won't be visible, but once you ask some triangles to be drawn, it's not until you apply view and projection matrices that you know which vertices are eligible for culling and clipping.

This graph, which I don't know who drew it first, but is the first result when you google image search "Direct3D 9 pipeline" is very useful for understanding where everything fits.

Pipeline

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for answering. However I am still very confused. Since after projection the vertices will be transformed into NDC which is no longer a 3D space, how is the clipping going to happen which may add additional vertices to the polygon depending on the situation. \$\endgroup\$ Commented Jun 17, 2015 at 11:44
  • \$\begingroup\$ NDC is indeed 3D! The near and far planes are mapped to z=0 and 1, or -0.5 and 0.5, depending on the platform. This normalized value is what's used to determine which polygons are eligible for frustum culling. This is information you only have after projection \$\endgroup\$ Commented Jun 17, 2015 at 11:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.