# Colors not showing in Graphics3D

The following code works, except that the colors aren't showing in the output. Wh? I probably made a trivial mistake, but I'm yet unable to find it.

  Flatten[Table[{x, y, z} =
{RandomReal[{-10, 10}], RandomReal[{-10, 10}], RandomReal[{-10, 10}]};
p = 0.1;
{u, v, w} = {0.0, 0.0, 0.0};
NestList[(u += RandomReal[NormalDistribution[0, s]];
v += RandomReal[NormalDistribution[0, s]];
w += RandomReal[NormalDistribution[0, s]];
# + p {u, v, w}) &, {x, y, z}, 50],
{s, 0.1, 1, 0.05}], 1];
PlotColor = ColorData["SunsetColors"];

Graphics3D[{PointSize[0.1], {PlotColor[Norm[#]], Sphere[#, 0.1]}& /@ RandomWalkCoords},
Boxed -> False, Background -> Black, Lighting -> "Neutral", SphericalRegion -> True]


I'm not very familiar with this way of programming Mathematica (I'm on version 7.0 by the way), but I'm learning!

The output should show a bunch of random curves made of small balls (no lines), with a radial color gradient.

Maybe there's a simpler way of doing this?

• If you remove the Lighting->"Neutral" option, your code should work. – gpap Mar 11 '13 at 15:54
• Well, it doesn't make the SunsetColors to be used. There's something else. – Cham Mar 11 '13 at 15:58
• ah, yes, sorry - missed they weren't normalised to 1. As the answer says, dividing the Norm by the max will do. Also, why Sphere and not Point? – gpap Mar 11 '13 at 16:09

max = Max[Norm /@ RandomWalkCoords]

then change PlotColor[Norm[#]] to PlotColor[Norm[#]/max].