PointLight2D performance and optimization

Godot Version

4.5.2 stable

Question

Are PointLight2D really that expensive regarding performance? I am currently optimizing my space project and used PointLight2D a lot for aesthetics. During pinpointing areas of performance improvements, I found out how taxing those lights are overall.

I am going to replace them with simple textures and an additive material, as this is enough for my current needs. But I would still appreciate some help understanding some quirks of the performance costs and the overall use of those lights in that… light.

In my case: i loose 30fps (from 115fps baseline) the moment I instance an object with a PointLight2D in it. The second and third instance take away 10 fps each and after that the cost drops to just about 2-3 frames per additional light. I have no shadow casting. I just use them to add some glow or volumetric.

If they are indeed that expensive: do people actually use them? And if you have an practical example, would you share that? Or are there some tricks to optimize those lights?

What’s “volumetric”?

Visible light beams. I use PointLight2D and use an prepared mask as a texture, to set the shape of the visible light. God rays, for example.

Visual profile the project to see where the time is spent exactly.
The performance would depend on texture sizes and if you don’t need actual lighting features (normal mapping, shadows) use additive sprites instead.

That is exactly what I am doing to replace all lights right now, jep :slight_smile:

I am still wondering if this cost is worth it for normal mapping and shadows for example.

You can’t get those things otherwise so it’s worth it if you need them.

No hidden tricks? No workarounds that mitigate the cost a bit? No pro tricks?

Using sprites is the pro trick :smile:

2 Likes

That makes me feel accomplished. You get a solution for that :smiley:

1 Like

LOL :smiley:

1 Like