dvds414
dvds414

Reputation: 153

C++ and DirectX I can see right through models and the world as if it was all transparent?

The issue is that I can see through models and the world and see whats on the other side. When I look at the terrain I can see if there is anything through a mountain on the otherside and so on. This has happened before but I fixed it and don't remember how. Any way to fix this?

Upvotes: 1

Views: 903

Answers (1)

Preet Kukreti
Preet Kukreti

Reputation: 8617

You probably need to fix the winding direction of your vertices. If you have them reversed by accident and backface culling is enabled, then you will see through these triangles. Winding direction is set as a BOOL in D3D11_RASTERIZER_DESC's FrontCounterClockwise member, and culling in its CullMode (D3D11_CULL_MODE) member

Update: You may also have depth testing disabled, (which if disabled, would require you to draw furthest objects first, otherwise further items will draw over nearer ones already rendered ("painters algorithm")). Make sure you have depth testing enabled in your depth stencil state (D3D11_DEPTH_STENCIL_DESC) when you create it.

Upvotes: 4

Related Questions