6
$\begingroup$

I have a curve, which has been made visible by using a circle as a bevel object. I would like the color to change along the length of the curve. In other words, the curve will start red, and then change to blue towards the end.

I have figured out how to make the color change as a function of a coordinate (in this case the x-coordinate), but I cannot figure out how to get the coordinate along the length of the curve so that I can pass it to the ColorRamp.

enter image description here

enter image description here

Any ideas?

$\endgroup$
9
$\begingroup$

The trick is to enable UV mapping on the curve and then use UV as the input texture coordinate. Then use can use the mapping node to rotate the default UV positioning to get the gradient to run along the length of the curve. Please note I had to adjust the X/Y scale factor to get the whole gradient to show on the curve.

enter image description here enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Yes, this seems to work! Thank you! (and nice animation!). To be specific, UV mapping is enabled via clicking the "Use UV Mapping" in the "Texture Space" section of the "Curve/Data" tab. In the Mapping node, I found that I could leave the "Rotation" at zero for x,y,z. Also, I just used the "X-scale" and left the others at zero. Using the y-scale caused the colors to look strange. Thanks again for your help! $\endgroup$ – DanHickstein Apr 26 '16 at 20:51
  • $\begingroup$ Thanks, I was so long looking for this :-D how did you come to those degree values? Sometimes it´s hard to figure out the right ones especially on tiny geometry ... $\endgroup$ – Kristo Mar 5 '18 at 19:44

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.