Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6828

Point light source demo

From Chris Young <cy56@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Point light source demo
Date 2011-11-30 08:21 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jb4p1u$go6$1@smc.vnet.net> (permalink)

Show all headers | View raw


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]}
  ]
 ]

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Point light source demo Chris Young <cy56@comcast.net> - 2011-11-30 08:21 +0000

csiph-web