coloring splines according to their length

coloring splines according to their length

Anonymous
Not applicable
1,164 Views
7 Replies
Message 1 of 8

coloring splines according to their length

Anonymous
Not applicable

Hi there ! I got a Xparticles simple setup that generates a bunch of trails/splines and I wanted to know it was possible to export le splines/trails length to the arnold material in order to color each trails according to its length (ie using a gradient) ?

0 Likes
Accepted solutions (1)
1,165 Views
7 Replies
Replies (7)
Message 2 of 8

peter.horvath6V6K3
Advisor
Advisor

Sorry for the late reply. Use a state_float shader with the v variable.

0 Likes
Message 3 of 8

Anonymous
Not applicable

Hi ! thanks Peter for the answer ! this method to add gradient to splines works perfectly, so I'll keep it in mind 😉

however I didn't express my self clearly, I'm looking for a method to color each splines uniformly (not a ramp mapped along each ones) with one color picked from a gradient according to the length of each one

ie : I create a ramp from yellow to red and I want the shortest splines to be yellow and as they get longer they get closer to red (but one color per splines, not the gradient mapped over it)

is this possible with arnold (it's possible with cycle 4d but I prefer to keep everything in arnold 😉 )

0 Likes
Message 4 of 8

peter.horvath6V6K3
Advisor
Advisor
Gotcha. Don't think it's possible in the current build, but this would be a nice addition for a future release. Having a flag to export the length of each splines as a user data.
0 Likes
Message 5 of 8

lee_griggs
Autodesk
Autodesk
Accepted solution

You might get something out of the color_mode in the utility shader. Maybe v_coord, barycentric and Object ID in combination with a color_correct to fine-tune it.


Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 6 of 8

Anonymous
Not applicable

Hi ! thanks for your answers ! i'll try that this afternoon !

about user data i was close to solution with xpresso (the spline node is actually able to compute a spline length, unfortunately if you give a flock of trails, which are considered segments of the same spline, you can only output one length at a time with a provided segment index, I didn't manage to export a matrix of indexed length)

anyway i'll play around with lee griggs suggestions 😉 !

0 Likes
Message 7 of 8

lee_griggs
Autodesk
Autodesk

v_coords may work better.


1632301985916.png

Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 8 of 8

Anonymous
Not applicable
sounds great ! thanks !
0 Likes