# parametric 3D sphere unwrapping math for perfect 3D-textures

After some time looking or it on the internet I can't find the proper answer to my concern.

I'm currently generating 3D textures on a shader for my planets to avoid sphere mapping issues (pole, distortion, ...).

It works great however I'm limited due to algorithm complexity so I'd like to generate my 3D textures on the CPU side. However a fully furnished 3D texture is heavy like crazy (3 dimension remember) so I'd want to store a 3D result in a 2D texture.

I need to find the correct transformation from 3D coordinates to 2D storage. Anyone have a clever thought ?

Edit : not looking for Sphere cube Map, Octohedron or similar, several texture (like in EveOnline).

I'm looking for something that you have in 3D modelers where you can unwrap a sphere on a flat surface (not regularly).

Typically the picture on the bottom:

With a function vec2 map(vec3) which can map a 3D texture and retrieve the correct value on the sphere surface.

• I would store it in a cube map. – msell Jan 13 '14 at 17:31
• Well this is in fact a common solution – StackHola Jan 13 '14 at 17:37
• I edited to add what I'm not looking for – StackHola Jan 13 '14 at 19:00
• Why aren't you looking for those solutions? That's just as important; if you (apparently pointlessly) narrow the set of "acceptable" solutions without explaining why, you can easily render your question unanswerable except with "it's impossible since you have dismissed all the available options." – user1430 Jan 13 '14 at 19:06
• Even after your edit cube map satisfies all your requirements and is supported by the graphics hardware. Also there is no such thing as a perfect or the most accurate solution for this problem. Different solutions have different pros and cons and introduce different distortion. – msell Jan 14 '14 at 5:38