Cubemaps

I’m getting confused.
I tried to implement a sky box using cubemaps. I’m loading a cubemap, setting texgen to OBJECT_LINEAR with
1 0 0
0 1 0
0 0 1
s, t and r planes accordingly.

It works.

Then I tried to do a object with env reflection via fragment programs. Well, it works too.

But,
I can’t understand how images in the cubemap are oriented!!! I looked throught several demos and couldn’t find it out. My first tries where a disaster, then I took some cubemaps from nvidia’s SDK. This images are flipped a funny way around. If I use normal(not flipped) images, reflections and skybox are messy.

Am I doing something wrong?

There is a document available in the nVidia SDK (and presumably on their web site) which attempts to explain the orientation of the Cube map images.

Check out: http://www.r3.nu/~cass/nv/cubemap_image_orientation2.ppt

I’m not sure if this version of the ppt has made it into the NVIDIA SDK (or the web site).

Thanks -
Cass

Hmmm…
And how rendering to a cubemap should work then? If I render dirrerent sides of the cube, must I then flip the pbuffer or will it be done automatically?

Originally posted by Zengar:
Hmmm…
And how rendering to a cubemap should work then? If I render dirrerent sides of the cube, must I then flip the pbuffer or will it be done automatically?

Hi Zengar,

You have to render flipped for the images that require it when rendering to cube map faces.

Note that this is not required with D3D because of the way it specifies texture images (top down instead of bottom up).

I agree this is a bit annoying for OpenGL, but the genesis of this hardware feature was from the D3D world, and the OpenGL functionality was specified to match that. (For better or worse.)

Thanks -
Cass

Actually it´s not that bad. If you render to a cubemap, than simply render that cubemap as a skybox afterwards and watch out for faces that are rendered upside-down or so.
Then simply put a glScalef (1,-1,1) before the call to render that face.

It´s a bit annoying, but it can get fixed quite fast.

Jan.