Search Unity

Performance impact of VFX that reacts to player position

Discussion in 'Visual Effect Graph' started by Thorce, Mar 10, 2021.

  1. Thorce

    Thorce

    Joined:
    Jul 3, 2019
    Posts:
    41
    Hey!
    I'm kinda dabbling in player reactive VFX and shaders. Currently I let most of my VFX's react to the players position. I do this by using VisualEffect.SetVector3() every update to inform the effect about the players position.
    I'm kinda wondering though, how much of an impact this has on performance since sending stuff to the graphics card (where the particles live) is known to be quite costly.
    Any ideas? Is it reasonable to do this like I do?
     
  2. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    284
    Keep in mind that:
    - the engine talks with the GPU a lot each frame anyway, a few vector3s here and there won't make a noticable difference
    - talking to the GPU is expensive in terms of latency, but in this case you're just setting some values that will get taken into account some time later, so latency isn't a concern

    Overall, it should be fine! This is how VFX/shaders are supposed to be used. If you want to be sure in your specific case (depending on hardware, VFX count, etc), you should measure the impact yourself. You can comment out the code that updates the parameters and measure the difference, but I doubt you'll notice much.