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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question VFX and Single Burst Spawning Millions of Verts

Discussion in 'Visual Effect Graph' started by Duckocide, Jul 7, 2023.

  1. Duckocide

    Duckocide

    Joined:
    Aug 30, 2014
    Posts:
    35
    I have a question for those more practiced than me at using VFX Graph. I've spent time studying the docs(!) but I'm failing to understand why a single burst spawn context still creates millions and millions of verts.

    I'm using VFX graph to render the graphics. Observe the first picture, the cage "tunnels" are VFX graph URP mesh rendered using pseudo random functions and Line A/B particle position initialisation. Basically I can draw lines of these procedurally generated tunnels. All very pretty and minimal core thread hit :) But...

    vfx-graph-particles-as-objects.jpg

    ..I've tried to limit the number of particles (and I thought by implication) verts per tunnel line. So, only a set number based on spacing are initialised. But, try as I might, I can't seem to influence the massive number of verts generated (see stats).

    The "Particle Count by Spacing" sub graph calculates the number of sections (particles) needed for various parts of the tunnel...

    vfx-graph-millions-of-verts-spawned.jpg

    ...Am I missing something bleeding obvious or does the spawn system throw in millions and millions of verts in to the GPU whether you like it or not? I can understand it being a multiple of the mesh vert counts but the millions are way in excess of even the most generous calculations. Obviously I'm worried about performance and adding more of these VFX based game elements. :(

    The meshes used in the VFX Graph (An appreciable but not too generous number of verts in each mesh)

    vfx-graph-meshes.jpg
     
    Last edited: Jul 7, 2023
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    It should spawn the provided number of particles.
    First of all I am not 100% sure that small window actually shows correct numbers, probably it does, but some time ago number of batches and some other stuff was incorrect.
    Second - try frame debugger and check how many particles are rendered on your scene and how many verts are there. If you think there are way more vertices than it should be, it would mean you spawn incorrect number of particles (Particle Count by Spacing returns wrong count). It should be very easy to see if you render things multiple times.

    Also perhpas your setup is wrong, or you trigger your system multiple times from code.
    Apart of frame debugger you can select the system and activate debug mode to see number of particles alive.
    upload_2023-7-8_13-59-5.png
     
  3. Duckocide

    Duckocide

    Joined:
    Aug 30, 2014
    Posts:
    35
    Thanks, I'll give that a go!
     
  4. Duckocide

    Duckocide

    Joined:
    Aug 30, 2014
    Posts:
    35
    Well, I think my code and particle counts are within what I expect. Certainly I'm not seeing any extra particles in there. I'm beginning to think the "stats" window in Game window should be ignored for VFX. I really can't understand why so many verts / tris need to be created unless it's just a cache the VFX code picks from from an efficiency point of view? I'm not seeing this sort of count in the scene.
    vfx-graph-debug.jpg

    vfx-graph-stats.jpg
     
  5. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    Well, I don't know what is your vertex count for models, you need to check in blender, but if particle count seems reasonable then I would move to frame debugger.
    Also you can try empty scene only with this system and check the count.