View Full Version : bump mapping + and texture space

03-04-2002, 12:22 AM
i have been going through bump_mapping_step_1 out of nvidia's sdk and came accross this:

quaternionf q(vec3f(0,0,1), light_rotation);
object.trackball.r.inverse().mult_vec(l); // rotate the light into the quad's object space
vec3f eye(0,0,1);
object.trackball.r.inverse().mult_vec(eye); // rotate eye vector into quad's object space
vec3f h = l + eye;

I thought that these were meant to be put into texture space? or is that just for the normals?

Also, what is an easy way to transform a vector (say eye) into object space? in their example they are using quanternions, which i am not using.

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

03-04-2002, 07:34 AM
Also, what is an easy way to transform a vector (say eye) into object space? in their example they are using quanternions, which I am not using.

You can do that very easy, if you multiply the vector in eye space with the inverse modelview matrix.
The resulting vector is then in object space.


03-04-2002, 07:39 AM
They need to be transformed into 'tangent space' which is probably what you mean by texture space.

I assume the quads object space is effectively the same as tangent space in this example, although I'm not familiar with the code, if a quad is aligned along the correct axis it's tangent space would be the same as object space.

03-04-2002, 07:41 PM
Thanks for your replies,

so you are saying that in this case, their object space is basically the same as their tangent space?

also, how does one get the inverse modelview matrix?

[This message has been edited by robert (edited 03-04-2002).]

03-05-2002, 05:45 AM
Dorbie is right. I call it object space bump mapping but the tangent space for the quad is the same as its object space, so you could think of it as either.

Robert, you need to be able to invert transformations to do this math. It doesn't matter especially whether they're matrices or quaternions but you need to be able to invert them.

You can look at the glh_linear.h code for quaternion or matrix inversion as an example implementation.

Thanks -

03-05-2002, 11:15 AM
thanks for that explanation.. i understand it better now http://www.opengl.org/discussion_boards/ubb/smile.gif. i have had a look at glh_liner.h and i has an inversion function so i will look at that.

thanks http://www.opengl.org/discussion_boards/ubb/smile.gif