godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.09k stars 21.18k forks source link

Collisions between a simple convex collision shape and a CharacterBody3D decrease FPS #59738

Open fazil47 opened 2 years ago

fazil47 commented 2 years ago

Godot version

v4.0.alpha.custom_build [b0df742cb]

System information

Windows 11, Vulkan Clustered, Nvidia 1650

Issue description

When a CharacterBody3D moves over a simple convex collision shape the FPS dips a lot. The second platform in the video has box colliders instead. This bug isn't present in alpha 5.

https://user-images.githubusercontent.com/18116695/161069866-9e1e78b1-d102-40e7-8bdc-5423ee289d8e.mp4

Steps to reproduce

Minimal reproduction project

single_convex_slowdown.zip

Assets are from the Kaykit mini game variety pack.

Calinou commented 2 years ago

This bug isn't present in alpha 5.

Commits between alpha5 and the commit you listed: https://github.com/godotengine/godot/compare/d7d528c15f0e858b52bb0f510ff47e65c2341de1...b0df742cbe1c81feeb3b5e4a95cecbfabb2fe8f8

Remember that performance comparisons should be done with the same build options (use MinGW and target=release_debug use_lto=yes for editor builds). Otherwise, the comparison will be skewed in favor of official builds which are always compiled with those more optimized settings.

fazil47 commented 2 years ago

Performance is better on a release debug build compiled using MinGW (use_lto=yes takes too much time on my PC so I didn't test that). Still, performance is better even on a trimesh collider (I've updated the minimal reproduction project to include those).

fazil47 commented 2 years ago

This bug is present in alpha 5 as well.

https://user-images.githubusercontent.com/18116695/161278062-52416e76-8cd7-4596-a3c4-3e639ea42276.mp4

Calinou commented 2 years ago

For reference, I checked the convex shapes and they don't appear to be very complex in terms of geometry: image

So we can rule out their geometry being too complex.

akien-mga commented 1 year ago

Seems reproducible in 4.0 RC 5 with the attached MRP, though with my computer I had to disable vsync to see the difference.

On the central platform, I have around 130 FPS, while on the sides I have 500 FPS.

Probably related to #57313.