Home Technical Talk

cubemap orientation

polycounter lvl 18
Offline / Send Message
CrazyButcher polycounter lvl 18
as with the age old fight of what is up (Z,Y..). I stumbled accross similar problem with cubemaps.
spefically I just added .dds support to luxinia and found (among other bugs with skybox) that their orientation differs as well. Like the cubemapgen tool from ati comes with several sample cubemaps, and there is all kinds of orientation in them.

I wonder what you guys work with mostly, what is the "sky" for you ?

Replies

  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    I ran into this problem too while writing shaders. I was using the regular reflection vector or surface normal to do the cubemap look-up, but using cube maps that I downloaded from the web, the maps always came in on their side since Max is Zup. For awhile I started making my own custom cube maps to get around the problem, but then I decided it was best to go with the more standard format and just swizzle my look-up vectors.

    Aside from the Z up or Y up thing, there's also the issue of inside or outside. If you create your cube map by rendering the six panels in a 3d environment, you're using the "inside" format - because your camera is inside the environment. If you create your cube map from lightprobe or a mirror ball photograph, you're using the "outside" format since your camera is outside of the mirror ball looking in. You have to account for that in your shaders as well. What I've been doing recently is putting an extra line of code in my shaders that fixes that and then just commenting it out if I'm using the other type of cubemap.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    thanks for your info,
    the engine mostly relies on fixed function, and shouldnt need much "coding" from the user. So mostly it will be used for simple reflections/skybox.
    He can however always change texture matrices if the orientation is not to his likings. But I now picked, what most cubemaps I found in nv and atidsk use, as default.
    just gotta make sure the user can "rotate the sky" easily, too, if he uses different format.
Sign In or Register to comment.