How can I "emulate" the effect of a light2D without using one nor a shader?

Godot Version



I’m trying to reduce the amount of draw calls from my game as much as possible. Because of that, I am currently replacing a light2D with hard coded color manipulation, without using shaders.
In this case, I am only changing the color of polygons generated by code (which are the stars in the sky).
With the light2D I was making the stars shine, using the “add” mode.

I’ve already hard coded everything else, the only thing missing is getting the color of the polygons looking the same as they did with the light 2D. I don’t know how to achieve it, especially because the polygons have varying colors.

The closest I’ve come was with color.linear_interpolate(Color.white, energy - (dist / radius)). But that makes the polygons, at some point, all look white, losing any color variety they previously had.

What math or function combo would help me achieve a result closest to that of the color resulting from the use of a light2D?

I figured it out.
In case anyone is looking for this, here’s how I did it:

end_color.r = min(col.r + color.r, 1.0)
end_color.g = min(col.g + color.g, 1.0)
end_color.b = min(col.b + color.b, 1.0)
col = col.linear_interpolate(end_color, clamp((1.0 - dist/radius) * energy, min_energy, energy))
def add_blend(base_color, light_color, intensity):
    # Clamp ensures the color value does not exceed 1, which would be invalid
    r = min(base_color.r + light_color.r * intensity, 1.0)
    g = min(base_color.g + light_color.g * intensity, 1.0)
    b = min(base_color.b + light_color.b * intensity, 1.0)
    return Color(r, g, b)

Why not just use alpha?