Spherical Textures

Vortex Acherontic 359 words 2 minutes blender game-dev godot

While working on Space Conflicts: Empires we had to create textures for spheres (eg. planets and stars). However a texture is a 2d rectangular image and mapping them on a sphere may cause distortions or seams. Therefore the texture needs to be "aware" of being mapped to sphere.

Plane Texture on Globe

The easiest way to generate such a texture is to create a procedural texture in Blender which is applied to a sphere and "just" render it into a file.

  • Put a camera inside a sphere
  • Disable all lighting as otherwise the camera will only see black
  • Switch to cycles as Eevee does not support the feature we need
  • Change the camera projection mode to panorama. Which tells Blender to render a 360° view of the entire scene
  • Render the image and store it into an image file
  • Import this texture into Godot and apply it to a shader which is then applied to a sphere
Blender camera inside an icosphere
Blender Camera settings showing how to set it to panorama mode

Tada, a seamless spherical texture with no distortions.

Spherical aware texture on Globe

This is what the actual texture then will look like:

Planar:

Planar texture showing stripes

Spherical:

Planar texture showing spherical stripes

Source

Source? I made it the fuck up