Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

D3DRS_CULLMODE Not Really Working

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

Hi guys,

I have a very basic vertex shader and I noticed that if I have any ambient light the triangles are drawn regardless or their facing, D3DRS_CULLMODE has no effect.

I tried setting it in the shader as well as with SetRenderState(), it makes no difference.

I thought that culling would skip over those back facing ones.

Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Yes, culling is designed for this purpose.

In MSDN, it is indicated "To improve rendering performance, you can cull out (or remove) a primitive that faces away from the camera. For single-sided primitives, this saves rendering time because a back-face is not visible. To enable culling, you need to know the winding order of the vertices (typically counter-clockwise)".

The code below will remove any primitive whose back face is facing forward (given a counter-clockwise winding order):

SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);


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!