2
$\begingroup$

I am struggling with something in the shader node editor that I thought should be rather simple, but apparently isn't. I want to map a linear gradient from the equator of a sphere towards the poles (white in the middle, black on the poles). I thought I could just separate the Z from the Object coordinates or the Y from the UV coordinates and plug it into a color ramp, but controlling the result is turning out to be very un-intuitive. When I use Object, I end up with an extremely narrow strip at the poles, and when I use UV, I have to move the stops on the color ramp almost on top of each other to narrow the gradient down. What is the optimal way to do this so that it can be easily modified?

Crushed color ramp with UV - Y axis

Extremely narrow gradient with Object - Z axis

$\endgroup$
2
$\begingroup$

Here is my result:

result

And here is my node setup:

nodes

The absolute value node works well here because instead of going from a large negative to a large positive, with zero in the middle (creating a standard linear gradient), we instead achieve a positive value on both the top and bottom of the sphere, with it linearly going towards 0 in the middle.

You can change the color ramp type to 'ease' to get a larger area of black in the middle if you want, and changing the emission value also affects it.

$\endgroup$
  • $\begingroup$ You have a perfect 1000 point rep, and I just can't do it... ...oh well, +1 for you :). $\endgroup$ – Jachym Michal Mar 15 '20 at 23:19

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.