Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Light and surface colors

  • To: mathgroup at
  • Subject: [mg58702] Re: [mg58688] Light and surface colors
  • From: "Jose Luis Gomez" <jose.luis.gomez at>
  • Date: Fri, 15 Jul 2005 03:02:17 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Daniele, with the following commands you will see a red sphere with shadows
from the lighting:

      DisplayFunction-> Identity];
  DisplayFunction-> $DisplayFunction]

This is an improvement:

      PlotPoints->{7,5},DisplayFunction-> Identity];

Jose Luis 

-----Mensaje original-----
De: Daniele Lupo [mailto:danwolf_no_spam_please_ at] 
Enviado el: Jueves, 14 de Julio de 2005 01:49 a.m.
Para: mathgroup at
Asunto: [mg58688] Light and surface colors

Hi to everyone.

I've just obtained a Student License of Mathematica, and I'm working in

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

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...



<< 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_] :>

(*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: Re: Light and surface colors
  • Previous by thread: Re: Light and surface colors
  • Next by thread: Re: Light and surface colors