Skip to main content
GameDev.net gamedev.net
🔒 Locked

[hlsl] VS transformations reversed and back face showing.

Started by Axiverse Apr 11, 2019 at 5:30 AM 1 replies 1.7k views
Original Post
Axiverse
Axiverse

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?

orange451
orange451

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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.