In Cycles, is there a way to create a procedural texture that follows the longitudinal lines of a sphere? Like a beach ball or globe? The texture should be able to be mapped to any sphere-shaped object, not just perfect spheres.

Longitudinal lines

My current approach is to use a rotated wave texture, but that doesn't come from the poles (It uses latitudes)


Radial Gradient texture as Texture Coordinates

This Texture node place a Radial Gradient upon the object's surface, creating a variation of factor from 0 to 1 around the origin of the object (using Object Texture Coordinates).

enter image description here

If we use the resulting factor of the node as the X input of the vector driving the mapping of a wanted coordinate, we are able to place the wanted texture with a new set of coordinates.

X (canonical name should be U) is the coordinates that read from left to right the texture and should be mappad with the gradient (see Combine XYZ node).

Y (canonical name V) should instead start from bottom to top, so it's equivalent to Generated Texture Coordinates's Z. You can extract it with a Separate XYZ node.

enter image description here

Here's the resulting shader (with a 45°-rotated Wave Texture) upon a cone, a fat Suzanne and a shell:

enter image description here

  • $\begingroup$ Great answer, thanks @Carlo! Is there a way to get accurate angles in orthographic view on a sphere like this: i.stack.imgur.com/2Oupz.png (texture mapped on a sphere)? Played around with your setup, but I could not find a way to replicate it... $\endgroup$ – p2or Feb 20 '17 at 12:41
  • $\begingroup$ Thanks @poor! I don't know if I get it right. Could you expand a bit what do you man by "accurate angle"? The radial texture is linear, so the gradient's steps are aleady evenly spaced. Maybe you can encounter a problem is that the wave texture. As I don't know what's inside the algorithm of the node, I would suggest (if it's suitable for your project) to build your own striped texture with the help of the Modulo math node. Here's a possible set-up. You can control the number of subdivions with the multiply node. $\endgroup$ – Carlo Feb 21 '17 at 18:49
  • $\begingroup$ That's still really close, thanks @Carlo. Sorry, in other words: When looking from Top Ortho onto a sphere with your nice setup I'd expect that the outgoing lines of the midpoint are in its exact angle (0°, 45°, 90° etc.) by setting up an even number like 4, 8 or 16: i.stack.imgur.com/SVdLg.png. I already tried some math as well as adding a mapping node to rotate the texture coords: blend-exchange.giantcowfilms.com/b/2792 but unfortunately I don't get it precise as needed. I hope that's a better explanation :) $\endgroup$ – p2or Feb 22 '17 at 14:26
  • $\begingroup$ If it's only a problem of syncing the bands, you can shift the radial coordinates with another math node. You should add a value equal to the half of the width of the black band: i.stack.imgur.com/YTLCv.png $\endgroup$ – Carlo Feb 22 '17 at 18:22
  • $\begingroup$ Brilliant! Took a me a while to understand the relation between the two, but I think I get it now. Thanks again @Carlo. $\endgroup$ – p2or Feb 23 '17 at 12:29

There's a more efficient approach, which is using the "Modulu" in math node to divide the gradient into smaller steps, then dividing it by itself to be able to have the full range of the gradient at each step (from 0 to 1 values), and finally using a "Greater than" node to control the lines thickness.

enter image description here

I've learned this technique from Bartek Skorupa from CG Cookie.


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.