Cubemap on sphere VS multiple maps on transformed cube

Hi, apologies in advance if this was answered before, my search attempts have given me no good results so far.

What is more resource friendly:

  • using a cubemap on a sphere
  • transforming a cube to a sphere and using 6 materials on it, with each having one side of a cube map as the texture

I would also be interested in why is one would be better than the other.

Thank you!

Do you mean as an environment map / skybox? (If yes, you can just use scene.environment and scene.background)

I have multiple planets in the scene, with procedurally generated textures.
Currently I use spheres with ShaderMaterials and pass it as a samplerCube uniform, because I do some other things in the shader.
But I want to make it as optimal and performant as possible, hence my question.

Unless they are SDF spheres, I’m not sure why you’d need a custom ShaderMaterial or cubemaps :thinking:

  1. Use CanvasTexture to create the procedurally generated textures / materials (using just Canvas API.)
  2. Use the default SphereGeometry to create the planet geometry.
  3. Apply texture.mapping = Three.EquirectangularReflectionMapping to the CanvasTexture to properly map the texture on default UVs of the sphere geometry.

All would then be compatible with built-in three’s API, materials, and would use just normal texture2D uniforms.

Hmm, I have already spent a lot of time writing the code for the cube map generation, it seemed more straightforward to me. But you have a point, I will definitely look into using equirectangular maps (or just write something to convert the cube maps to equirectangular…) if they are really more performant than cube maps.

The reason I’m using custom shaders is that I don’t have any actual lights in the scene, I just do some simpler calculations in the planet shaders (using dot) to adjust the brightness on the dark side. Also adding some atmosphere effects, etc. Not going for a very realistic result, just for something that looks good and less resource heavy. I know I can still do these if I inject my custom code into the built-in shader.

Regardless of all the above, I would be still interested in my original question, if nothing else, just out of curiosity :slight_smile: