Shining a spotlight at the background

I want to be able to simply shine a spotlight straight into the screen onto the background in a sort of 2D manner. I found that using ortho() eliminates the perspective which is good. The next issue is that the lights need a surface to shine onto. I found that shining onto a sphere creates the effect I need but I want to shine onto the entire window so I tried to use a square but I get really weird results. Below is simple code which shows a spotlight shining straight down (Z) onto a sphere but I try to shine down onto a square (XY plane) it only shows up near the corners. Ellipse has interesting black hole light results. Any ideas? I basically want a 2D program but want to use lights to control translucent areas of color.

void setup()
  size(1240, 660, P3D);
  colorMode(RGB, 255);

int A, B, Ax, Ay, Bx, By;

void draw()
  ambientLight(50, 50, 50);

  spotLight(255, 0, 0, width/2, height/2, 600, 0, 0, -1, PI/2, 100);

  spotLight(0, A, 0, Ax, Ay, 600, 0, 0, -1, PI/2, 100);
  spotLight(0, 0, B, Bx, By, 600, 0, 0, -1, PI/2, 100);

  translate(mouseX, mouseY, 0);


    /*if (A > 0)
   if (B > 0)

boolean alt;
void mouseClicked()
  alt = !alt;
  if (alt)
    Ax = mouseX;
    Ay = mouseY;
    A = 255;
  } else
    Bx = mouseX;
    By = mouseY;
    B = 255;
Sign In or Register to comment.