Advertisement Jump to content
Sign in to follow this  
NathanRidley

Cull mode inverted for some reason?

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

I've been learning basic 3D engine programming and finally got to a stage where I have a very simple engine running, displaying a bunch of spinning rainbow cubes. I had built a similar demo a little while ago, but this is the first time the code has been properly integrated into some semblance of an engine, with different areas properly segregated and so forth.

 

I'm experiencing a weird issue where I have to set CullMode.Front by default, or all of the back faces render, while the front faces are ignored. Obviously this is backwards to what should actually by happening but I'm having trouble figuring out why. Any suggestions would be appreciated.

 

All the code is on Github if you want to take a look. Here's the part where I'm setting the cull mode.

Edited by axefrog

Share this post


Link to post
Share on other sites
Advertisement

Maybe the winding order of your triangles is inverted (clockwise instead of counterclockwise or vice versa)?

Share this post


Link to post
Share on other sites

Then you have found your own problem it would seem.

 

The D3D11_RASTERIZER_DESC::FrontCounterClockwise member defaults to FALSE.

 

 

L. Spiro

Share this post


Link to post
Share on other sites

Then you have found your own problem it would seem.

 

The D3D11_RASTERIZER_DESC::FrontCounterClockwise member defaults to FALSE.

 

 

L. Spiro

Ah thanks! I'm assuming counterclockwise is the standard most engines use? I'm confused why the default settings for the rasterizer description put the winding direction at odds with cull mode...

Share this post


Link to post
Share on other sites
It’s not. First you define which direction defines a front face (clockwise or counter clockwise) and then you decide whether you want to cull front faces or back faces. I personally use clockwise, but whether one is used more than the other or by whom one is used is rather arbitrary—there is no reason to pick one over the other except that that is how your toolchain works.


L. Spiro

Share this post


Link to post
Share on other sites

It’s not. First you define which direction defines a front face (clockwise or counter clockwise) and then you decide whether you want to cull front faces or back faces. I personally use clockwise, but whether one is used more than the other or by whom one is used is rather arbitrary—there is no reason to pick one over the other except that that is how your toolchain works.


L. Spiro

Ah, thanks, that's helpful. I wonder if it's a bug in SharpDX for configuring the Rasterizer.Default() method to have the winding order mismatched with the cull mode.

Edited by axefrog

Share this post


Link to post
Share on other sites

I said the decision on which to use is fairly arbitrary, even though there might or might not be a most-common direction (CW/CCW).


L. Spiro

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!