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:
However, when I specify the desired camera parameters:
ViewVector -> {{0, 0, .1}, {0, 1, .1}}, ViewAngle -> 54 \[Degree]
The rendering becomes weird:
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.
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 aCylinder[]
primitive? $\endgroup$Tube[]
with a suitable setting forCapForm[]
. $\endgroup$