Coordinate confusion

I’m missing something simple here, but I can’t figure it out.

I’ve created 100 “flat” quads/nodes out of GeomTriangles (I know it’s inefficient to render, I’m still learning), each (1,0,1) in size, from (0,0,0) to (9,0,9). I have the following code to position the camera and a point light:

      plight = PointLight('plight')
      plight.setColor(VBase4(1, 1, 1, 1))
      plight.setAttenuation(Point3(0, 0, 0.2))
      plnp = render.attachNewNode(plight)
      plnp.setPos(5, 2, 5)

What I don’t understand is why the y-axis coordinate has to be positive for the light’s setPos and negative for the camera’s setPos. I would have expected them both to be negative (“out of the screen”) but if I change the light’s y to negative it doesn’t show. Why are they different?

In general, +y is forwards, and -y is backwards.

An object is visible when it is in front of the camera (its y position is greater than the camera’s y position).

Think of the camera as your own eye position. When you move the camera backwards, it is the same thing as moving everything else forwards. Everything you see is relative to the camera’s position.


I’m sorry, I still don’t quite get it.

Is this correct with regards to the code I posted, if this line represents the y-axis?

-19 (camera) ----------> 0 (quads) --------> 2 (light)

Why is the light is visible when it uses a positive y-coordinate if the quads (perpendicular to the y-axis) are at 0? Wouldn’t the light then be “behind” the quads (with respect to the camera) at a positive y-coordinate?

Or does moving the camera actually move the other objects in the scene? That would seem very weird to me, and it still wouldn’t explain why I can see the light with a positive y-coordinate…

I don’t understand precisely what you mean when you say the light is “visible”. A point light is never visible, not directly, but you can see the effect it has on geometry nearby it. So if the light is sufficiently near the quads, on one side or the other of them, you can see the quads get brighter.

Depending on the normals of your quads, you might not see that effect if the light is on the wrong side of them (away from the direction of the normals), because that’s the “back side” of the surface that doesn’t reflect light.

Try putting a model, say zup-axis.egg, at the same place the point light is. This will help you visualize where the light is and what effect it is having.


You are right, what I meant when I said “light is visible” was “the light’s effect is visible”.

The phrase “away from the direction of the normals” is the key; my normals are backwards. :blush:

Thanks for your help!