3D sphere is rendering flat

I’m so confused. I can’t seem to get anything to render shaded. Everything is just a flat color with no specular or diffusion.

Here is a simple example with one sphere:

void setup() {
size(1000,1000,P3D);
background(0);

lights();
sphereDetail(30);
}

void draw() {
fill(192);
noStroke();

pushMatrix();
translate(width/2,height/2,0);
sphere(100);
popMatrix();
}

Just creates this flat grey circle:

I have tried adding directional lights, spot lights, changing the camera’s perspective, changing the sphere level of detail, and other shapes.

What am I doing wrong?

Does moving lights() to draw() fix it?

1 Like

Yes! Thank you Neil I am most grateful!