1
$\begingroup$

I am trying to colour curves of different lengths according to their length (ie short curves red, long curves blue). Here is my best attempt but it's really not what I am trying for. I need one solid colour per curve that denotes its length. (ie the length of the path if it were straightened out)

Paths

And here are the nodes for setting up my attempt.

enter image description here

I've searched extensively and have found a number of somewhat similar questions but mostly focused on scaling colour based on position. I expect there is an easy solution to this and I am just not using the right terminology in my searches.

$\endgroup$
3
$\begingroup$

Animation nodes can measure the length of a curve. The length can be passed to a shader node and used to set the color. The image below shows an animation where the curve color changes with the increase in length of the curve.

enter image description here

Details for Blender 2.93.4 + Animation Nodes 2.2

  1. Download and install Animation Nodes 2.2 - see Animation Node Website
  2. Add a curve to the scene
  3. Create an animation nodes diagram like below. This node network will measure the curve length and assign a color to the viewport color. The viewport color will be used to get the color information to the shader. enter image description here
  4. Create a shader node like the one shown below for the curves. The color information from animation nodes color output is brought in through the 'Object Info' (viewport) color port. enter image description here
  5. Now as the curve is edited or modified, animation nodes will recalculate the curve length and update the color.

An example file for Blender 2.93.4 and Animation Nodes 2.2 is located here -

$\endgroup$
1
  • $\begingroup$ This works well for a single curve! Less trivial for applying the mapping across multiple curves (I have ~1500) since the animation node set relies on the input and length of an individual curve. $\endgroup$
    – cksalmo
    Oct 23 at 22:33

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.