Jump to content
  • Advertisement

DX11 [hlsl] VS transformations reversed and back face showing.

Recommended Posts

I'm working on a shader/renderer and I have these symptoms. When I render it, the back face is showing. I'm pretty sure the winding order is correct in the meshes I'm using. The other thing which I think is correlated is that I have to multiply in the reverse order in the vertex shader to get the positions on the screen. Something is backwards, but I'm not sure what. So instead of mul(mul(position, world), mul(view, projection)), I have to do mul(mul(projection, view), mul(world, position)) in the vertex shader. I'm using SharpDx and am using their Matrix library to set up the view and projection matrix and the world is identity. Any ideas?

Share this post

Link to post
Share on other sites

I have a few ideas.

1. Your shader is acting totally normal. That's how projecting vertices works; in reverse order.

2. Your winding order is correct, and the backface drawing is because that's how you've defined your winding order. If you want the other face to draw, either change your cull mode or change your winding order.

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

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