Message Boards Message Boards


How to generate shadows in Graphics3D ?

Posted 10 years ago
2 Replies
2 Total Likes
The Lighting and Surface Properties tutorial says "Objects do not block light sources or cast shadows, so all objects in a scene will be lit evenly by light sources."

Is there any way to change this behavior?

For a simple example I have three polygons, the last one being horizontal (the "ground") and a directional lighting source lighting from directly above, and I would like to interactively change the direction of the light source and observe the shadows cast by the polygons:
  Polygon[{{0, 0, 0.4}, {1, 0, 1.4}, {0, 1, 1.4}}],
  Polygon[{{-0.2, 0, 0.6}, {0.8, 1, 1.6}, {-0.2, 0.8, 1.6}}],
  Polygon[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}]},
  Boxed -> False, Lighting -> {{"Directional", RGBColor[1, .7, .1], {{0, 0, 1}, {0, 0, 0}}}}]
Thanks for helping this absolute novice Mathematica user!
POSTED BY: Bradley May
2 Replies
Russell gives a good pointer. But there is another recent discussion online about the shadows:

How to make a drop-shadow for Graphics3D objects

Well, and of course, a rather spectacular implementation in pure M. can be found here:

How can this confetti code be improved to include shadows and gravity?

POSTED BY: Vitaliy Kaurov
Well... yes sorta, but no. Blender, or 3D program trials are your friends! Exporting geometry in a stl or obj is relatively straight forward.

References: Shadows in mathematica Graphics3D
POSTED BY: Russell Hart
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract