4
$\begingroup$

I often find that Graphics3D drawings appear "streaky" in places. This can be seen in the picture below (taken from my question here).

cone2 projected onto cone1

There is an unattractive patch where the colour changes unpredictably where the blue and pink cones overlap at the bottom. Presumably this is something to do with having the two surfaces being directly on top of each other, but I think have seen the same phenomenon occurring even when this is not the case. You can see the same behaviour in Mathematica's documentation on Cone (under Applications, the 2nd example "Define a region by the intersection of a cone and a plane"):

streakiness example from Mathematica documentation

Is there any way to fix this? Sometimes altering the coordinates slightly so that the two surfaces don't quite overlap seems to help, but it's not a very elegant solution...

I believe this is the same issue as presented in 3DPlot Rendering Artefacts (z-fighting) but the solution there does not exactly address my problem.

  1. I am dealing with a Graphics3D object rather than a plot, so it is not immediately obvious what is the best parameter to alter by 1% to make the cone surfaces not quite overlap. (Altering Scale[cone2, 3, {0, 0, 0}] to Scale[cone2, {3.01, 3.01, 3}, {0, 0, 0}] seems to work but maybe there is a better way.)
  2. I am already aware of this general method of altering the coordinates slightly and am wondering if there is an alternative solution.
$\endgroup$
11
  • $\begingroup$ What version and OS are you on? I do not see this streaking in the documentation example in 10.4.1, neither on Windows 10 nor on Linux (Xubuntu Trusty). But, the one with the two cones, I can reproduce. $\endgroup$ Jul 10, 2016 at 12:27
  • $\begingroup$ This is Mathematica 10.0.0.0, operating on Windows 7 Enterprise. The Mathematica documentation example is taken from the online help here. $\endgroup$
    – Antony
    Jul 10, 2016 at 12:36
  • 3
    $\begingroup$ Possible duplicate of 3DPlot Rendering Artefacts (z-fighting) $\endgroup$ Jul 10, 2016 at 12:36
  • 1
    $\begingroup$ Thanks for the reference -- I hadn't seen that. However, I don't think it quite answers my question, which I have now modified accordingly. $\endgroup$
    – Antony
    Jul 10, 2016 at 12:47
  • $\begingroup$ I get same with 10.4.0 for Linux x86 (64-bit), but then again, nVidia hates linux. $\endgroup$
    – Feyre
    Jul 10, 2016 at 12:55

1 Answer 1

3
$\begingroup$

I can think of no solution to the color streaking problem other than perturbing the size of one the two coinciding cones. I choose to perturb projcone2.

origin = Point[{0, 0, 0}];
cone1 = Cone[{{0, 0, 1}, {0, 0, 0}}];
transform = {{0.3, 0, 0.15}, {0, 0.35, 0}, {0.1, 0, 0.5}};
cone2 = GeometricTransformation[cone1, transform];
projcone2 = Scale[cone2, {2.99, 2.99, 3}, {0, 0, 0}];

Graphics3D[
  {{Opacity[0.25], EdgeForm[{Thick}], cone1}, 
   {Opacity[0.6], Magenta, EdgeForm[Thick], cone2}, 
   {Opacity[0.6], Cyan, EdgeForm[{Thick}], projcone2},
   {PointSize[Large], origin}},
  Lighting -> "Neutral",
  PlotRange -> 1.4 {{-1, 1}, {-1, 1}, {0, 1.4}},
  ImageSize -> Large]

cones

This graphic also shows you why you are not seeing the edge of projcone2 in your rendering of the cones. The edge lies outside the range of your bounding box.

$\endgroup$
2
  • 1
    $\begingroup$ The OP deliberately truncates projcone2 at z=1, related question here $\endgroup$ Jul 10, 2016 at 13:31
  • 1
    $\begingroup$ @SimonWoods. He is clipping with PlotRange, i.e., the bounding box. The actual edge of the cyan cone is well outside his bounding box as I show it here. $\endgroup$
    – m_goldberg
    Jul 10, 2016 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.