How do I divide a Lerp into several (>2) Lerps

Hello! Material editor question

I’ve been looking at the 3ColorBlend material function. I want to create something similar, but slightly more complex, and I’m struggling a bit with it.

The 3ColorBlend accepts a value. The value is divided into the 0-to-0.5 portion and a 0.5-to-1.0 portion, both of which are converted into separate 0-to-1 values and used for separate Lerps, which are later combined.

Currently, I have recreated this, but using ranges of 0-to-0.75 and 0.75-to-1.0.

I need to accomplish two things:

  1. Add a third range, leaving the ranges something like 0-to-0.35, 0.35-to-0.85, and 0.85-to-1.0.
  2. Parameterize the ‘keys’ for these ranges. That is, in a material instance, I need to ability to change where the range endpoint is from the previous range, and to still divide up the original 0-to-1 value evenly.

https://i.imgur.com/bl3lQfu.png

Original 3ColorBlend Material Function for context:

https://i.imgur.com/PyhD3td.png

May not be what you need but at some point I was working on a circular progress bar with multiple colours and dug this out from an abandoned material:

You can discard the radial bit. It kind of does what you need but not really :expressionless:

Image from Gyazo

Fetch the nodes here:


Afair it was supposed to blend 3 colours but I honestly can’t recall whether it worked the way I wanted it to. Ignore if this turns out to be useless. Perhaps it can push you in the right direction, though…

1 Like