Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Any way to skip over "Update Particle" for the first frame of a particle?

Discussion in 'Visual Effect Graph' started by dgoyette, Jul 1, 2020.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    I've been using a "Simple Heads and Trails" system to render some jagged lines. What I've found is that the "trails" that get rendered don't start at the (0,0,0) position. Instead, they "start" at wherever the particle ends up at the end of the first frame. For example, here's the effect of a bunch of lines coming out of the point marked in red:

    upload_2020-6-30_22-8-16.png

    I believe the reason for this behavior is that everything in Update Particle is running before the position information is passed to the trail renderer. So, even on the first frame of a particle's life, it's being moved by the Update Particle section, and the trail renderer use that modified position as the initial position.

    I was wondering if anyway knew of a way to improve this? Ideally I could skip calling Update Particle on the first frame of a particle's existence, so that for the first frame, it starts in its Start position, not in its modified position.
     
  2. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    This might work:
    - set velocity to zero on Init
    - in update check for age > 0, and only set velocity when that is true
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    Good idea. I'll give that a try, though it's a bit obnoxious, given that I have various nodes that affect the position of the particle. They'll probably all need the same kind of treatment.

    I did see about whether I could use "oldPosition" instead of "position" for the trail rendering portion, but it seems like oldPosition isn't really a proper node? It has a tooltip that indicates it's not being used currently?
     
  4. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    Maybe you could hijack it for your needs? https://forum.unity.com/threads/vfx...-drag-effect-with-clouds.601195/#post-4020118