There's a limit to how many lights there can be in OpenGL, I think 8. But sometimes 8 lights isn't enough, like a room full of torches or a street full of lights. Is there some way to get past the 8 light limit, maybe with a shader? How would I optimize it for many lights(dozens)?
Yeah, I think it is 8 lights per object (not necessarily 8 lights total). There will be much more in Godot 4.0. https://godotengine.org/article/vulkan-progress-report-2
Ideally you could bake some of these lights, but I found that lightmapping in Godot had some problems that made it not ideal for my use case. But you can try it and see if the results are okay for you.
8 lights per object... Does that mean I can have more than 8 lights, but a mesh only reacts to the 8 nearest lights?
Also, your link said 256 lights on screen is the limit; but that's 2D. Is it the same for 3D?
To be honest, I haven't really tried it. Not sure if it will automatically detect the 8 nearest lights, but you can test it and/or write code to toggle the lights on and off. I did see some other people try and I think there were some flickering issues but I didn't look into it that far.
Okay, thanks for your help. I would accept an answer, but it seems this is a discussion and not a question.
@Dschoonmaker said: Okay, thanks for your help. I would accept an answer, but it seems this is a discussion and not a question.
I changed the discussion to a question, so you can now mark any post(s) as the answer :smile:
Godot 4.0 will remove the number of 3D lights restriction when using the Vulkan renderer, as it uses clustered forward rendering instead of traditional forward rendering. Larger amounts of lights will also perform significantly better.