-
-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Re-computation of AABB every frame in Node3DEditorViewport::_notification is expensive with many nodes #64398
Copy link
Copy link
Open
Description
Godot version
4.0.alpha.custom_build.97c0dd74d
System information
Linux 5.18.14-arch1-1
Issue description
When working with voxel_tools, I noticed very high idle CPU usage whenever a VoxelInstancer, or any child of a VoxelInstancer, is selected in the editor: Zylann/godot_voxel#422
It turns out that the 3D viewport recomputes the AABB of every selected node and all their children every frame. voxel_tools uses StaticBody instances in the instancer, so this means it is recomputing 1000s of AABBs every frame, even if the camera is not moving. It might be that voxel_tools could work around this, but it seems like a lot of work to update AABBs that aren't changing.
godot/editor/plugins/node_3d_editor_plugin.cpp
Line 2498 in f2a6168
| AABB new_aabb = vi ? vi->get_aabb() : _calculate_spatial_bounds(sp); |
Steps to reproduce
- Create a StaticBody
- Add 1000s of CollisionShape children
- Select the StaticBody in the editor
- Note that CPU climbs
- Select a single one of the CollisionShape children
- Note that CPU drop
Minimal reproduction project
Reactions are currently unavailable