Large scene and Z fighting


I have a Z fighting problem with a large scene in unity :

I create a scene dynamically with geographic informations (heightmap and textures) from a server (like a Google Earth application).

I use kilometers as unit in Unity.

My scene is about 30km x 30km, so it’s about 30 x 30 units in Unity.

Because of data georeferencing, it is centered on (300, 6000) point in Unity.

My camera is configured with near plane 0.01 (10 meters) and far plane 50 (50 km).

Everything is ok, but when I display the sea on top of the ground, I have a lot of Z fighting between sea and ground, specialy :

  • near the coast, where there is about 50 cm or less between sea height and ground height (it’s about 0.0005 units delta between sea and ground)
  • when the camera is near to the ground

How can I avoid this ?

  • should I change the units (switch to meters or Mega-meters) ?
  • move the center of the scene to (0, 0) point ?
  • dynamically adapt near and far planes of the camera ?
  • use a shader with offset -1, -1 to render the sea over the ground ?


  • Option 1 will not change a thing, because it is about the difference between min and max.
  • Option 2 doesn’t change a thing, because it is just a position. Has nothing to do with your viewport.
  • Option 3 is the best! Make sure that your z-buffer doesn’t contain very large AND very small numbers. The smaller your interval, the better. Changing the near plane will make the most difference, because it numbers out very small values.
  • Option 4 will create an artifact probably
  • Option 5 (alternative): Don’t use z-writing and z-reading on the sea. Make sure that it is drawn later in the RenderQueue. You can change this in your shader.

Thanks for your help !

I tried 3 & 4 and option 3 is the best !

I can’t use option 5 because there is “Islands” and the sea the semi-transparent, so I don’t use z-writing, but I need to use z-reading

I have to say that unity is conceived to easily have character type objects on the 1-2 unit scale, in other words, 1 unit is a meter, and while it may not make any difference in the rendering, all the settings, such as tree placement are foreseen like this so it could be that some of the coding inside the engine has detailed viewing more tuned to that end.