Converting vectors from world to texture space
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]
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement