First guess β this might have to do with the different ways that stroke, fill, alpha and light interact with primitives. Certain combinations can sometimes have surprising results β especially in shapes like spheres, where stokes donβt interact as one might expect.
/**
* Box Lighting
* 2018-05-24 Jeremy Douglass - Processing 3.3.6
* discourse.processing.org/t/plane-not-being-lit-in-scene/310/2
* based on Sphere Lighting:
* forum.processing.org/two/discussion/18352/
**/
float sw, sh, sr; // box width, height, radius
float lightX, lightY;
void setup() {
size(800, 400, P3D);
textAlign(CENTER,CENTER);
textSize(12);
textMode(SHAPE);
sw = width/7.0;
sh = height/3.0;
sr = width/14.0;
}
void draw() {
background(64);
translate(0,0,-70);
stylebox ( sw * 0, sh * 0, sr, "noStroke", 0, "noFill");
stylebox ( sw * 1, sh * 0, sr, "noStroke", 0, "0");
stylebox ( sw * 2, sh * 0, sr, "noStroke", 0, "255");
stylebox ( sw * 0, sh * 1, sr, "0", 1, "noFill");
stylebox ( sw * 1, sh * 1, sr, "0", 1, "0");
stylebox ( sw * 2, sh * 1, sr, "0", 1, "255");
stylebox ( sw * 0, sh * 2, sr, "255", 1, "noFill");
stylebox ( sw * 1, sh * 2, sr, "255", 1, "0");
stylebox ( sw * 2, sh * 2, sr, "255", 1, "255");
stylebox ( sw * 4, sh * 0, sr, "noStroke", 0, "noFill");
stylebox ( sw * 5, sh * 0, sr, "noStroke", 0, "0");
stylebox ( sw * 6, sh * 0, sr, "noStroke", 0, "255");
stylebox ( sw * 4, sh * 1, sr, "0", 10, "noFill");
stylebox ( sw * 5, sh * 1, sr, "0", 10, "0");
stylebox ( sw * 6, sh * 1, sr, "0", 10, "255");
stylebox ( sw * 4, sh * 2, sr, "255", 10, "noFill");
stylebox ( sw * 5, sh * 2, sr, "255", 10, "0");
stylebox ( sw * 6, sh * 2, sr, "255", 10, "255");
}
void stylebox(float x, float y, float r, String strStroke, int strWeight, String strFill){
pushMatrix();
translate(x, y, 0);
translate(r, r, 0);
//// draw box
pushStyle();
lightControl();
strokeWeight(strWeight);
if(strStroke == "noStroke") { noStroke(); }
else { stroke(int(strStroke)); }
if(strFill == "noFill") { noFill(); }
else { fill(int(strFill)); }
box(r);
popStyle();
//// draw label
translate(0,0,80);
pushStyle();
strokeWeight(1);
fill(255);
noLights();
rect(-36,-24,72,48);
fill(0);
text(strStroke + "/" + strWeight + "\n" + strFill, 0,0,0);
popStyle();
popMatrix();
}
void lightControl(){
// lights();
directionalLight(255, 204, 204,
-(mouseX / float(width) - 0.5) * 2,
-(mouseY / float(height) - 0.5) * 2,
-1);
}
One basic question testing to ask with 3D lighting β is a rect interacting in the same way that a very thin box does (a box the size of the plane and few pixels thick)? That can really help you narrow down the problem β e.g. if it relates to the type of primitive, or culling, et cetera.