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