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


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!

  • 1
    $\begingroup$ Would be helpful if you could provide some extra details as to how this works. $\endgroup$ – Ray Mairlot Mar 17 '15 at 21:41
  • $\begingroup$ @Bithur Z from -1 to 1 will depend on the dimension $\endgroup$ – Chebhou Mar 18 '15 at 10:26
  • $\begingroup$ @Chebhou damn, you're true! Generated will make things a bit more complex... $\endgroup$ – Bithur Mar 18 '15 at 10:34

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.