Jump to content
  • Advertisement


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.

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

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.

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!