Hello Guest

Depth issue? Thin line artifacts between adjacent meshes viewed straight-on

  • 0 Replies
  • 4377 Views
Howdy everyone, I'm having an issue that appears to be a single pixel-width line of clipping appearing on the edge of certain cubes when rendering a grid of cube meshes, each exactly adjacent to another. Doing a bit of searching, it seems most people with a similar issue were able to solve it by setting various texture edge clamping options but in my case it occurs with or without textures. See pictures:

Large grid of square meshes: http://pyraetos.net/images/artifactnomod.png
Every other column skipped for better perspective: http://pyraetos.net/images/artifactmod.png

The artifacts are only seen when viewed straight on, i.e. orthogonally to the cube faces, and at any camera pitch. The color of the lines is the color of the unlit front face which should be occluded by the cube in front in every case seen above. It seems like there might be a slightly imprecise calculation somewhere along the line in depth testing? Moving the camera either removes the problem (in the case of rotation about y) or changes which cubes are affected, seemingly at random. Zooming in very far to inspect the edges, everything looks continuous to me.

The left and right faces of the cubes were also affected, but using
Code: [Select]
glDepthFunc(GL_LEQUAL) appears to have fixed that. Also, increasing the near plane for the perspective projection seemed to help some as well, but the best I could get was the situation as seen above.

I unfortunately don't really know what code snippets would be relevant, so I will just provide links to my initialization, shaders, model creation, and model rendering code.

GL initialization: http://hastebin.com/yayiruqeru.java
Vertex shader: http://hastebin.com/apucacenaq.avrasm
Fragment shader: http://hastebin.com/luqequximi.avrasm
Model creation: http://hastebin.com/ixuraroqog.java
Rendering: http://hastebin.com/enulinojod.java

Thanks everyone, can't wait to hear y'all's ideas. I'll answer any questions and provide further details!
« Last Edit: July 05, 2016, 01:36:10 by 2ltpyraetos »