PDA

View Full Version : Cubemaps



Zengar
01-04-2004, 04:15 AM
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?

rgpc
01-04-2004, 06:05 PM
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.

cass
01-04-2004, 08:55 PM
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

Zengar
01-05-2004, 07:43 AM
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?

cass
01-05-2004, 09:04 AM
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

Jan
01-05-2004, 09:55 AM
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.