title: How to fix this weird transparent areas in 3D model?
body: <p>something is not working as it should. If you take alook at the screenshot you will see that the result is weird. The floor of the pavilion is rendered correctly, but the columns are kinda transparent, and the roof is completele weird. I used Assimp.NET to import his mesh from a .obj file. In other engines it looked correctly. Another thing was: if i set CullMode to Back - it will cull the front faces?! I think it could be 3 things: 1,the mesh was imported wrong, or the z Buffer is not working, or maybe i need multiple world matrices (im using only one).</p>
  
  <p>Does maybe anybody know what this could be?!</p>
  
  <p>Screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/51kqF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/51kqF.png" alt="enter image description here"></a></p>
  
  <p>Here is some code:</p>
  
  <p>DepthBuffer/DepthStencilView</p>
  
  <pre><code>var depthBufferDescription = new Texture2DDescription
                  {
                      Format = Format.D32_Float_S8X24_UInt,
                      ArraySize = 1,
                      MipLevels = 1,
                      Width = BackBuffer.Description.Width,
                      Height = BackBuffer.Description.Height,
                      SampleDescription = swapChainDescription.SampleDescription,
                      BindFlags = BindFlags.DepthStencil
                  };
                  var depthStencilViewDescription = new DepthStencilViewDescription
                  {
                      Dimension = SwapChain.Description.SampleDescription.Count &gt; 1 || SwapChain.Description.SampleDescription.Quality &gt; 0 ? DepthStencilViewDimension.Texture2DMultisampled : DepthStencilViewDimension.Texture2D
                  };
                  var depthStencilStateDescription = new DepthStencilStateDescription
                  {
                      IsDepthEnabled = true,
                      DepthComparison = Comparison.Always,
                      DepthWriteMask = DepthWriteMask.All,
                      IsStencilEnabled = false,
                      StencilReadMask = 0xff,
                      StencilWriteMask = 0xff,
                      FrontFace = new DepthStencilOperationDescription
                      {
                          Comparison = Comparison.Always,
                          PassOperation = StencilOperation.Keep,
                          FailOperation = StencilOperation.Keep,
                          DepthFailOperation = StencilOperation.Increment
                      },
                      BackFace = new DepthStencilOperationDescription
                      {
                          Comparison = Comparison.Always,
                          PassOperation = StencilOperation.Keep,
                          FailOperation = StencilOperation.Keep,
                          DepthFailOperation = StencilOperation.Decrement
                      }
                  };
  </code></pre>
  
  <p>Loading mesh files:</p>
  
  <pre><code> public static Mesh Stadafax_ModelFromFile(string path)
          {
              if (_importContext.IsImportFormatSupported(Path.GetExtension(path)))
              {
                  var imported = _importContext.ImportFile(path, PostProcessSteps.Triangulate | PostProcessSteps.FindDegenerates | PostProcessSteps.FindInstances | PostProcessSteps.FindInvalidData | PostProcessSteps.JoinIdenticalVertices | PostProcessSteps.OptimizeGraph | PostProcessSteps.ValidateDataStructure | PostProcessSteps.FlipUVs);
                  Mesh engineMesh = new Mesh();
                  Assimp.Mesh assimpMesh = imported.Meshes[0];
  
                  foreach(Face f in assimpMesh.Faces)
                  {
                      engineMesh.Structure.Faces.Add(new Rendering.Triangle((uint)f.Indices[0], (uint)f.Indices[1], (uint)f.Indices[2]));
                  }
                  List&lt;Vector3D&gt;[] uv = assimpMesh.TextureCoordinateChannels;
                  for(int i = 0; i &lt; assimpMesh.Vertices.Count; i++)
                  {
                      engineMesh.Structure.Vertices.Add(new Vertex(new Vector4(assimpMesh.Vertices[i].X, assimpMesh.Vertices[i].Y, assimpMesh.Vertices[i].Z, 1), RenderColorRGBA.White, new Vector2(uv[0][i].X, uv[0][i].Y)));
                  }
  
                  return engineMesh;
              }
  
              else
                  NoëlEngine.Common.Output.Log("Model format not supported!", "Importeur", true); return null;
          }
      }
  </code></pre>
  
  <p>If anybody only has the smallest idea what this could be please just write a comment.</p>