# I can't render faces properly in my DirectX11 project

For some reason, only back-faces are rendering, even if I set the rasterizer and stencil buffer and state to any values. Setting D3D11_CULL_NONE, D3D11_CULL_FRONT, D3D11_CULL_BACK in the rasterizer structure has the same result.

This is how rendering is supposed to look (The code somehow works in the side project that was made using the Direct3D Win32 Game Visual Studio template):

The model I'm rendering is loaded using DirectX::Model::CreateFromCMO(). I'm using left hand projection and view matrices.

This is how it looks inside my project:

I'm using the DirectXTK library to draw the sup model itself in both projects. I'm pretty sure that the graphics device, context and swap chain are properly created. I tried copying code from the second project to the first project but I somehow still managed not to fix it.

I'm also sure that the DirectX::CommonStates does contain it's own rasterizer and stencil state, but I don't understand how rendering doesn't work on my own project.

The debug layer is not displaying any errors or warnings at run-time related to the creating of the rendertargets, device, texture buffers, etc.

My only idea remaining is that the stencil buffer is wrongly configured, but I can't find what I did wrong here. The stencil state description is taken from MSDN (this link): https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-depth-stencil

The main project source is here (I won't post pieces of the code because that would take a lot of time and space, there are like 300+ lines of code related to the rendering pipeline) : https://github.com/NicusorN5/3D_Rad_Space/tree/master/3DRadSpace

To mention that you can't compile the project by your own because Resources.rc is set to load files from a non-local (i.e some folder on my secondary HDD) path, and because of some dependencies that are also located in non-local paths. Sorry for that.

The Model draw method is setting the Rasterizer state as part of the standard setup. If you want to override the state at draw time, you can use custom drawing callbacks per the wiki.

You didn't mention if this model is CMO or SDKMESH or if you are using right-handed or left-handed viewing coordinates. You look like you've mixed those up in some fashion.

For DirectX Tool Kit for DX11 the way to control the winding of Model is to provide a ModelLoaderFlag to Model::CreateFrom*.

You are likely using the defaulted parameter. Try the opposite flag:

static std::unique_ptr<Model> CreateFromCMO(
ID3D11Device* device,
const wchar_t* szFileName,
IEffectFactory& fxFactory,

static std::unique_ptr<Model> CreateFromSDKMESH(

• You can use left-handed matrices, but with CMO you'd need to pass ModelLoader_Clockwise. That said, if your model textures have any text on them it would look backward. Oct 26, 2021 at 1:39