PDA

View Full Version : Matrix Problem



qwert
09-13-2001, 10:31 PM
Hello everyone!

I have the following problem: I actually organise my 3d-objects in a worldspace-coordinate-system. It's a simple scene with a viewer-position( and rotation), a point-light-position and a object-position( and rotation). I want to do the lighting in object-space by myself in a vertexprogram.

So here's the rendering procedure:
1. translate and rotate for the viewer(eye to world-space)
2. translate and rotate the object(world to object-spce)
3. render it

In secondary color I safe the light-position (in worldspace), so I got it in the vertex program. But in the VP I have to transform this position to object-space. I can track the matrices in the VP, but the modelview-matrix contains only the whole transformation from object-space to eye-space. But the objectspace to worldspace-matrix lacks. How should I perform this? With a VSP-call before the object translation and rotation(transform into eyespace and then in the VP transform back to from eyespace to objectspace with GL_INVERSE_TRANSPOSE). Should that work?
(It actually came to mind right now, so I don't know...)
Or is there a more "elegant" solution?

Thanks in advance
qwert