-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
(Possibly related to 2014)
Something seems to be wrong with the way lighting is being calculated (at least on the two machines where I tested my code). Note the bright areas at the bottom of the sphere (see below), which is lit from above by a directional light. The vertices at the edge of a surface seem to be the culprit (and maybe this is not an easy thing to fix). I see the same behavior with the default lights().
Simple test code is below. The camera rotates around the sphere. If you watch it running you'll see some strange abrupt change in lighting, especially at the lower sphere detail setting. The screencaps show the same code, first with the default sphere detail, the last two created with sphereDetail(10,10).
Full source code for the example:
float cameraAngle;
float cameraAngleInc;
PShape sphere;
void setup() {
size(400,400,P3D);
smooth(8);
noStroke();
sphereDetail(10,10);
sphere = createShape(SPHERE, 150);
cameraAngle = 0;
cameraAngleInc = TWO_PI/600;
}
void draw() {
cameraAngle += cameraAngleInc;
camera(500*cos(cameraAngle),300,500*sin(cameraAngle),0,0,0,0,-1,0);
directionalLight(204,204,204,0,-1,0);
ambientLight(24,24,24);
background(0);
shape(sphere);
}
void keyPressed() {
saveFrame("frame_####.png");
}