Hello people,
I’m on Unity 2022.3.16f1 using ECS and a single graph with multiple systems that handles every vfx in my scene. As always, I start by creating a standalone test graph with the new effect I want to implement, then when it’s ready, I merge it’s systems directly or as a subgraph in my main. I have quite a lof of vfx running each frames.
So, first question : Does the subgraphs have the same performances overhead as several “standalone” graphs ? Is my choice to go the single graph for every vfx way overkill ?
While working on a standalone test graph, I realized that the standalone and the main graphs are taking quite a lot of gpu usage in editor even when no vfx runs. I only have these 2 graphs right now.
I spent quite some time googling around but haven’t found much about that, I hope I did my searches right.
So I was working on some “mecanic” trails for 10k enemies and pushed the strip capacity to 500k to see how it looked (I started from the builtin Simple Head And Trail system). In play mode, it was using around 40, 45% stable of my gpu. When stopping play mode and looking at some other stuff, I noticed my gpu was going full blast at 100% in the task manager. But only when the window focus was on Unity, it happens both in the game view and the scene view, I don’t have both opened at the same time.
Disabling the visual effect graph layer visibility in the editor view doesn’t change anything. Manually stopping them with the vfx control box either. I added an event to manually play and stop them, no improvements. Updating to latest LTS (2022.3.19f1) didn’t changed anything either.
The only thing that allows the gpu to calm down is by disabling the gameobjects containing my graphs, it goes straight to 0, 1% then.
My main graph is taking around 30, 40% constantly by itself when the other graph is disabled.
For the standalone graph, I also noticed that the gpu usage in editor is directly correlated with the strip capacity setting. If I set it to 250k, it was chewing around 50% of the gpu, at 40k = around 15% and so on.
I also noticed a correlated huge bump in my tris count. I was around 500k tris before working on this graph, then was at 21M in editor with no vfx running/spawned and strip capacity set at 500k.
So, second question : Does this tris count means that all the strip trails are rendered all the time even when not spawned/running ?
I lowered strip capacity numbers to decent ones (10k) and it’s better, but it still eats some gpu usage when it shouldn’t as far as I understand how vfx graphs work.
And something else helped but I can’t understand why. Here’s how the two graphs were set in my hierarchy :
So it was on the parent gameobject of my main vfx graph. I set it there just out of lazyness for quick testing.
I then moved the standalone test graph to another gameobject like this :
This didn’t fixed anything at first, but after launching the play mode and tinkering with the strip capacity setting again, it seems that the problem just, disappeared ? It looks fixed in the scene view when the visual effect graph layer visibility is disabled. I’m now running at 1% gpu usage in editor even with strip capacity set to 500k with the vfx running and it’s visibility layer off.
The issue still happens in the gameview when the game isn’t running and it also still happens on my main graph in scene and game view no matter the visibility setting. I also tried moving my main graph to another gameobject but no luck. Am I missing something about how vfx graphs work in editor ?
Here’s how the standalone graph system look. There’s 3 of this system in this graph with only the “Add” node for the position changed a bit so my enemies can have 3 mecanic tentacules following their movements.
And for those wondering, here’s how it looks, heavily matrix inspired obviously :
Thanks for reading me. Please enlight me with your wisdom kind people
edit 1 :
Ok I see that the scene view is getting updated unnecessarily even when nothing runs in the vfx graph. Here’s the profiler gpu usage when I activate the gameobject containing my main graph. Each systems in this vfx graph is triggered by a specific event in my code, so it shouldn’t run at all in editor.
And here’s the systems in my main vfx graph :
The view is cutted on the picture below but I just have 16 of the same system that takes care of the explosions. So I can have max 16 explosions happening in a single frame.