Jump to content
  • Advertisement
Sign in to follow this  

Official faces layout in cubemap ?

This topic is 1478 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

Hi there,


first of all, I encourage the readers of this topic to go to google image search, and type:

"cubemap cross"




Ok, so there are multiple conventions clearly, some put the horizon on the small part of the cross, some turn the cross on the side and put the horizon along the long edge.

I have even seen the top part of the sky being split accross the 4 segments around the center.


Now, there is a somekind official definition that works for me:



major axis 
direction     target                              sc     tc    ma 
----------    ---------------------------------   ---    ---   --- 
 +rx          GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT   -rz    -ry   rx 
 -rx          GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT   +rz    -ry   rx 
 +ry          GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT   +rx    +rz   ry 
 -ry          GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT   +rx    -rz   ry 
 +rz          GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT   +rx    -ry   rz 
 -rz          GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT   -rx    -ry   rz



I'm not sure if it works for right handed AND left handed coordinates convention ?

But it works in my left handed case.


In my case the convention is like that:



+Y is the top, and +X the right, while +Z is the front.


I think only the "+Z is the front" is somehow one of the most standard things when it comes to convention because this is where a camera is looking with a unity matrix.


What do you think about cubemap conventions ? how does it relate to coordinate conventions ?

Share this post

Link to post
Share on other sites

last time i looked, there didn't appear to be any conventions, although some arrangements did seem to be slightly more common than others. 


off the top of my head, i would think that nvidia's layout would not work for right hand coordinate system if it works for left hand - i would think that some faces would be inverted/mirrored, etc.  I'd have to think about it for a moment, but conversion from LH to RH shouldn't be too hard. it could be done to the texture itself in a paint program, or in the code, by simply changing the order in which the texture was read, thereby mirroring, or whatever as needed. not sure DX and OGL directly support what might be needed. fixing the texture is the better way to do it - runs faster - cleaner code.


as for cubemap conventions:


although i'd have to confirm this, i suspect that LH and RH are not interchangeable.


so, once you choose LH or RH, you then have a number of ways you can actually arrange the images in the cross.


at that point, i'd say its time to define your own conventions. using the order used by popular examples such as nvidia or directx might be one option, or using the order most commonly found online and in existing titles. but as i said, there seemed to be no clear winner there the last time i looked. perhaps one particular order was slightly more common at best. it was sufficiently muddled for me to conclude there were no standards or convetions as to cross layout, defacto or otherwise.


note that my search was geared more towards skyboxes than cube mapped objects. same basic idea, but the camera is inside the object, instead of outside.  because of the special geometry of skyboxes, i prefer using 6 planar projections vs a cubemap. works fine for skyboxes, but wouldn't work for something like a cube environment map such as DX's mirrored chrome teapot example.


going with a cross layout convention that is intuitive with respect to the object's local axis, such as the convention you mention, is probably the way to go. when working in a game with a LH projection system. its best to maintain the LH convention throughout all frames of reference, to avoid confusion. 

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!