godotengine / godotengine/godot
GPU Particles renders even when is_visible_in_tree() is false
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.2.2
### System information
Linux Mint 21.3
### Issue description
When creating a test scene with a lot of particle effects, which were NOT being emitted, I noticed my frame rate dropped tremendously. After doing some research online, I saw a 2018 issue in Godot issues where this same issue came up (but for CPU Particles). When looking at the source code, I noticed "is_visible_in_tree" was being handled properly in the CPU Particles node type, but GPU Particles doesn't do a check on this. As a result, it's trying to process a ton of particle emitters that aren't actively emitting when they're not in view of the cameras.
### Steps to reproduce
Create a scene with a lot of GPU particles, all hiding behind a wall or something, and disable emitting. Then open the scene and watch the frame rate drop.
Change them to CPU Particles instead with the same settings, and notice things flow perfectly fine when they're behind the wall.
### Minimal reproduction project (MRP)
don't really have the time to do this at the moment, but can make something small if it's really required for this.
Contributor guide
Research direction
Start by reproducing the report with many non-emitting GPU particle nodes hidden behind geometry, then compare the GPU Particles and CPU Particles node implementations mentioned in the issue. Check how visibility is handled during particle processing; done means hidden, non-emitting GPU particles no longer cause the reported frame-rate drop and the existing behavior remains correct for visible particles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100