0
$\begingroup$

I can't figure out how to get this to work exactly, but I'm guessing I'll need Texture Coordinate and Mapping nodes.

I am trying to create a material that creates a gradient relative to an object's local z-axis. The idea would be that I could put this material on an object of arbitrary size, and the very bottom of the object might be red, and the very top might be green, with a gradient in between.

This is what I have so far, but the problem is that the material isn't relative to the mesh. If I put it on a smaller object, the whole thing might end up some yellow in the middle of the gradient, and if I put it on a larger object, I get a whole lot of red, a whole lot of green, and a tiny gradient in between.

enter image description here

$\endgroup$
6
$\begingroup$

Depending on what you’re looking for, you could get away with using Generated coordinates, which are normalized relative to the object’s bounding box:

$\endgroup$

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.