Balrog of Morgoth

06-20-2007, 11:38 PM

Is it possible to do the lighting in model space?

The OpenGL spec specifies that the lighting calculation is performed in the

eye space. While the vertex coordinate and light source positon and direction

are specified in the model space. So the implementation must transform those

quantities from model space to eye space which invoves many matrix-vector

multiplication and even the matrix inversion for normal transformation. So,

why not just do the lighting in model space?

If the model-view transformation is the rigid transformation, then I do not

see any problem in lighting calculation in model space since the lighting

calculation should be independent of the choice of the coordinate system.

But the model-view transformation may not be the rigid transformation if

scaling and shearing is utilized. And in this case we may not peform the

lighting calculation in the model space and have to perform it in the

eye space.

But there seems to be a problem if non-rigid model-view transformation is used.

the non-rigid model-view transformation for vertex cooridnate has no problem.

We can think it as first perform a non-rigid model transformation from model

space to the concept world space, and then a rigid view transformation from

the concept world space to the view space. If we specify the light source in

the concept world space or just the view space, then everyting is OK. But, the

OpenGL specifies the light source in the model space. That is, the light source's

position and direction also undergo a non-rigid transformation. And after this

non-rigid transformation for the light source, will the lighting calculation in

the view space still make sense? Conversely, if this does make sense, then why

does not performing the lighting calculation in the model space in case of a

non-rigid model-view transformation make sense?

Thanks in advance...

The OpenGL spec specifies that the lighting calculation is performed in the

eye space. While the vertex coordinate and light source positon and direction

are specified in the model space. So the implementation must transform those

quantities from model space to eye space which invoves many matrix-vector

multiplication and even the matrix inversion for normal transformation. So,

why not just do the lighting in model space?

If the model-view transformation is the rigid transformation, then I do not

see any problem in lighting calculation in model space since the lighting

calculation should be independent of the choice of the coordinate system.

But the model-view transformation may not be the rigid transformation if

scaling and shearing is utilized. And in this case we may not peform the

lighting calculation in the model space and have to perform it in the

eye space.

But there seems to be a problem if non-rigid model-view transformation is used.

the non-rigid model-view transformation for vertex cooridnate has no problem.

We can think it as first perform a non-rigid model transformation from model

space to the concept world space, and then a rigid view transformation from

the concept world space to the view space. If we specify the light source in

the concept world space or just the view space, then everyting is OK. But, the

OpenGL specifies the light source in the model space. That is, the light source's

position and direction also undergo a non-rigid transformation. And after this

non-rigid transformation for the light source, will the lighting calculation in

the view space still make sense? Conversely, if this does make sense, then why

does not performing the lighting calculation in the model space in case of a

non-rigid model-view transformation make sense?

Thanks in advance...