MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Light and surface colors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58692] Re: Light and surface colors
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 15 Jul 2005 03:02:09 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <db57t5$4vl$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

you have need a half-day for
With[{a = 1, b = 2, c = 1/2},
 ParametricPlot3D[
   {a*Cos[phi]*Sin[th], b*Sin[phi]*Sin[th], 
c*Cos[th], Hue[phi/(2Pi)]},
  {th, 0, Pi}, {phi, 0, 2Pi}, Lighting -> False]
]

but wish

With[{a = 1, b = 2, c = 1/2},
 ParametricPlot3D[
  {a*Cos[phi]*Sin[th], b*Sin[phi]*Sin[th], 
c*Cos[th],
  SurfaceColor[Hue[phi/(2Pi)]]},
 {th, 0, Pi}, {phi, 0, 2Pi}]
]

You can't have shadows in Mathematica. Even when 
you would be able to produce shadows, your scene 
has no floor or wall to show you the shadow

You can try MathGL3d form

http://phong.informatik.uni-leipzig.de/~kuska/mathgl3dv3/

and save the graphics to POVRay or Renderman and 
use these render engines to obtain light sources 
with shadows but you should add a floor or a box 
with solid walls in the back of the object.

Regards

  Jens



"Daniele Lupo" <danwolf_no_spam_please_ at libero.it> 
schrieb im Newsbeitrag 
news:db57t5$4vl$1 at smc.vnet.net...
| Hi to everyone.
|
| I've just obtained a Student License of 
Mathematica, and I'm working in
| graphics...
|
| I've created, after a half-day of work, an image 
representing an ellipsoid,
| with a colored surface
|
| When I try to represent it, I must put 
Ligthing->False to see surface
| colors.
|
| I'd like to know if there's a way to obtain a 
rendered image, in which I
| can have both light and surface color, to give a 
shadow to the figure and
| create a more 3D effect.
|
| Thanks for replies.
|
| Below there's the code...
|
|
| Daniele
|
|
| --------------------------
|
| << Graphics`ContourPlot3D`;
|
| a = 7; b = 5; c = 4; r = 1;
|
| ellipsoid = ContourPlot3D[
|    (x/a)^2 + (y/b)^2 + (z/c)^2 - r, {
|    x, -10, 10}, {y, -10, 10}, {z, -10, 10},
|    PlotPoints -> 12,
|    AspectRatio -> Automatic
|    ];
|
| (*It finds the median point of vertices of a 
list of a 3D coordinates*)
| midpoint[l_] := Apply[Plus, Transpose[l], 
2]/Length[l];
|
|
| (*Function to map in the ellipsoid surface*)
| pressure[x_, y_, z_] := x^2 + y^2 + Sin[4z];
|
| (*Color Function*)
| color[x_] := Hue[pressure @@ midpoint[x]/50];
|
| (*Rule to change original graphic object*)
| colorpolygon = Polygon[coord_] :>
| {color[coord],EdgeForm[{}],Polygon[coord]};
|
| (*creation of new, colored ellipsoid*)
| coloredellipse = ellipsoid /. colorpolygon;
|
| (*Visualization of the shape*)
| (*I'd like to have also the light...*)
| Show[coloredellipse, Lighting -> False];
| 



  • Prev by Date: Re: Light and surface colors
  • Next by Date: Enhancements to special functions in Version 5.2
  • Previous by thread: Re: Light and surface colors
  • Next by thread: Re: Light and surface colors