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


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

Point light source penetrating through surfaces

From Chris Young <cy56@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Point light source penetrating through surfaces
Date 2011-11-29 12:56 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jb2kq6$6jc$1@smc.vnet.net> (permalink)

Show all headers | View raw


Please excuse my not giving a simpler, but here's a strange behavior of 
Lighting for a point source. The light seems to go right through opaque 
objects! I've been turning off the lighting for the other objects, but 
no matter what I do, the inside of the torus is getting a glow from the 
"light bulb" at the left. Maybe I'm not showing the position of the 
light source correctly, but I can't see any error

http://home.comcast.net/~cy56/PointLightSource.nb

http://home.comcast.net/~cy56/PointLightSource1.png

http://home.comcast.net/~cy56/PointLightSource2.png


DynamicModule[
 {biTan, bnds, viewPt},

 Manipulate[
  biTan = ArcSin[a/c];   (*
  angle of the slanted plane which is bitangent to the torus *)

  bnds = c + a;                        (* plotting range;
  big enough for torus width to fit *)
  viewPt = {
    viewR Cos[view\[Theta]] Sin[view\[Phi]],
    viewR Sin[view\[Theta]] Sin[view\[Phi]],
    viewR Cos[view\[Phi]]
    };

  Show[
   {
    ParametricPlot3D[
     torus[c, a, u, v], {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]},

     RegionFunction -> ({x, y, z} \[Function]
        z + Tan[tilt] x + sliceLevel < 0),
     BoundaryStyle -> {Orange, AbsoluteThickness[bndThick]},
     PlotStyle -> {White},
     Mesh -> None,
     Lighting -> None,
     PlotPoints -> plotPts1,
     PerformanceGoal -> "Quality"
     ],

    ParametricPlot3D[
     torus[c, a, u, v], {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]},

     PlotStyle -> None,
     MeshFunctions -> {{x, y, z} \[Function]
        z + Tan[tilt] x + sliceLevel},
     Mesh -> mesh,
     PlotPoints -> plotPts2,
     MeshStyle -> {Lighter[Yellow], Tube[tubeR]}
     ],

    Graphics3D[                                             (*
     light source *)
     {Lighting -> Automatic, Yellow,
      Sphere[{\[ScriptX], \[ScriptY], \[ScriptZ]}, 0.2]}
     ]
    },

   Axes -> True,
   AxesLabel -> {"x", "y", "z"},
   PlotRange -> (bnds + 1) {{-1, 1}, {-1, 1}, {-1, 1}},
   BoxRatios -> {1, 1, 1},
   Lighting -> {{"Point",
      Yellow, {\[ScriptX], \[ScriptY], \[ScriptZ]}}},
   ViewPoint -> viewPt
   ],

  Item["Plot of a torus with radii c and a", Alignment -> Center],
  {{c, 3}, 0, 4},
  {{a, 1}, 0, 3},
  {{tubeR, 0.05}, 0, 0.5},
  {{opac, 1}, 0, 1},
  {{mesh, 1}, 0, 16, 1},
  {{bndThick, 0.1}, 0, 5},   (* thickness of boundary for sliced-
  off torus *)
  {{tilt, N[biTan]}, 0, N[biTan], N[ biTan/64]},
  {{sliceLevel, 0}, -a, a, 0.125},
  {{plotPts1, 150}, 0, 200, 5},
  {{plotPts2, 100}, 0, 100, 5},
  {{viewR, 100}, 0, 100, 5},
  {{view\[Theta], -\[Pi]/3}, -\[Pi]/2, \[Pi]/2, \[Pi]/36},
  {{view\[Phi], \[Pi]/3}, 0, \[Pi], \[Pi]/36},

  {{\[ScriptX], -5}, -6, 6, 0.25},
  {{\[ScriptY], 0}, -6, 6, 0.25},
  {{\[ScriptZ], 0}, -4, 4, 0.25}
  ]
 ]

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


Thread

Point light source penetrating through surfaces Chris Young <cy56@comcast.net> - 2011-11-29 12:56 +0000
  Re: Point light source penetrating through surfaces "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-30 08:26 +0000

csiph-web