-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPU particles expensive when ACTIVE = false #92764
Comments
Since this value can only be known by running the shader, and all the data needed has to be fetched, I don't think this is a bug With any reasonable use of Much like a shader that uses I don't think the shader compiler should "optimize" this code to work better as it's not a valid shader really, what would be the use case? |
I used the ACTIVE built-in to cull certain particles for a grass system like the one devmar on youtube made. Maybe this isn't the right use case for particles, and I should change to multimeshes instead. Anyway, while I was testing this I noticed the performance was fairly low (because I though I was 'culling' the particles). If its not possible to stop entire particles from being rendered like this, we shouldn't spend more time on this. (But I think the docs need to say what making an particle inactive actually does.) |
Then that use case is far more relevant, but your real world example shows why it takes performance:
So I'd say that you should instead use other means to accomplish that if you need a lot of culling Now the specifics with the rendering stuff might be a bug but I'm not sure that the statistics you're seeing are from after the active check is done, but might be when preparing the particle data to feed to them So that would need investigation, but it might just be that the processing you see is the steps prior to active is checked and dropped What is the performance difference between having the active or not? Is it just marginal or is it significant? Because if it's significant I suspect it's the earlier stages (I can't test your MRP at the moment but some statistics from your testing would be helpful |
Some performance numbers (during runtime) scene is MRP. Hipoly is torus with 1024 rings.
Observations
I think point 4 is really interesting, why does adding discard to just the fragment shader result in better performance than disabling the particles? |
Because |
Tested versions
System information
Godot v4.3.beta1 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 32.0.15.5599) - Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 Threads)
Issue description
When a particle is set to inactive in the particle shader, it isn't rendered visible on screen, but it still has an impact on the rendering performance. Particle systems with high poly meshes and with all particles being inactive still increase the 'Render Depth Prepass' and 'Render Opaque Pass' a lot. On such a particle system, adding discard; to the start op the fragment shader improves performance, suggesting that the fragment shader is running. Another indication is that changing the amount of polygons in the mesh has an impact on performance, for example lowering the 'rings' count on the TorusMesh increases the performance.
To me it seems like inactive particles shouldn't have a rendering cost (or at least really low), as they aren't being rendered.
(Issue is related to #19507 and #92599)
Steps to reproduce
Minimal reproduction project (MRP)
Very simple scene with fps counter and vsync disabled. The ACTIVE = false; is commented out by default.
Warning the scene has 12 million primitives. Open in 4.3 beta 1.
Gpu_particles.zip
The text was updated successfully, but these errors were encountered: