2

I would like to plot two surfaces in the same figure using the following code.

meanr[t2_, t1_, kappa0_] := (Exp[-t1] - Exp[-t2]) kappa0
varr [t2_, t1_, 
  kappa0_] := ((t2 - t1) - 1 + Exp[-(t2 - t1)] - 
   0.5 (Exp[-t2] - Exp[-t1])^2)
orientCorrHeadTail[t_, T_, kappa0_, thetac_] := Exp[
   -0.5 thetac^2 varr[t, t - T, kappa0]] Cos[
   thetac meanr[t, t - T, kappa0]]
Plot3D[
 {orientCorrHeadTail[t, T, 0, 0.5], orientCorrHeadTail[t, T, 2, 0.5]},
 {t, 0, 10},
 {T, 0 , t},
 PlotRange -> All,
 PlotStyle -> ColorData[97, "ColorList"],
 Boxed -> False,
 BoxRatios -> {1, 1, 1},
 AxesEdge -> {{1, -1}, {-1, -1}, {1, 1}},
 FaceGrids -> {{0, -1, 0}, {1, 0, 0}, {0, 0, -1}},
 ViewVertical -> {0, 0, 1},
 PlotPoints -> 60,
 ViewPoint -> {-0.9792377354119487`, 3.2154160743069498`, 
   0.39011911851862024`},
 ImageSize -> Large
 ]

which generates the figure below enter image description here

There are two problems in the above figure:

  1. The yellow surface should be below the blue surface. There should not be yellow color dispersed in the red circle. Increase the PlotPoints option to 300 does not solve the problem;
  2. The solid mesh on yellow surface near red arrow breaks. If the mesh style is changed to dashed or dotted, then it is OK. But solid mesh style is what I prefer.

How can I solve these two problems? Thanks for your time and consideration.

$Version
12.0.0 for Linux x86 (64-bit) (April 7, 2019)
GilbertDu
  • 21
  • 2
  • First problem looks like a classic example of what's called z-fighting, where a mesh intersects so closely that the renderer can't decide which texture to display. – Carl Lange Jun 04 '21 at 07:02
  • 4
    For your first problem use Method -> {"RelieveDPZFighting" -> True} in the plot option. – Ben Izd Jun 04 '21 at 07:23
  • 1
    Mixing of the surfaces color is because the 2 surfaces are at this places identical. Simply add e.g. 10^-3 to one of the surfaces. – Daniel Huber Jun 04 '21 at 08:03
  • 3
    BaseStyle -> RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"} as plot option, solve both problems but is very slow and you should give up the interaction for your plot. (solution came from an answer by @Mr.Wizard in post) – Ben Izd Jun 04 '21 at 08:11
  • 2
    Either Method -> {"RelieveDPZFighting" -> True} or addition of a small number indeed solves the first problem. BaseStyle -> RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"} indeed solves both problems. Thank all you guys fro immediate and helpful responses. Really saved my day. – GilbertDu Jun 04 '21 at 08:34

0 Answers0