The colours on the sphere are due to illumination (Lighting
).
To solve this problem, it is important to be aware that the default lights are fixed relative to the camera, not relative to the coordinate system. If the coordinate system is rotated (as happens when you drag with the mouse), the lights do not move with it.
In the example you show, you are rotating a sphere. A sphere is symmetric to rotation, so absolutely nothing changes in the geometry. It seems to me that what you really want is rotating the camera, while keeping the lights fixed.
We start by taking the default lighting specification and constructing a version with lights in standard (instead of ImageScaled
) coordinates:
newLights = Block[{ImageScaled = 2 # &},
{{"Ambient", RGBColor[0.4, 0.2, 0.2]}, {"Directional",
RGBColor[0, 0.18, 0.5], ImageScaled[{2, 0, 2}]}, {"Directional",
RGBColor[0.18, 0.5, 0.18],
ImageScaled[{2, 2, 3}]}, {"Directional", RGBColor[0.5, 0.18, 0],
ImageScaled[{0, 2, 2}]}, {"Directional", RGBColor[0, 0, 0.18],
ImageScaled[{0, 0, 2}]}}
];
Then rotate the ViewPoint
instead of the object:
Graphics3D[{Sphere[{0, 0, 0}, 1]},
Boxed -> False, PlotRange -> 3,
ViewPoint -> Dynamic[RotationTransform[Clock[{0, 2 π}, 3], {0, 0, 1}][{1.3, -2.4, 2.}]],
SphericalRegion -> True,
Lighting -> newLights]
What I did here is pretty sloppy because a ViewPoint
only specifies where the camera is, but not where it is looking. For this particular object, SphericalRegion -> True
was sufficient to fix the point/direction where the camera is looking. For more complicated applications consider using ViewVector
instead of ViewPoint
. ViewAngle
may also be useful to fix the field of view. If these are left to be computed automatically, they may change during rotation, causing weird effects.