bump mapping + and texture space

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);
q.mult_vec(l);
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;
h.normalize();

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

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.

Diapolo

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.

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).]

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 -
Cass

thanks for that explanation… i understand it better now . i have had a look at glh_liner.h and i has an inversion function so i will look at that.

thanks