Repeated rendering (weird behaviours after upgrading to 3.7)

Hi,
I updated my MG version from 3.6 to 3.7, and I encountered a weird behaviour.
As you can see below, I have a terrain made of chunks (each drawn separately), but all the chunks are just copies of one single chunk (which seem to be chosen depending on where the camera looks at…):

I did some search and found nothing regarding that, and I would like to precise that when I downgrade my MG, everything is back to normal.

The drawing of each chunk is done using vertex buffers and the DrawIndexedPrimitives method:

this.World.Device.SetVertexBuffer(this.VertexBuffer);
this.World.Device.Indices = this.IndexBuffer;

foreach (EffectPass Pass in Effect.CurrentTechnique.Passes)
{
    Pass.Apply();
    this.World.Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, this.IndexBuffer.IndexCount / 3);
}

I thank you in advance for any help.

this.VertexBuffer.VertexCount instead of this.IndexBuffer.IndexCount would be better ? There are 3 vertices per triangle, not imperatively as many indices as vertices in a model.
Or maybe it is too early in the morning for me to post :slight_smile:

No that is correct, actually there is something even weirder.

I have a model (which is a sphere) showing the mouse intersection with the terrain, and see what it looks like with 3.7:

Wireframe:

I literally have no idea on what’s going on.

Hi @torshid!
What project type is this? Could you provide a sample that reproduces the issue (or just your project if you’re willing to share it)?

Alright so I simplified the project as I could, here is the sample which basically creates a quad tree and draws it.
There are no much comments, and also a few other minor problems which you shouldn’t notice.
My environment is OSX and I am using Visual Studio, the project type is DesktopGL (MG 3.7).

The three important files are in Engine -> Environment -> Terrain:

  • World.cs: Draw method supposed to draw the entire world
  • TerrainQuadTree.cs: DrawScene method calls the draw method of the root node of the quad tree
  • TerrainQuadChild.cs: DrawTerrain method draws the chunk

It is pretty straightforward, let me know if you encounter any issue.

(You may have to build the content manually with the pipeline tool.)

1 Like

I found the PR that caused this issue. I’ll fix this up ASAP!

Fix is up! https://github.com/MonoGame/MonoGame/pull/5912
Thanks for the project, that helped a lot :slight_smile:

1 Like

Thanks a lot for your help. :slight_smile:

1 Like