# Color an object according to it's slope using blender

I would like to colour the surface of a wedge-shaped object according to the slope of its surface using blender. I tried the solution provided in Color a surface according to its slope , but unfortunately it only applies the colour ramp on the top of the object and not below (see image).

Do you have any suggestions on how to apply the colour ramp over the whole object?

The Z component of the normal ranges from -1 (down) to 1 (up). Your Color-Ramp is capturing only 0-1, and clamping outside that range.

If you want a symmetrical response about horizontal, you could use the Absolute of Z:

If you wanted the full range to fit the ramp, from -1 down to 1 up, you could use Map Range (flipped if you want Top > Bottom to correspond to Left > Right):

If you wanted to encode the angle of the normal to the vertical, from 0° up to 180° down, you could map the Arccosine of the Z component from 0 to pi radians.

• awsome! Thank you for your elaborate answer.
– jozi
Commented Jun 25, 2022 at 11:55

The problem is that the Z-component of your normals is within the range [-1,1] while your ColorRamp only maps the [0,1] range. Thus the lower half of your mesh is just clamped to 0 and looks all red.

An easy fix would be to use the use two Math nodes before feeding the Z-component of your normal into your ramp. The first one adds 1.0 the second one devides by 2.0.