2

I want to make a procedural planet shader in cycles, and I want to for example have some poles at the z+/z- direction and some deserts in the middle (equator). Is there any way I can get the actual coordinates (esecially the Z- one) in the node setup.

Thank you

Ray Mairlot
  • 29,192
  • 11
  • 103
  • 125
Hans
  • 135
  • 6
  • Related: http://blender.stackexchange.com/q/5491/599, http://blender.stackexchange.com/q/7222/599, and http://blender.stackexchange.com/q/7397/599 – gandalf3 Mar 18 '15 at 10:31

1 Answers1

6

This node setup allows procedural pole, tempered, desert on local Z axis based on cursor location (it should be at the center). So you can rotate, scale move in object mode without any problem.

node setup!
The Object Texture Coordinates Outputs -1 to 1 coordinates for all local axis (origin=0, so the origin has to be at the center of the object). Then we separate XYZ vectors because we want the Z coordinates only. Using the Absolute node will give us a mirrored 1/0/1 along local Z.
So now we have coordinates on Z that are 0 in the middle and 1 at each pole.
The 1st mix node is controled by a 'Greater Than' Node 0.2 so the material will use 'Desert' input from 0 to 0.2 and 'Grass' if Z coordinate is greater than 0.2.
The 2nd mix node will use the 1st mix and mixes it with 'Ice' if Z coordinate is greater than 0.8.

To control where the limits are, just change the 'greater Than' values (0-1).
But this setup will work only if your mesh sphere has a size of 2 units (default, size of the object doesn't matter).

So we want to fix this using the Generated coordinates. The generated coordinates will give a 0/1 on each local axis, no matter where is the origin or the size.

generated node setup! Now we modify the coordinates with a 'subtract' 0.5 so we have -0.5/0.5, 'multiply' 2 to make it -1/+1 as before. This time the spere can be resized in object or edit mode, nothing will change!

Bithur
  • 8,274
  • 19
  • 56