PDA

View Full Version : Cubemapping and Spheremapping



iNsaNEiVaN
04-21-2002, 05:53 PM
Whats the difference between cubemapping and spheremapping?

Mazy
04-21-2002, 11:05 PM
Spheremapping is a technique that creates texture coordinates, and cubemap is a kind of map, using 6 textures (aka 1d,2d and 3d maps).. Cubemapping should be a way of applying the cubemap to an object, and there are many different ways, there GL_REFLECTION could be a better version of the 2d mapping coords GL_SPHEREMAP..

so dont confuse spheremapping with cubemaps, it's comletely different things, and you can do a lot more with cubemaps than just reflections.

JML
04-22-2002, 01:03 AM
Both cubemapping and spherepmapping are ways to convert a three-dimensional direction vector to a two-dimensional texture-coordinate pair.

A spheremap maps the direction vector to a point inside a circle of a single texture. Think of the spheremap texture as the photograph you would take from a perfectly reflective sphere.

A cubemap maps the direction vector to a point on one out of six textures (left, right, top, bottom, front and back). Think of it as having the origin inside a cube. The point where line along the direction vector intersects with the cube determines the texture to use and the texture coordinates within that texture.

In general cube mapping produces more accurate results with less distortions as compared to spheremapping. However, it does take more textures and computations.
I find it easier to create cubemaps than it is to create spheremaps, but then, I never really looked into creating spheremaps myself yet.

HTH

Jean-Marc

vincoof
04-22-2002, 01:52 AM
About portability, spheremapping is part of the OpenGL core whereas cube mapping is an extension.

About perofrmance, spheremapping is a bit faster to compute and uses less memory.

But of course there's a caveat to spheremapping. If you want to acquire realtime textures, eg for realtime reflection textures, it is a lot easier to get 6 pictures around an object (in order to do cubemapping) than getting some pictures around the object and distorting the pictures to create an unique sphere texture.

One more thing : as Mazy wrote, cubemapping can do more than reflections, whereas spheremapping is barely limited to reflections.

Conclusion--
Use spheremapping for static reflections.
Use cubemapping for dynamic reflections.
Keep in mind that cubemapping does more than reflections.

iNsaNEiVaN
04-22-2002, 01:04 PM
Thanks everyone, I understand now.