Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MessageBox

Converting vectors from world to texture space

This topic is 5466 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to convert a light vector into texture space for bumpmapping. I have a quad with it's bottom left vertex on the origin and facing the positive x axis. I have a TBN matrix for this vertex that looks like 0 0 1 0 1 0 -1 0 0 -------- x Y Z axes of TBN matrix In other words it's just the global identity matrix rotated 90 so that the new positive x axis is pointing in the negative z direction and the new positive z axis is pointing in the positive x direction. I have a light at (3, 3, 0) in the world space: Y+ .....(3, 3, 0) | .........o | | | |_____________ X+ World Space If I transform it into texture space using the above matrix i get (0, 3, -3), but this can't be right, shouldn't it be (0, 3, 3). Y+ .......(0, 3, -3)!!! Shouldn't this be (0,3,3)? | ......... o | | | |_____________ Z+ Texture Space [edited by - MessageBox on October 8, 2003 8:18:09 AM] [edited by - MessageBox on October 8, 2003 8:19:12 AM]

Share this post


Link to post
Share on other sites
Advertisement
I'm aware of the differences between row and column major matrices. And this is a colum major matrix.

OpenGL uses column major:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
-------
x Y Z W

so I presume that the TBN matrix should as well.

TBN DOT Light
(0 0 1)(x)
(0 1 0)(y)
(-1 0 0)(z)


[edited by - MessageBox on October 8, 2003 8:24:43 AM]

[edited by - MessageBox on October 8, 2003 8:26:13 AM]

Share this post


Link to post
Share on other sites
So I had it wrong:


In OpenGL:
m0 m4 m8 m12
m1 m5 m9 m13
m2 m6 m10 m14
m3 m7 m11 m15

!=

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
-------
X Y Z W



Should be

1 0 0 0 X }
0 1 0 0 Y } axes of coordinate frame
0 0 1 0 Z }
0 0 0 1 W }


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!