[Tech Art] Need help to create a gradient in world space

Maybe the problem is related with the difference between the bounding box center and the object center, in more complex shapes.

To make a gradient based on the (height) of the bounding box you have to tell the shader, not only the scale, but the position of the center of the bounding box, or better, the bottom-y position of the box and the height of the box.

Then, rewrite all positions based on this bottom-y position. Something like,

y_normalize = (y_pos - y_bottom_box)/y_height_box

or, in your Amplify Shader replace the Object To World node with a variable with the y_bottom_box info (you are only interested in the y-component of all things)

I think, this “y_normalize” is exactly the gradient you are looking for.

2 Likes