Hello,
I could please use a sanity check on how to best approach utilizing VFX Graph in a performant way for projectiles and hopefully without compromising authoring workflow. I’m still learning the ropes on VFX Graph and understanding GPU performance.
My game is a tower defense with a worst case scenario of ~400 active projectiles at any given moment. They are currently setup as pooled game objects with homing behavior which is processed and applied by an IJobParallelForTransform
. Each has some combination of Shuriken particle systems attached for their visuals, and there are different types (visuals) of projectiles.
I’d like to transition over to VFX Graph since I find the workflow more expressive and powerful, and hopefully get some performance gains along the way since Shuriken particle system processing currently eats a decent amount of CPU frame time on low spec machines.
It is worth noting that I am currently stuck on 2021.3 LTS (VFX Graph 12.1) and upgrading is not an option. If I understand correctly, batching via instancing is only available in 2022+ and I need to try to get all VFX of the same type running through a single system (VisualEffect component) since multiple VisualEffects sharing the same asset won’t be batched.
Given the above, my plan is to have one Visual Effect Asset and Visual Effect component per projectile type and feed projectile position data to the particle system via a graphics buffer. From there I should be able to side-chain multiple outputs in the graph (projectile body, trail, etc) to compose the visuals of each projectile. With this I may also be able to further optimize by replacing projectile game objects with plain data sent through the job system.
So my questions are:
- Will this approach even work as expected/is my understanding accurate?
- Is this a performant approach given the version of tech available to me?
- Any other gotchas I should be aware of?
Thank you