Light limits

DschoonmakerDschoonmaker Posts: 241Member
in 3D

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)?

Best Answers

  • cyberealitycybereality Posts: 927
    Accepted Answer

    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.

  • cyberealitycybereality Posts: 927
    edited May 31 Accepted Answer

    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.

Answers

  • cyberealitycybereality Posts: 927Moderator
    Accepted Answer

    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.

  • DschoonmakerDschoonmaker Posts: 241Member

    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?

  • cyberealitycybereality Posts: 927Moderator
    edited May 31 Accepted Answer

    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.

  • DschoonmakerDschoonmaker Posts: 241Member

    Okay, thanks for your help. I would accept an answer, but it seems this is a discussion and not a question.

  • TwistedTwiglegTwistedTwigleg Posts: 2,655Admin

    @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:

  • CalinouCalinou Posts: 417Admin Godot Developer
    edited June 2

    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.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file