Difficulty trying to maintain lighting on a wall

Hello!,
I’m trying to simulate a moving wall and I have a ‘pointLight’ lighting from the position of the camera (approximately).
The problem I’m having is that when the wall moves, the lighting starts to get darker (even with the spotLight on draw).
I honestly don’t know if there’s something I’m missing and I can’t find in the documentation.
An example that reproduces the problem I want to solve is:

int z = 0;

void setup() {
  size(1024, 768, P3D);
}

void draw() {
  if (z > 1000)
    z = 0;
  
  background(0);

  pointLight(173, 208, 200,
    width/2, height/2, -200);

  beginShape();
  textureWrap(REPEAT);
  textureMode(NORMAL);
  vertex(0, 0, z);
  vertex(0, 0, -10000+z);
  vertex(0, 768, -10000+z);
  vertex( 0, 768, z);
  endShape(CLOSE);
  
  z += 5;
}

Thank you!

1 Like

It looks like, as time passes, you are pushing your whole wall back in z

However, you are not moving your point light in z along with the wall.

So, your wall is getting farther from your light.

Jeremy, thank you for the response!.

The wall is being moved but the camera remains at the same position, so why moving the wall but not the light nor the camera ends up making this effect of the light being moved with the wall?
I couldn’t find documentation about this behavior and intuitively I tend to think that if the light and the camera remains in the same position it should illuminate the part of the wall that is near it on each frame.