Search Unity

Bug Instancing particle strip broken

Discussion in 'Visual Effect Graph' started by Qriva, May 8, 2023.

  1. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    I did some tests for both particles and trails with instancing enabled and there was no problem so far, but today I decided to create bullet trail and for some reason it does not work. I thought this is related to my pooling system, but when I unticked "allow instancing", then all trails started to work as expected.
    upload_2023-5-8_16-53-30.png
    When instancing is enabled then only one trail is rendered, sometimes:
    GIF 08.05.2023 16-43-41.gif

    Also, additional question - is there really no way to enforce all trails/particles to be rendered at once?
    I mean, if I know there is no problem with sorting, particles are additive or specific order is introduced, then rendering with depth sorting could be skipped. Well, actually I had no chance to profile GPU side, so that might be not a problem, but it in any case it would be great to somehow reduce CPU cost, because currently it seems to run super slow.
    Example based on my projectiles: there are around 200 bullets and each of them has vfx instance to generate trail. Currently to update VFX of those trails (only) it requires more than 5ms.
    upload_2023-5-8_17-19-54.png
    Obviously I could create some global manager and render all trails with single system, but it is way easier to just drop vfx into some prefab, than create complex system for various types of trails of whatever else.
     
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Hi. Given your profiler capture, VFX don't seem to be batched here. There seems to be 282 batches there (resulting in a very heavy ProcessCommandList). So this seems strange and possibly a bug if instancing is enabled in the VFX asset.
     
  3. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    Aww, sorry for confusion, I guess the profiler screenshot was made with instancing disabled as I tried again and this is how it looks like:
    upload_2023-5-9_14-1-8.png
    However, even if those numbers represent actual performence, currently it renders only 1 trail, so it simply does not work.

    The good thing is I found what caused the bug, it is caused by Spawn Over Distance block, as I tried potato workaround like this and it renders more than 1 trail:

    upload_2023-5-9_14-11-39.png

    I assume spawn over distance breaks batching as it runs on CPU or something related that.