[hlsl] VS transformations reversed and back face showing.

Started by
1 comment, last by orange451 5 years ago

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?

Advertisement

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.

This topic is closed to new replies.

Advertisement