PDA

View Full Version : Tangent-Space????



TurboCG
07-07-2002, 07:31 AM
Why is tnagent-space orthonormal basis not recalculated whenever an object gets trnasformed by the model-view matrix? I noticed this in many demos.
I'm working on per pixel bump mapping demo and couldn't figure out how to use tangent-space correctly?
Thanks in advance.

davepermen
07-07-2002, 07:42 AM
why arent normals not everytime recalculated when you transform your mesh? possibly because you can transform them as well.. tangentspace is just two other vectors additional to your normal, and those vecs can be transformed by the modelview as well..

TurboCG
07-07-2002, 11:08 AM
Look at the source of the nvidia's per pixel lit torus. The tangent space is calculated once and never transformed by the modelview matrix.

dorbie
07-07-2002, 12:39 PM
The light and view vectors (or positions depending on your light & material type) are transformed through the inverse modelview to object space. Then to tangent space with the usual math.

BTW, I didn't check exactly what the code you cited does, this is just how it's often done, and how I've done this in the past:
http://www.dorbie.com/bumplogo.html

[This message has been edited by dorbie (edited 07-07-2002).]

MelvinEng
07-08-2002, 01:40 AM
Originally posted by TurboCG:
Why is tnagent-space orthonormal basis not recalculated whenever an object gets trnasformed by the model-view matrix? I noticed this in many demos.
I'm working on per pixel bump mapping demo and couldn't figure out how to use tangent-space correctly?
Thanks in advance.

well, coz tangent-space is defined in model space and not eye space. so when the model space changes(via changing the model view matrix), tangent-space changes in eye space but remains fixed wrt model space.
when the model view matrix changes, this affects the light or half vects that you need to transform into model space from eye space(via inv of model view)...but the transformation from model space to tangent space(via inv of tangent basis vects) need *not* change. hope this makes sense...