How to gradually change color of a material over time

I have a trail object, I would like that the color of the trail gradually changed over time, is this possible? and if so, how? thank you :slight_smile:

I thought maybe a simple way would be to do this:
sourceMat.emissiveColor = new Color3(tc1,tc2,tc3);

and then change tc1, tc2 and tc3 over time

and yes this works, but not sure if changing so often in an observable this property is bad for performance, I wonder if this is a good way or there are better ways

the other issue is that this seems to change the color of the entire trail, but what if i want the color to change only on the new part of the trail, not the old one mmm maybe thats not possible

alternatively is there a way to apply some kind of edge to the trail? its just that my path many times crosses itself sometimes and you cannot distinguish the path well, so i need to separate the different tracks from each other

For performance sake, just change sourceMat.emissiveColor.r/g/b instead of recreating a new Color3 each time.

You canโ€™t change only some parts of the trail and not some others, the material applies on the mesh globally, so on the whole trail.

No possibility to apply some specific effect on the edge neither in the current implementation. You could try to create a specific shader, though.

1 Like