I'm modelling an ear and thought it would make things easier if I could colour the topography. I did this using a texture mapped with a side projection (2), which looks exactly how I want it to look (1), but unfortunately I need to re-unwrap the UV after every adjustment. Is there a way to either update the UVs automatically, or to do the same thing using only nodes? Cheers.
Final and overview:
@dixiepig was first, but I'll present method for Blender Cycles.
It is working on Global Axes, you need to choose which one is best for you case. My example take Z axis as 'height' measurement. Don't forget to Apply Rotation for your object in order to use different axes.
You can setup Color Ramp as needed.
This will render in the viewport using the blender internal rendering engine, with GLSL shading (under the "shading" section of the tools menu ("N") of the 3D viewport), if you set the viewport to Textured render (ALT+z).
The "Orco" geometry input works such that the highest point on the mesh (including stray/hidden vertices) along the local z axis is red, and the lowest point is blue. It will not update in edit mode; tabbing in and out will change it.
If you want the gradient along the y or x axes instead, just change the output of the "seperate RGB" node (working here as a separate vector XYZ node) to G or R respectively.
You may need to modify your model such that the local z axis is aligned with the same direction you want your gradient.
Hope that helps!