Point light source demo
- To: mathgroup at smc.vnet.net
- Subject: [mg123274] Point light source demo
- From: Chris Young <cy56 at comcast.net>
- Date: Wed, 30 Nov 2011 03:19:33 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Just experminenting with light sources to confirm that Mathematica doesn't in fact do any shadowing of one object by another, or for that matter, of the inside of an object by its surface. I can see how it requires a lot of computation to compute all the shadows of objects upon another. I suppose for simple cases we can get around it by computing the projections. But for clarifying the structure of cutaway objects, it would be a big help if the light were at least blocked by the surface of the object. http://home.comcast.net/~cy56/PointLightSource2.nb http://home.comcast.net/~cy56/PointLightSource3.png DynamicModule[ {lightSrc, l1, l2, objects, opts}, Manipulate[ lightSrc = {lightR Cos[light\[Theta]] Sin[light\[Phi]], lightR Sin[light\[Theta]] Sin[light\[Phi]], lightR Cos[light\[Phi]]}; objects = { {Opacity[sphrOpac], Sphere[{sphrX, sphrY, 0}, sphrR]}, Cuboid[{1, 2, -1}, {2, 3, 1}], Cylinder[{{3, -1, 0}, {3, -1, 1}}]}; opts = { Axes -> True, AxesLabel -> {"x", "y", "z"}, BoxRatios -> Automatic, ImageSize -> {300, 300}}; Row[ { Graphics3D[ objects, Lighting -> Automatic, opts ], Graphics3D[ Append[ objects, {Yellow, Lighting -> Automatic, Sphere[lightSrc, 0.1]} ], Lighting -> {{"Point", Yellow, lightSrc}}, opts ] } ], {{sphrOpac, 0.5}, 0, 1}, {{sphrX, 0}, -1, 1}, {{sphrY, 0}, -1, 1}, {{sphrR, 0.5}, 0, 1}, {{lightR, 2}, 0, 4}, {{light\[Theta], -3 \[Pi]/4}, -\[Pi], \[Pi]}, {{light\[Phi], \[Pi]/2}, 0, \[Pi]} ] ]