3
$\begingroup$

I am rendering a world environment simulation in Mathematica with Graphics3D code:

Show[{
Graphics3D[{
Lighting -> "Neutral",
Green, 
Polygon[{{-10, -10, 0}, {-10, 10, 0}, {10, 10, 0}, {10, -10, 
   0}}],
Red, Cone[{{0, 0, 0}, {0, 0, .1}}, 1/2],
White, 
Table[Sphere[
   Table[{0, 0, 10} + {rx, ry, rz} + {r, r, r/3} /. 
     r :> RandomReal[]*4, {5}], 
   2] /. {rx -> RandomReal[{-20, 20}], 
   ry -> RandomReal[{-20, 20}], rz -> RandomReal[{-1, 3}]}, {30}]
}, Boxed -> False, Background -> Blue, 
ImageSize -> {900, 900*41/54}, SphericalRegion -> True],
ContourPlot3D[
x^2 + y^2 == 10^2, {x, -10, 10}, {y, -10, 10}, {z, 0, .6}, 
Mesh -> None, Lighting -> "Neutral", 
ContourStyle -> Darker[Green]]
}]

If the camera is positioned far away from the scene so that everything is in view range, it renders fine:

somewhat cloudy

However, when I specify the desired camera parameters:

ViewVector -> {{0, 0, .1}, {0, 1, .1}}, ViewAngle -> 54 \[Degree]

The rendering becomes weird:

weird rendering

The bottom part of the green rectangle is cut off and the blue background is displayed instead, and the red cone is very weird as well. Is there a way to display this scene properly?

edit: Solved with

ViewRange -> {0.1, 100}

This is not optimal, because it does not take 0 or Automatic for a minimum value, All causes the cut-off in the above example, and it does not take Infinity or Automatic for a maximum value.

$\endgroup$
5
  • $\begingroup$ Could be the objects are overlapping and rendering poorly. What happens if you move the cone slightly higher off the 'ground'? $\endgroup$
    – cormullion
    Commented Jun 7, 2013 at 13:36
  • $\begingroup$ The cone is then rendered correctly, but the scene is still cut off at the bottom: i.imgur.com/qmtF9Of.png $\endgroup$
    – shrx
    Commented Jun 7, 2013 at 13:38
  • 1
    $\begingroup$ ContourPlot3D[x^2 + y^2 == 10^2, {x, -10, 10}, {y, -10, 10}, {z, 0, .6}, Mesh -> None, Lighting -> "Neutral", ContourStyle -> Darker[Green]] - are you aware that there's a Cylinder[] primitive? $\endgroup$ Commented Jun 7, 2013 at 13:39
  • 1
    $\begingroup$ Yes, but it has bottom and top faces, which I don't want displayed in this case. $\endgroup$
    – shrx
    Commented Jun 7, 2013 at 13:41
  • $\begingroup$ In that case, you use Tube[] with a suitable setting for CapForm[]. $\endgroup$ Commented Jun 7, 2013 at 13:44

1 Answer 1

1
$\begingroup$

Solved with

ViewRange -> {0.1, 100}

This is not optimal, because it does not take 0 or Automatic for a minimum value, All causes the cut-off in the above example, and it does not take Infinity or Automatic for a maximum value.

$\endgroup$

Your Answer

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

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