Sign in to follow this  

Specific sequence needed for vertices?

This topic is 3588 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

Hey guys! I have a simple question. I was trying to make an object out of simple basic shapes like cubes and triangles. After I finished programming the shape and my output was rotated continuously specific sides of the final object started vanishing at various degrees of rotation. I wanted to know if there is a specific sequence of inputting the vertices of sides while creating a cube or triangle? Also why are these sides vanishing? Thanks!

Share this post


Link to post
Share on other sites
The winding order of the vertices must be in clockwise order, for example:

If they are in antic clockwise order and backface culling is on then they will start getting culled and dissappearing.

Hope that helps,

EDIT: I failed miserable at ASCII art after 4 attempts, here is a linke to an article on GD, Backface Culling

Share this post


Link to post
Share on other sites
Yes there, is. Vertices should be defined in a counter-clockwise order when facing the visible side. There may be a setting to change this, but I'm not certain.

The reason the faces disappear is because the process assumes that triangles which aren't defined in a counter-clockwise order are facing away from the viewer, and so they are discarded as an optimization by default.

EDIT -- Dave may be correct about clockwise over counter-clockwise. I'm not familiar with direct3D specifically. However, suffice it to say that there is indeed a specific winding order, whatever it is and that the rest of my post applies if you substitute the correct, Direct3D winding order.

Share this post


Link to post
Share on other sites
First: the default winding order for DX is clockwise.

Second: To quickly test if the problem is the winding order, use:

m_pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );

That will render both front and back faces of each triangle.

Share this post


Link to post
Share on other sites

This topic is 3588 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this