Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rk

How does back face culling work?

This topic is 6023 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I turn culling on in my D3D8 app, instead of back faces, I get my front faces culled. I am totally sure that my normals are set correctly. I even flipped them to see if that was the problem. I assume culling determines the faces that will not be rendered by checking the normal vectors, is this a correct assumption? If not, then how does culling work? rk

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
check your cull mode:

->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
or
->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW );

Share this post


Link to post
Share on other sites
Culling has nothing to do with normals.

Culling is dependant on which way the triangles are drawn. Triangles consist of 3 points and a "list of which dots to connect."



1---2 2---1
| / \ |
| / \ |
|/ \|
3 3



Let''s say you have these 2 triangles on the screen. The one on the left you want facing the camera, the one on the right facing the other way.

If you draw the left triangle connecting the dots like 1-2-3, that is going clockwise... It will be drawn... If the cullmode is CCW that means if you connect the dots counter-lockwise like 3-2-1 will be discarded.

So, to make the one on the right display backwards, what do you do? =) Draw it 1-2-3... =) Thats going counterclockwise and will be drawn in reverse facing the other way. To change the one on the right to face the camera. Change the way its drawn to 2-1-3, or 1-3-2 so the "connect the dots" are going clockwise...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!