How to create linear gradient along spline based mesh from start to end?

I’ve got a spline based cable BP that I want to use to show electricity ‘filling’ the spline mesh, end to end, as the BP’s fill percent goes from 0 to 100%.

My question is how to generate a gradient that smoothly travels along the length of the spline? Here’s an example of what I mean by that:

It seems like there should be a way in the blueprint to assign a gradient (as a vertex color?) along the spline but I haven’t been able to find any examples of it working.

So far, this is the closest I’ve been able to get working but it starts and ends the gradient according to each point on the spline and that’s not what I’m after.

Yes, I could convert all the spline meshes to static meshes, export them, paint with a smooth gradient vertex colors then reimport but I’d really prefer to handle this all in a single blueprint, instead.

Appreciate any ideas anyone has. Thanks.

You could calculate the gradient for each segment.

Material:

Blueprint:

Result:

Runtime Spline Editor

2 Likes

This is exactly what I was looking for. Great solution. Thank you so much!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.