Skip to content

"Visible Collision Shapes" debug option has an important performance regression since Godot 4.4 #105248

@diegopau

Description

@diegopau

Tested versions

Tested in 4.4.1.stable. There is a clear performance regression (and almost surely the same for 4.4.stable)

It was working fine in 4.3.stable.

System information

Windows 10 pro 22H2 - Godot 4.4.1.stable - Forward+ - dedicated AMD Radeon RX 6700 XT

Issue description

My blocky/voxel based game can render tens of thousands of collision shapes when enabling "Visible Collision Shapes".

As soon as I tried to upgrade from 4.3 to 4.4 I noticed that the performance with "Visible Collision Shapes" (essential at least in my case to debug stuff) was running the game at very low speeds, so much that I couldn't test my game properly anymore and I rolled back to 4.3 and I stayed there for a while since I was convinced that the problem was that the new debug fill takes a toll in performance and it wasn't straight forward to disable debug_fill for all my collision shapes (it is enabled by default). I opened a proposal for ignoring the debug_fill property globally for those that have games in which it causes trouble godotengine/godot-proposals#11913

Now, with 4.4.1 I decided to give it a try again. I made sure that all the collisionshape3D nodes have no debug_fill enabled and I tested. It wasn't as bad as before (with the new debug_fill enabled) but I still noticed about half of the FPS when compared with 4.3. I also checked that when "Visible Collision Shapes" is not enabled then the performance is actually a bit higher in 4.4.1 so the issue is definitely with rendering the "Visible Collision Shapes" when testing.

I provide a very simple MRP that makes the issue obvious I think. In my computer, in equal conditions, with the 15000 collisions rendered by the script, there is an almost exact halving of the performance in Godot 4.4.1. 15000 collisions might sound like a crazy number but I actually use it (and need it unless I find a better way) in the game that I am developing and Godot moves it with no issues at 400+ FPS (when "Visible Collision Shapes" is off) so this is a real scenario, at least for me.

Image

Steps to reproduce

Download both these files and unzip them:
collisions performance MRP-4_3.zip
collisions performance MRP-4_4_1.zip

  1. Open collisions performance MRP-4_3 project with the Godot 4.3 binary. Enable Debug->Visible Collision Shapes
  2. Open collisions performance MRP-4_4_1 project with the Godot 4.4.1 binary. Enable Debug->Visible Collision Shapes (and also ideally disable "Embed Game on Next Play" from the "Game" tab, that's just so it is easier to do a side by side comparision.
  3. Now with both Godot projects open run each of them and place each window side by side so you have the exact same view, resolution, etc.
  4. Make sure not to have any of the 2 windows active (click any other window of your computer) because at least Windows will prioritize more the active window and maybe give more GPU / CPU resources to it.

The script already takes care of disabling "debug fill" property for all the collision shapes in the 4.4.1 project so the conditions are the same as in the 4.3 project.
There are basic camera controls in the MRP but by default the mouse is not captured so the camera is in a fix position so it is easy to compare both projects.

Minimal reproduction project (MRP)

collisions performance MRP-4_4_1.zip
collisions performance MRP-4_3.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions