Jump to content
  • Advertisement
Sign in to follow this  
ak11streetballer

Specific sequence needed for vertices?

This topic is 3801 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
Advertisement
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
It depends on a d3d render state, as to which rotation is culled. I have always done it as i described.

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
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!