Point light source penetrating through surfaces

• To: mathgroup at smc.vnet.net
• Subject: [mg123268] Point light source penetrating through surfaces
• From: Chris Young <cy56 at comcast.net>
• Date: Tue, 29 Nov 2011 07:55:41 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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

```

• Prev by Date: Re: how to get string in sci. notation to a number?
• Next by Date: Re: Ragged region boundary