'Static' Cube Mapping a Planet.

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
Fost
Gnoblar
Posts: 17
Joined: Tue Jul 05, 2005 9:32 am
Location: UK
Contact:

'Static' Cube Mapping a Planet.

Post by Fost »

Not too sure what the correct terminology is, but I'm trying to apply a cube map in a non 'environmental' way- i.e. fixed to the mesh, and unchanging with camera movement.

essentially - cube mapping a sphere with arbitrary geometry. 1024x1024 x 6 Cube Map gives us the same resolution as a 4096x4096 spherical map, so I'm hoping it can applied in this way. I've got a material with a cube map loaded, but I'm not sure what setting would be needed to make the texcoords work statically. Although env_map cubic_reflection does show everything up as working, how do I make the cube map 'fixed' to the surface? Or is this not possible?

Any ideas?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

You can do this, yes. Your mesh will need to have 3D texture coordinates (uvws, which OGRE supports in its mesh format - use VET_FLOAT3 instead of the more usual VET_FLOAT2 for texture coords), calculated as the normalised vector from the centre of the sphere, through the vertex in question. Bind a cubemap of the world and use those uvw's to address the texture.

It is, however, more expensive than the traditional approach of using a distorted 2D atlas style texture. Less distortion at the poles I'll admit though.
User avatar
Fost
Gnoblar
Posts: 17
Joined: Tue Jul 05, 2005 9:32 am
Location: UK
Contact:

Post by Fost »

Thanks, I'll give that a go.

It's possible the sphere could be generated from a cube anyway so it would have 6 spherically distorted sides so we could use plain old 2d mapping. that would be faster and mroe compatible with older cards I guess.

-thanks again :)
Post Reply