graphical glitches with overlapping polygons

I am working on a modular level generation system at the moment that puts smaller parts together to create a large level. In many cases I need a standardized grid of regularly sized tiles to ensure that parts fit together in a “circular” way. For weeks I’ve been trying to come up with a good system that avoids overlapping surfaces completely without being overly complicated, restrictive and inefficient. The thing here is that you either need to scale some tiles up or down, or introduce “shared” edges and corners for adjacent tiles. And everything I did come up with is overly complicated, restrictive and inefficient…

Today I realised how infinitely much simpler and cleaner it would be, if I just allowed tiles to overlap at the edges and corners. When I think about it, the only real problem with that is the graphical glitches that occur when two surfaces are located (partly) on top of each other.

First of all, I don’t understand why there have to be glitches at all, because I’m using exactly the same material with matching texture coordinates on both surfaces. Is there any way to fix this?? It would help me out so much. Can I change something in material/render settings, maybe?

Yes, I’m using world aligned texture coordinates for these materials, but the overlapping surfaces still have these glitches that flicker when you move/rotate the view. That’s what I don’t understand: the polygons’ appearance should be identical. Maybe it’s a lighting problem. I could test that by disabling all dynamic lights and use ambient lighting only (basically no lighting at all).

I just cycled through the rendering modes in the editor viewport. It’s weird… Both “Unlit” and “Lighting Only” have NO visible overlaps/glitches/artifacts, but the other modes do. Don’t know what to make of that.

Here’s a picture of the (prototype) material I am using:

I guess I could also try to get some pictures of the actual glitch itself. I just don’t know, if it’s easy to see without motion.

Have you tried using a world aligned texture in the materials? That would help some with the z fighting on overlaps

Hmm…I can’t recall ever having a problem like that when I used world aligned textures…at least nothing that was overly noticeable…odd

Have you rebuilt lighting in your scene?

It’s all dynamic lighting, because my maps are generated randomly at runtime, which is the main reason I need this modular system at all.

I just made a good picture in “Detail Lighting” render mode. It basically looks the same as in the default “Lit” mode.

I moved two floor elements inside of each other (much more than they normally would).

In that pic you can see how artifacts are alternating with the correct material. When I rotate the camera, it changes from “all glitchy” to “all correct” within fractions of a degree, with the occasional intermediate like in the picture.

So… I guess I’m on the safe side assuming the problem must be related to detail lighting somehow. I just don’t really know anything about detail lighting or how this could help me fix the problem :confused:

(edit: Unless detail lighting just means taking texture normals into account, that is… It does look a bit like flipped normals after all)

Playing around with material settings, I just discovered that the glitches are gone when I un-check “Tangent Space Normal”. I have no idea what tangent space normals are, but they seem to produce a better result than with world space normals. There are no glitches now, but everything looks less sharp and flatter this way, unless I’m imagining things… I hope I can improve the look somehow, or maybe use tangent space normals after all. Will browse material functions tomorrow. Maybe I can find something. Still, it looks like I can solve this one way or the other, which is pretty ■■■■ awesome :slight_smile:

It looks like I found the problem! I still don’t understand why I would get those flipped normals at all, but I think I fixed them. First I replaced the WorldAlignedTexture-node with WorldAlignedNormal. Don’t know if that one is new or I just didn’t find it the first time. Then I still had problems getting it to look right. While messing with settings related to “tangent space”-normals versus “world space”-normals and stuff, I disconnected the VertexNormalWS-input from the WorldAlignedNormal-node by chance, which finally did the trick. Again, I have no idea why the diffuse texture node would require a vertex normal input and the normal texture node doesn’t. I have no idea why any of this would have something to do with overlapping polygons either, but what the hell. Glitches are gone.

Awesome, glad you got it working