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


Cubic Environ Mapping - Translation?

Recommended Posts

Tones2    122
I noticed that in every example I ever have seen on Cubic Environmental Mappping, the textured Object is always smack in the middle at World position (0,0,0). When I do this in my own programs, everything works 100%. However, if my object position is something other than (0,0,0), I''m having trouble understanding how to translate the related cubic texture matrix. Most of the examples set up the Cubic texture, get the Camera view matrix, zero out the _40, _41, and _42 components to prevent translation of the texture on camera movement, then get matrices relating to the 6 cubic 90 degree positions and multiply this by the modified camera matrix above. Then the view matrix is set again and you render the scene into the cubic texture. However, I''m not sure how to modify this to translate the cubic texture position relative to the object. I tried getting a translation matrix for the object position and multiplying this by the modified view matrix before the cubic map matrix multiplication. Although it appeared to me that the texture was in somewhat the correct position (i.e. in the reflection), the objects relationship to each other was wrong and the objects moved in the cubic texture relative to each other in the wrong way when I rotated the camera. I also tried directly replacing the _40, _41, and _42 elements in the view matrix with the transation coordinates, but this came out wrong as well. Can anyone tell me how to do this? Thanks, Tony

Share this post

Link to post
Share on other sites