#### Archived

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

# 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.

## 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 on other sites
This looks suspiciously like the difference between row-major and column-major matrices.

##### Share on other sites
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 on other sites

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 }

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 10
• 11
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632649
• Total Posts
3007644
• ### Who's Online (See full list)

There are no registered users currently online

×