0
$\begingroup$

If I create a (very basic) gradient shader it's applied to the whole object the same way. Even if exists a different material for the small rectangle but same nodes I get the same result:

Same gradient for the whole object

But, is there an automatic way to copy that nodes to a new material (in this case the drawer) and get the gradient according to the size of the polygons similar to this image?

I change the gradient for the drawer manually... is it possible automatically?

I had to change the color ramp in the drawer material manually, but if the gradient could adapt to the size of the polygons it would be great.

Thanks!

$\endgroup$
1

2 Answers 2

6
$\begingroup$

You're using generated texture coordinates. Generated texture coordinates are generated by looking at the bounding box of your object (before any deforming modifiers, but after any generative modifiers). They range from 0 at the bottom, left, front of your object to +1 at the top, right, back of your object. Because your drawer has a different bounding box, this means they are different coordinates.

You can revise your existing material to use different coordinates, although this is going to require some other editing. Probably simplest is to make all objects from the material use the object coordinates of the larger cube. However, object coordinates range from -1 to +1 instead of 0 to 1-- or at least, for your purposes they will-- and so you'll probably need to map them a bit:

enter image description here

$\endgroup$
1
  • $\begingroup$ Sorry, Nathan. I didn't specify it's the same object so if I use "Generated" instead "Object" your node tree works for me. Thanks for your help. Anyway there is a simpler node tree I posted below from another post: The problem of another user is my solution XD (thanks to StackExchange algorithm!) $\endgroup$
    – Víctor GV
    Commented Jan 31, 2021 at 7:11
0
$\begingroup$

The problem of another user is also another answer for my problem (thanks, Stackexchange algorithm!) Gradient that depends on an absolute value (several objects)

$\endgroup$

You must log in to answer this question.

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