Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Transforming a ray into non-uniformly scaled local space Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
nenad

March 10, 2005, 04:55 PM

I have a ray defined by origin point o and the direction vector n. This ray needs to be transformed into local space defined by 4x4 matrix M.

I've learned that I need to do:

o' = M * o
n' = N * n

N being inverse transpose matrix. Now, this works fine as long as the scaling in M is uniform. With non uniform scaling, ray's direction vector isn't transformed correctly ( I'm using the ray for testing intersections with triangles in local space )

I've googled for this but found only fragmented info. I'd be grateful if anybody could elaborate a bit on how to do it "properly"

 
Reedbeta

March 10, 2005, 06:53 PM

I'm not sure where you came up with needing the inverse transpose matrix....that is for normals of planes. Transforming the ray direction vector should use the same matrix as its origin. Also, make sure the origin has a 1 in the 4th component (w) and the direction has a 0.

 
nenad

March 10, 2005, 07:31 PM

Hm, I tought the direction vector would have similar problems as normal. Apparently using the same matrix and having 0 for w makes it right.
Thanks!

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.