Sign in to follow this  
Endemoniada

D3DRS_CULLMODE Not Really Working

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
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

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