I’m not familiar with how lens flares work, but is it possible to calculate the range of the flare distances? A minimum and maximum distance from the camera, then you could convert that into a float between 0 and 1 that you could simply plug into the modulate.
It was just a sprite, and I was using distance_to to the camera2d.
It looks like you want to map a number in one range to a number in a different range. That’s exactly what range_lerp does. For the above example, something like the below should do what you want…
Basically, this maps a number in the range of 10 to 100 to a number in the range of 1 to 0.1
Using your above Distance variable, this should map to the correct output value.
var mappedVal = range_lerp(Distance, 10, 100, 1, .1)