Home > Enterprise >  Annoying lines between cubes while the Camera is moving in Unity3D
Annoying lines between cubes while the Camera is moving in Unity3D

Time:11-28

I made lot of cubes in a mesh with vertices. When I tested with color textures I could clearly see the lot of annoying gaps and lines popping up while the Camera is moving.

The mesh looks like this:

enter image description here

This is what it looks like when the camera is moving:

enter image description here

As the gif shows, there are lines popping up, how can I fix this?

CodePudding user response:

Looks like "z-fighting". When two or more meshes overlap, placed very close together, rounding errors will cause them to fight when rendered. Possible solutions:

  1. Create one cube and give it a material/texture with the desired colors.
  2. Create three cubes on top of each other (do not let one, like the black one in your example, be bigger so it is overlapped by the red one).
  3. If you really want to overlap the cubes, make them slightly different in size so the rounding errors will not show up.
  • Related