# Cycles Nodes - get actual coordinates

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

• – gandalf3 Mar 18 '15 at 10:31

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. 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. 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!

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