0
votes

I am using MonoGame to draw some sprites and some models in the same game. I can draw and see everything, but the render states are all wrong.

Before drawing my models I try to set back the render states and then draw, but the depth buffer is all wrong. Here is my (F#) broken code, what am I doing wrong?

this.GraphicsDevice.Value.RasterizerState <- RasterizerState.CullCounterClockwise
this.GraphicsDevice.Value.DepthStencilState <- DepthStencilState.Default
this.GraphicsDevice.Value.BlendState <- BlendState.Opaque

for m in this.AllModels do
  m.Model.Draw(m.World, camera.View, camera.Projection)
1
I don't think I'll be able to help you with this one but a screenshot might might your question clearer.craftworkgames
The models compenetrate, as if the depth buffer were not working correctly. I don't think a screenshot would be much more eloquent...Giuseppe Maggiore

1 Answers

0
votes

Shame on me for not thinking this sooner. It was a projection issue. The near plane was too close (0.01) and the FOV was too narrow (Pi/4). With 0.1 and Pi/2 it all works like a charm.