Search Unity

VFX Graph - spawning particles from particles

Discussion in 'Graphics Experimental Previews' started by whidzee, Jan 17, 2019.

  1. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    90
    I'm playing around with the new VFX graph and I am unable to work out how to get particles to spawn from particles.

    two scenarios I am wanting to tinker with, simple one would be fireworks. so i could fire some particles up into the sky and then spawn a bunch of new particles from them.

    and clouds. I have a nice little cloud setup which makes a happy little cloud, but I'd like to have my clouds spawn across the sky. I was thinking it would be reasonable to have a bunch of particles spawn across the sky and from each of them get my puffy clouds to appear.

    How can I go about doing this? what node or connection am I missing?

    Also, when setting the spawn position of my cloud particles I am using a position(Sphere) node. It allows me to control how much of the sphere the particles will spawn in using the Arc (Angle) This is handy, however there are no controls that I can find for the rotation of the sphere so you can control which parts of the sphere you want particles. The arc angle starts at the bottom and as you slide it back it goes up the side so you can have a hemisphere with the left side as flat. however you can not change that to have the bottom flat. You need to rotate your particle emitter in the scene to get this. I feel there should be a sphere rotation option or something like that connected to the Arc(Angle) option to allow for more control in this
     
    Last edited: Jan 17, 2019
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    84
    We have GPU Events to do what you want. Basically GPU Events can be sent from on system to another to spawn particles.

    gpuevent.png

    Here (not a working vfx, just with relevant blocks), first system will trigger an event each time a particle dies (Trigger Event on Die block) and broadcast it to another system that will spawn n particle per event (here count is set to 1). any source particle attributes can then be used in child system via inherit source "attribute" block or by directly using the get source attribute node.

    To use GPU events, you have to enable experimental feature in settings/vfx. This is experimental because the UX will likely change in the future and there are some known bugs too.

    About rotation in position on sphere block (or other primitives), we have plans to improve it and add a way to specify the rotation.
     

    Attached Files:

    antonsem likes this.
  3. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    90
    Hey Julien, Thanks for this. However I cannot find any trigger blocks to add to my update node. Also I can't find the GPU event node either. There is an Event node, but not a GPU Event.
     
  4. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    90
    Ah I found this, in case anyone finds their way here.

    I needed to enable Experimenal Operators/Blocks in the Edit - Preferences menu
     
    hallidev likes this.
  5. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    102
    Is there some other trick to "enable" the GPU event? I've gotten all the blocks in my graph like in the diagram, but can't find any combination to make the secondary particles spawn, or spawn in a visible way, to be precise. Adding a spawn block throws an error, probably because the GPU event itself is a spawn block. But there's some setting somewhere I'm missing to get this to work. Maybe there's a setting in the HDRP profile???
     
  6. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    102
    This seems more like a hack than a fix, but if you inspect the Quad Output block for the secondary system, in the inspector window there's a Particle Options > Sort Toggle where the default is set to "Auto". I turned that to "Off" for the Output of the secondary particles and they appeared

    Also, now that I can see GPU event particles, it looks like there are many that spawn where the parent particles are spawned rather than where those parents die. Or more likely, some of the parent particles are dead at birth. Whatever the cause, it's unwanted behavior.

    And finally, the more you fidget with the system, the more unstable it gets. It feels like the code generation can get into unstable states where subsequent changes are conflicting or ignored. To repro, set up a GPU event on death system and then toggle off the random lifetime block in the parent system, and hit Compile a couple of times and see what happens. Nothing good.Sometimes deleting the gameobject in the scene with the open VEG cleans this up. Sometimes that doesn't work, but restarting the editor helps restore intended graph behavior
     
    Last edited: Feb 2, 2019
  7. sergiobd

    sergiobd

    Joined:
    May 14, 2014
    Posts:
    19
    Same problem as Livealot here. The particles are never spawned....