I'm trying to map planet textures on spheres, and the maps are Equirectangular. I'm initially mapping the textures to the spheres by using "object" generated texture coordinate input as the vector for and "environment texture" node instead of "image texture" since environment texture node has a equirectangular projection setting and image node does not. This is currently the only way I've found it possible to map equirectangular textures to spheres without distortion.

Now that I'm ready to paint on the textures and add mountains and valleys to the planets, I have to UV unwrap the spheres. Is there a way to bake or generate a UV map from the object generated texture coordinates?


Spherical Coordinates

enter image description here

The pictured above part of node setup from https://blender.stackexchange.com/a/148354/15543 (refined from https://blender.stackexchange.com/a/159492/15543)

produces spherical coordnates (r, theta, phi) from object texture coordinate (x, y, z) Equirectangular coordinates map latitude to U and longitude to V .. (or is it vice versa) and are recognizable from their 2 x 1 aspect ratio image.

The angles are in radians. 360 degrees = 2pi radians.

The latitude is mapped to [-pi/2, pi/2] the longitude [-pi, pi] mapping both to [0, 1] by dividing by range (pi for latitude and 2 * pi for longitude) and adding 0.5 will produce Equirectangular UV coordinates to plug into a texture node.

Note the mapping node is not required, but can be used to alter the meridian for example.

Alternatively could use vector maths and input up and zero meridian vectors.

Texture Painting

If we set up a sphere from a grid, or plane as described here

How to animate morphing a rectangular plane into a sphere in particular using method for 2.8 used here https://blender.stackexchange.com/a/24053/15543

poles are nicely collapsed to a point, and the UV is a perfect quad. Hence can texture paint on our sphere to an Equirectangular projection image.

enter image description here First time texture painting.. but in the right spots

Note: Made the grid 2x in x dimension. Empty rotated (90, 0, 90) the simple deforms -180 in z on top of -360 in x.

| improve this answer | |
  • $\begingroup$ thank you so so much this eliminates the problem of environment texture nodes not being recognized in the texture paint, but i still need to somehow bake this mapping into actual UVs so that i can paint on the sphere in 3D. I think that it uses the UVs to project the paint in 3d to the 2d textures. $\endgroup$ – zander Dec 15 '19 at 6:14
  • $\begingroup$ Thanks layering the generated coordinates with a uv texture definitely helps. I'm working with icospheres and I've since opted to baking the textures to the default ico unwrap since it has the most even pixel distribution across equilateral triangles. Now I've run into a little blending issue across the UV seams and made a new question for it here: blender.stackexchange.com/questions/161359/… $\endgroup$ – zander Dec 19 '19 at 9:15

I've probably missed the point, so sorry, delete coming... but isn't Equirectangular the default unwrap, that comes with a UV Sphere?

enter image description here

enter image description here

(Image courtesy Wikipedia)

| improve this answer | |
  • 2
    $\begingroup$ Unfortunately it gets a bit gnarly at the poles. Each pole maps to top and bottom line of UV to a point, whereas UVMap has the sawtooth. Using wrap wrap.. or is it warp warp on a grid is another way to do it. $\endgroup$ – batFINGER Dec 15 '19 at 15:04
  • $\begingroup$ blender.stackexchange.com/questions/24043/… $\endgroup$ – batFINGER Dec 15 '19 at 15:09
  • $\begingroup$ ahh. OK... I'll leave this up, it may help make the problem a little clearer. $\endgroup$ – Robin Betts Dec 15 '19 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.