Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Big performance spike when first rendering VFXs

Discussion in '2020.2 Beta' started by FOXAcemond, Nov 28, 2020.

  1. FOXAcemond

    FOXAcemond

    Joined:
    Jan 23, 2015
    Posts:
    99
    Hello,

    For some reason I'm experiencing a big lag (~1/2 sec, up to 4 sec if debugging) when my VFX Graphs show for the first time in-game.
    This is pretty weird and only happens the first time they are (seemingly) loaded into memory (I'm guessing GPU's). I'm saying that because it doesn't happen if I unload the scene and reload it again, only if I reboot the game (or editor).

    Is anybody else experiencing this issue?

    The graph is not particularly complicated, 11 nodes at most, much like the falling leaves VFX in the sample project in terms of complexity. And it only appears 3/4 times on screen. They are already present in the scene, nothing fancy just set to
    .enabled = false
    and then
    .enabled = true
    when they should start. I tried to change the culling flags but it didn't change this issue, the lag spike just didn't happen at the same moment, but would still occur.

    Profiler for first render of the VFX: View attachment 734771
    Same run, second render of the VFX: View attachment 734774

    I'm using 2020.2.0b13 and HDRP 10.2
     
    Last edited: Nov 28, 2020
  2. FOXAcemond

    FOXAcemond

    Joined:
    Jan 23, 2015
    Posts:
    99
    My ugly solution for now is to actually play the VFX with opacity 0 and activate it by changing it to 1. That way, the spike occurs at the very start and not in the middle of the gameplay session...

    I tried changing the culling flags of the VFX, that did improve the issue quite a bit for VFX next to the starting point. Not for the ones that are further away (I guess culling is still applied even with the flag: "always compute bounds and simulate").
     
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,111
    Hi @FOXAcemond,

    If you're still affected by these issues, it would be great if you could submit a bug report with a reproduction project attached.
     
  4. FOXAcemond

    FOXAcemond

    Joined:
    Jan 23, 2015
    Posts:
    99
    Hello @LeonhardP

    I later found out this problem disappears completely when I switched back to DirectX 11.
    I'm currently planning in creating a reproducible for this issue. Have a lot on my plate for the end year.
     
  5. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,111
    Thank you, that would be much appreciated!