Community
Arnold for Cinema 4D Forum
Rendering with Arnold in CINEMA 4D using the C4DtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

coloring splines according to their length

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
387 Views, 7 Replies

coloring splines according to their length

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) ?

Labels (4)
7 REPLIES 7
Message 2 of 8
peter.horvath6V6K3
in reply to: Anonymous

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

Message 3 of 8
Anonymous
in reply to: Anonymous

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 😉 )

Message 4 of 8
peter.horvath6V6K3
in reply to: Anonymous

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.
Message 5 of 8
lee_griggs
in reply to: Anonymous

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
Message 6 of 8
Anonymous
in reply to: Anonymous

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 😉 !

Message 7 of 8
lee_griggs
in reply to: Anonymous

v_coords may work better.


1632301985916.png

Lee Griggs
Arnold rendering specialist
AUTODESK
Message 8 of 8
Anonymous
in reply to: lee_griggs

sounds great ! thanks !

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums