3D graphics rendering artifact with overlapping planes (z-fighting)

In at least this case, Method -> {"RelieveDPZFighting" -> True}, which is useful when you have nearly coplanar polygons in your plot, removes the observed jitter and streakiness. I picked this up from Brett.

{ListPlot3D[data, ColorFunction -> "SolarColors", Filling -> Bottom, 
            FillingStyle -> {Opacity[1]}, InterpolationOrder -> 0, Mesh -> None,
            PlotLabel -> "Before", ViewPoint -> {-Pi, -Pi, -2}], 
 ListPlot3D[data, ColorFunction -> "SolarColors", Filling -> Bottom, 
            FillingStyle -> {Opacity[1]}, InterpolationOrder -> 0, Mesh -> None,
            Method -> {"RelieveDPZFighting" -> True}, PlotLabel -> "After", 
            ViewPoint -> {-Pi, -Pi, -2}]} // GraphicsRow

a comparison


In v10.1 under Windows x64 I experience no "z-fighting" in this example when using the "BSPTree" rendering method. This method may be individually selected using BaseStyle

data = {{1, 1, 1, 1}, {1, 0, 3, 1}, {2, 0, 0, 1}};
plot = ListPlot3D[data, Mesh -> None, InterpolationOrder -> 0, Filling -> Bottom, 
  FillingStyle -> {Opacity[1]}, ColorFunction -> "SolarColors", 
  ViewPoint -> {Pi, Pi, 5}]

Show[plot,
 BaseStyle -> 
  RenderingOptions ->
   {"Graphics3DRenderingEngine" -> "BSPTree"}]

The same Option may be given in ListPlot3D but I separated it with Show for clarity.

It may also be set globally for a session with:

SetOptions[$FrontEndSession, 
  RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]

Or persistently by changing $FrontEndSession to $FrontEnd in the code above.


Other cases where the rendering method is important:

  • Unintended edge extensions in 3D Cube rendering
  • Opacity renders lines incorrect in certain viewing angles
  • Weird behaviour of multiple transparent Raster3D objects in one Graphics3D

And one I just found which basically duplicates this question:

  • Possible Bug in ArrayMesh

This is not entirely the same, as it changes coloring and z-scaling, but perhaps something similar may be of help. Essentially, the zero values are lifted by a small increment, while the original z-range is preserved.

data = {{1, 1, 1, 1}, {1, 0, 3, 1}, {2, 0, 0, 1}};
ListPlot3D[data /. x_ /; x < .01 -> 0.01, Mesh -> None, 
 InterpolationOrder -> 0, Filling -> Bottom, 
 FillingStyle -> {Opacity[1]}, ColorFunction -> "SolarColors", 
 ViewPoint -> {Pi, Pi, 5}, 
 PlotRange -> {Automatic, Automatic, {Min[data], Max[data]}}]

EDIT

even better (shorter and broader applicability) as proposed by the OP:

ListPlot3D[data, Mesh -> None, InterpolationOrder -> 0, 
 Filling -> Bottom, FillingStyle -> {Opacity[1]}, 
 ColorFunction -> "SolarColors", ViewPoint -> {Pi, Pi, 5}, 
 PlotRange -> {Automatic, Automatic, {Min[data] - 0.01, Max[data]}}]

Mathematica graphics