You probably want Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, MeshFunctions -> {#3 &}, Mesh -> {{0}}, MeshStyle -> {Directive[Thick, Green]}, MeshShading -> {Red, Blue}, PlotRange -> All] [![enter image description here][1]][1] Compare with what you get with `ColorFunction` (note the absence of `Green` line and the blending of `Red` and `Blue` at the boundary): Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, ColorFunction -> MyColorFunc, PlotRange -> All, ColorFunctionScaling -> False] [![enter image description here][2]][2] [1]: https://i.sstatic.net/fg2az.png [2]: https://i.sstatic.net/Lui7h.png