#### Archived

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

# cube maps again

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

## Recommended Posts

I''ve been trying to get cubic environment mapping to work and I have a couple of questions. Generating the textures was easy, but rotating the texture matrix so that the textured object looked right with a changing eye position had me stuck for a while. According to the extension registry, "The rotation can be computed based on two vectors: 1) the direction vector from the cube map center to the eye position (both in world coordinates), and 2) the cube map orientation in world coordinates. The axis of rotation is the cross product of these two vectors; the angle of rotation is the arcsin of the dot product of these two vectors." Could someone please give me a more detailed explanation of how this is supposed to work? In particular, what is the one vector that is supposed to represent the cube map''s orientation? Since I didn''t understand this explanation, I came up with my own solution, and I would like someone to tell me if it''s "right". What you want is for the texture to rotate in exactly the opposite way that the eye orientation rotates. The modelview matrix after a call to gluLookAt contains rotation and translation information. First get rid of the translation information by setting those cells to 0. You''re left with a matrix that can be expressed as some rotation matrix R about some angle t. What you want is R(-t). Fortunately, R(-t) = R-1 and R-1 = RT. So, all you have to do now is find the transpose of the modelview matrix sans translation information, and that is the proper texture matrix. Is this right? Any help clearing up misconceptions would be appreciated.

1. 1
Rutin
37
2. 2
3. 3
4. 4
5. 5

• 12
• 10
• 13
• 104
• 11
• ### Forum Statistics

• Total Topics
632983
• Total Posts
3009697
• ### Who's Online (See full list)

There are no registered users currently online

×