Strange rendering artifacts on objects with lots of small gaps

The artifacts you can see towards the end of the dock. I’ve narrowed this down somewhat but am still at a loss as to what is causing this.

The main thing that seems to be related is when you have meshes with a lot of close gaps like this. I’ve been able to trigger the behavior with multiple textures doing this. Some worse then others so the texture does appear to make a difference but it’s the gaps that seem to be the main culprit.

It only happens at certain angles like this, looking straight down for instance it’s fine.

In gama/forward it’s the least noticable. Linear/deferred is where it’s most noticeable.

Tested this in a new project to rule out other stuff in my game that might be causing it, but no difference.

3273586--253031--upload_2017-11-1_14-10-40.png

Forgot to mention that anti aliasing improves it just slightly, it does have some impact. But this pic for example was with anti aliasing on. Tried amplify fxaa plus all of the options in post processing stack V2, negligible difference but it was interesting that it made some impact.

This is a moiré pattern. A moiré pattern is one that emerges from the interaction of two patterns, usually grids or parallel lines. In this case it’s the parallel lines of the gaps and the grid of the pixels being rendered.

FXAA / SMAA won’t do to much to hide these, best case is they soften the edges which isn’t terribly helpful. That just makes them look even more like some kind of object sitting there.

Temporal AA like in the Post Processing Stack, or MSAA can help, but both can still be suseptable to moiré patterns. So the result is they may reduce the artifact, but also add more of it at the same time. Note MSAA is enabled by turning it on in the quality settings, and by enabling it on the camera. It also only works with forward rendering. However since the way Unity renders real time directional shadows in a way that MSAA has no effect on them they will remain aliased. This is also why deferred it’ll be more noticeable as MSAA doesn’t work with deferred.

The only real solution is a content change. Specifically to remove the gaps, or at least the sides of the planks between the gaps. Not necessarily all of the time, but using LODs so as the meshes get further away the gaps aren’t there to cause the moiré pattern.

4 Likes

Thanks much for the explanation.

I would recommend switching to a texture with alpha for the lower lod. The nice thing about textures is that they have moiré prevention and aa pretty much built in because of mipmaps and various sampling strategies. This allows you to do a switch from high to low with the gaps still in place and the mipmaps will solve things for higher distances. This is generally how we would approach things like fences and grates. A full model for close up is nice, but you really need something texture based as a backup.

2 Likes