Do lights trigger culled draw calls?

Godot Version

v4.6.2-stable

Question

Hi everyone, I’m working on a project and realized that for some reason when I interact with lights they trigger draw calls even if the object is hidden/culled. Is that normal behavior and is there way to improve on this?

Let me try to give you more context from the following example scene:

I have this very simple scene with a black world environment, a few lights attached to a mesh, some walls, a floor and a ceiling. From the editor info we can already see that I should be getting around 20 objects, but I am getting 108 from the monitors tab.

I have strategically placed a camera in a corner to test culling, and indeed it does cull but only when I manually hide the mesh instances (the dips you see in the graph).

From some research I have read online that lights trigger 4 draw calls (not sure if this is accurate or not), could that be the reason? Is there anything I can do to cull these draw calls for hidden objects?

What I am trying to achieve is to have as little draw calls as possible since I have many dynamic lights in my scene and will be interacting with them quite frequently - so I want only the strictly necessary draw calls to happen and would like to avoid draw calls for objects that are culled behind an obstacle.

Meshes don’t occlusion-cull anything themselves. Engine doesn’t see them as “obstacles”. If you need that, you’ll have to enable occlusion culling and add some occlusion instance nodes to the scene.

Yes I know, thanks for mentioning! I forgot to include this detail in the OP. I have culling enabled and my obstacles all have an occluder mesh baked appropriately

The those draw calls are probably from drawing objects into the shadow atlas. You can optimize that by minimizing positional light ranges, disabling shadow casting for anything that doesn’t really need it or lower the number of active lights that get drawn into the atlas in project settings.

That said, you shouldn’t worry about draw call optimization if your frame rate is satisfactory.

Thanks a lot that is insightful :slight_smile:

Would you say that disabling shadows on culled objects when they are not on the screen (ie using a visible notifier node) is a bad idea? Does it give more of a disadvantage than an advantage because you need to compute it on and off each time you trigger the call?

So why is draw call important if it is not directly linked to fps?

Yes, It may actually not be the best idea as you’d potentially need to do additional processing. The most reliable way to determine that is to run the built-in profiler and measure the actual performance on your target hardware in both cases.

It does affect fps although typically not in a linear or even easily predictable fashion. Don’t succumb to premature optimization though. If it doesn’t create any significant performance bottlenecks, there’s no need to worry about it.