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

╄→гoц情女王★ 提交于 2020-01-05 22:20:27

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/11895289/c-and-directx-i-can-see-right-through-models-and-the-world-as-if-it-was-all-tr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!