Hi guys, I've started using MonoGame over the weekend and I love it! After doing the Hello World of graphics programming, I want to dive a little deeper. I have implemented the diamond square algorithm to procedurally generate some low poly terrain. I generate a heightmap and then group three of the vertices to a triangle together. It works like a charm, except that some of my triangles, usually high ones, appear transparent under certain camera angles.
Video where it shows the problem
Because of the way I numbered the triangles in my head, I had to flip every other triangles normal, because it appeared only black. But in the video, it doesn't seem to follow a pattern, other than its the highest triangles that have this transparency problem. Now that I think about it. The "highest" triangles are the only ones that are in front of other triangles. So is this maybe a problem of the order I draw the triangles in?
Does someone have an idea where this problem might come from? Is it a lighting problem? Or is it the Normals?
These are my lighting settings:
basicEffect = new BasicEffect(GraphicsDevice)
Alpha = 1.0f,
VertexColorEnabled = false,
LightingEnabled = true,
DiffuseColor = new Vector3(0.949f, 0.854f, 0.431f),
SpecularColor = new Vector3(0.2f, 0.2f, 0.2f),
SpecularPower = 5f,
//AmbientLightColor = new Vector3(0.5f, 0.5f, 0.5f),
Texture = Content.Load<Texture2D>("terrain_texture"),
TextureEnabled = true,
basicEffect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1, -1, 0));
basicEffect.DirectionalLight0.DiffuseColor = Color.Yellow.ToVector3();
basicEffect.DirectionalLight0.SpecularColor = Color.Red.ToVector3();
basicEffect.DirectionalLight0.Enabled = true;