POV-Ray : Newsgroups : povray.advanced-users : Question about normals Server Time
1 Nov 2024 05:19:41 EDT (-0400)
  Question about normals (Message 1 to 5 of 5)  
From: Slime
Subject: Question about normals
Date: 15 Nov 2002 21:23:34
Message: <3dd5ac26$1@news.povray.org>
I was unable to figure out from the POV-Ray source code exactly how this was
done.

Let's say I have an object. I know of a point A on this object. I happen to
know the normal of the object at point A.

Now, I apply a matrix transformation to the object. Point A has been mapped
to point B. How do I figure out the normal of the transformed object at
point B?

I thought, at first, that I could apply the inverse of the matrix
transformation to the normal, but then I realized that this wouldn't work in
all cases.

How is it done?

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Christopher James Huff
Subject: Re: Question about normals
Date: 15 Nov 2002 21:55:11
Message: <chrishuff-DCA76E.21542715112002@netplex.aussie.org>
In article <3dd5ac26$1@news.povray.org>, "Slime" <slm### [at] slimelandcom> 
wrote:

> I thought, at first, that I could apply the inverse of the matrix
> transformation to the normal, but then I realized that this wouldn't work in
> all cases.

You are correct. The answer is pretty simple: transform the normal by 
the transpose of the inverse of the transformation matrix.
Ok, it's simple assuming you know some matrix math. ;-)

This should explain things a bit more thoroughly:
http://www1.acm.org/pubs/tog/resources/RTNews/html/rtnews1a.html#art4

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Slime
Subject: Re: Question about normals
Date: 15 Nov 2002 23:10:16
Message: <3dd5c528$1@news.povray.org>
> You are correct. The answer is pretty simple: transform the normal by
> the transpose of the inverse of the transformation matrix.
> Ok, it's simple assuming you know some matrix math. ;-)


The *transpose* of the inverse?!? OMG! Wow. I'm going to think about that
for a while. Thanks! And thanks for the link =)

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Question about normals
Date: 16 Nov 2002 08:25:03
Message: <web.3dd645beb3508d7038149fba0@news.povray.org>
Christopher James Huff wrote:
>In article <3dd5ac26$1[at]news.povray.org>, "Slime" <slm### [at] slimelandcom>
>wrote:
>
>> I thought, at first, that I could apply the inverse of the matrix
>> transformation to the normal, but then I realized that this wouldn't work in
>> all cases.
>
>You are correct. The answer is pretty simple: transform the normal by
>the transpose of the inverse of the transformation matrix.
>...

If the column or row vectors in his transformation
matrix forms an orthonormal basis, then the
transpose of the inverse of that transformation
matrix should be the transformation matrix itself.

I have not given transformation of normals much
thought, but I think that a consequence of the
above must be that:

As long as his transformation matrix does not scale
or shear the object in any way, he can just use this
matrix for the normals as well.


Tor Olav


Post a reply to this message

From: Christopher James Huff
Subject: Re: Question about normals
Date: 16 Nov 2002 11:41:40
Message: <chrishuff-E72300.11410016112002@netplex.aussie.org>
In article <web.3dd645beb3508d7038149fba0@news.povray.org>,
 "Tor Olav Kristensen" <tor### [at] hotmailcom> wrote:

> As long as his transformation matrix does not scale
> or shear the object in any way, he can just use this
> matrix for the normals as well.

Equal scaling is possible, only unequal stretching needs the transpose. 
But detecting this case takes more processing power than using the 
transpose of an existing inverse matrix, implementing it that way is a 
waste of time. It is easy to make a function that transforms by the 
transpose instead of the matrix without actually going through the 
trouble of transposing the matrix, it is no more computationally 
expensive than an ordinary direction vector transformation.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.