I’m using the pixelshader to lookup a texture and the color so it can be drawn onto a quad (multiple quads in this case to make the world dynamic). This works extremely well, however there are a few issues.
The first one consists of oddly placed lines appearing. Now I’m fairly sure that this is because of the texture, so tried using mipmaps (pre-generated by MonoGame Content tool) but it only made it ten times worse. I also tried messing around MipMapBiasLevels but to be honest the mipmaps looked bad and it didn’t solve it either. So is there any way of fixing this without changing the texture?
SOLUTION: I figured out that this is inevitable. Using custom mipmaps solves this.
The second one is what I believe an actual glitch or something. I have no idea what is happening, but it only happens this extreme when looking at it from above.
SOLUTION: After scrolling around the map I also noticed black lines appearing. After a while I figured those originated from the ColorMap (a texture where a specific color is looked up in). The reason why those lines appeared was because of the shader sampling the wrong color (it needs to sample the exact pixel specified) due to floating point inaccuracies, my guess. So now is each color inside the ColorMap 3x3 instead of 1, so inaccurate sampling will still make it sample the correct color, and so far I haven’t seen any abnormalities.
EDIT: after a while I wanted to check what difference it made in performance when using GraphicsDevice.DrawPrimitives (with index and vertex buffers) versus GraphicsDevice.DrawUserPrimitives (which sends the data to the GPU everytime). I’m not sure why I went with the Index and Vertexbuffer approach considering the “chunks” are simply 1 quad with 128x128 tiles drawn onto them, but the performance was roughly 2 times worse than DrawUserPrimitives. Even though I used the Dynamic type of it. But still setting the vertex and index buffer for just one quad is probably ridiculous.
However I forgot to tell that I switched to DrawUserPrimitives and kind of forgot about it. Coincidentally, the weird glitch below disappeared (or more precise, I couldn’t find it anymore) and I focused on the weird black lines. When I did the benchtesting they came back so apparently the vertex/index buffers are causing them.
Less extreme but still visible. The black lines appear to originate from it and go vertically and horizontally across the screen.