Sign in to follow this  
Lightness1024

Official faces layout in cubemap ?

Recommended Posts

Hi there,

 

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

"cubemap cross"

eg:

https://www.google.com/search?q=cubemap+cross&tbm=isch&sa=X&ei=w-0KVJD5J5W78gXx_YK4BQ&ved=0CAgQ_AUoAQ&biw=1858&bih=1009

 

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:

http://www.nvidia.com/object/cube_map_ogl_tutorial.html

 

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:

http://postimg.org/image/6q1gdr9yj/

 

+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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this