PDA

View Full Version : Directional light



ptigibus
02-01-2004, 06:34 AM
Hello all,

I am having troubles with directional light.

If I have the following code:

Identity matrix

Viewing transformation

Set light (directional one)

Modeling transformations

Does this mean that the direction of the light is going to change according to the viewing transformation ?

Therefore , in the following case. The direction of the light would remain constant.

initLights

set light (directional one)

draw

viewing transformations
modeling transformations.


Than you in advance

Ptigibus.

Bob
02-01-2004, 07:00 AM
In the first example, you're correct. The direction (and position for positional lights) depends on the view transform, but not the model transform.

In the second, I don't know if you're correct, cause I'm not sure I understand what you mean by constant. Constant relative to what? Anyways, if you place the light in the initialization phase, you will place the light once, and it will remain there. This means, as you move your viewpoint around, the light will appear to follow, and always appear in the same relative position to the viepwoint (like the lights on a car). On the other hand, if you place it as in the first example, the light will stay fixed in world space (like the street lights).

You speak of direction though, not position, but that doesn't matter. It's the same.

ptigibus
02-02-2004, 03:49 AM
Thanks for clearing this up.


Originally posted by Bob:
In the first example, you're correct. The direction (and position for positional lights) depends on the view transform, but not the model transform.

In the second, I don't know if you're correct, cause I'm not sure I understand what you mean by constant. Constant relative to what? Anyways, if you place the light in the initialization phase, you will place the light once, and it will remain there. This means, as you move your viewpoint around, the light will appear to follow, and always appear in the same relative position to the viepwoint (like the lights on a car). On the other hand, if you place it as in the first example, the light will stay fixed in world space (like the street lights).

You speak of direction though, not position, but that doesn't matter. It's the same.