Temak
Temak

Reputation: 3009

Transforming surface normal vectors and tangent vectors

According to a book Physically Based Rendering: From Theory to Implementation. By Matt Pharr, Greg Humphreys (link, p. 86-87),
surface tangent vectors are transformed as common vectors, using transformation matrix M, but
surface normal vectors are transformed using enter image description here.

I wonder why scaling does make a normal incorrect, but doesn't touch a tangent vector? Why are normals so special?

See the figure from the book. enter image description here

I have read that such transformation for normal is needed to maintain orthogonality of the normal and tangent. But I'd like to get some intuitive explanation.

Upvotes: 6

Views: 1912

Answers (2)

Salix alba
Salix alba

Reputation: 7824

Theoretically normals are not really vectors, they are really best though of as bivectors, it just so happens that in 3D both vectors and bivector have three components so it is common to identify they two. If we lived in a four dimensional world we would not have this confusion. There vectors would have 4 components and and bivectors 6 components.

There is a subtle difference between bivectors and pseudovectors/axial-vectors. If i, j, k are your basis elements for vectors then bivectors have basis j^k, i^k and i^j, the Hodge Dual maps one set onto to the other and sends bi-vectors to pseudovectors. Bivectors can be though of as always being the cross product of two other vectors.

If you think of normals as always being the cross product of some pair of tangent vectors you can find how the normal transforms by first transforming the two tangent vectors and then taking their cross product.

Lets think of the diagram in the question as being a slice through a cylinder. In the first picture when the cross-section in a circle two tangent vectors are (1/rt2, 1/rt2, 0) and (0,0,1) where rt2 = sqrt(2). Taking the cross product gives

( 1/rt2 )    ( 0 )    (  1/rt2 )
( 1/rt2 ) X  ( 0 ) =  ( -1/rt2 )
(   0   )    ( 1 )    (   0    )

the normal. Now apply a squeeze (x,y,z) -> (x, y/2, z), the tangent vectors transform to give (1/rt2, 1/(2 rt2), 0) and (0,0,1). Take the cross product

( 1/rt2     )    ( 0 )    (  1/(2 rt2) )
( 1/(2 rt2) ) X  ( 0 ) =  ( -1/rt2     )
(   0       )    ( 1 )    (   0        )

And normalise to give ( 1/sqrt(5), -2/sqrt(5), 0 ).

It does not matter which pair of tangent vectors we choose, we will still get the same result. The above calculation is a bit long winded and involves finding a suitable pair of tangent vectors. It simpler to just use the transpose of the inverse matrix.

Upvotes: 1

spfrnd
spfrnd

Reputation: 936

For me, the intuition would be that for rotations (and in general all transformation that can be described by an orthogonal matrix) satisfy formula. That means that enter image description here, so for those kinds of transformations the treatment is not special at all.

A simple example with a non-orthogonal, symmetric matrix that illustrates that it is not sufficient to use enter image description here to transform the normal is

enter image description here

Here see that you need to transform the normal using enter image description here, which in the symmetric case is equal to enter image description here.

Notice that this covers already quite a lot of transformations. Personally, I find that transformations that are not orthogonal and not symmetric are themselves not very intuitive, so I resort to the mathematical explanation that it is required to maintain orthogonality. Since this is the defining property of a surface normal I find this argument quite plausible. Maybe writing it out makes things a bit clearer:

enter image description here

So the advantage of the transformation rule from the book is that it gives you the right normal for all transformation you can think of.

Hope this helps.

Upvotes: 2

Related Questions