Download

Linear color gradient?

I have an instanced material with a color input parameter that needs to vary according to my current “stamina” variable.
The color will vary from white, to yellow, to red.

At first, I thought I would make a linear color gradient in the material blueprint…but apparently these linear gradients cannot have adjustable control points.

My second attempt was to create the color gradient in photoshop, save it as a texture, and then in the material use a texture sampler to read the color value from the texture, with UV coordinate being an input parameter…but that didn’t work either.

It’s possible to create a linear color gradient as a color track in a timeline, but since I don’t want it to be driven by time, that doesn’t really help me.

Any ideas people? This seems like it should be really simple…

EDIT: I managed to hack together a rather ugly but working solution that does it using Lerp.

2ace9d200f8538ebbe54f47ed5cec49c94b1f0b1.jpeg