1
$\begingroup$

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?

Wedge-shaped object with colour ramp but only until the middle of the wedge (lower part remains fully red)

$\endgroup$
0

2 Answers 2

2
$\begingroup$

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:

enter image description here

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):

enter image description here

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.

enter image description here

$\endgroup$
1
  • $\begingroup$ awsome! Thank you for your elaborate answer. $\endgroup$
    – jozi
    Jun 25, 2022 at 11:55
0
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .