Search Unity

Particle lines with two colors

Discussion in 'Visual Effect Graph' started by cAyouMontreal, Oct 14, 2020.

  1. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Hi! I made a system where I spawn particles in circle, and then I created an event to make lines out of the particles.

    I use the target position to set where the end of the line is going, but I would like to set a different color between the base of the line and the end. How do I set that?

    I know I can sample a gradient based on some value, but I can't figure out which value, for example the position won't work (because the particle line itself is always at the base of the line).
    Any idea? thanks!
     
  2. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    154
    Hello !
    There isn't any builtin way to lerp between two color for a classic Line Output, the color is applied at pixel stage (see this if you are curious). Maybe we should consider to extend Shader Graph integration to Unlit Line (and Point) output, we will consider this feature.

    Meanwhile, did you consider to use a particle strip line ? It will automatically interpolate attributes, furtheremore, if you want to create more advanced effect, you can potentially switch to the particle strip quad output which is compatible with a Shader Graph override.

    _particle_line_strip_2.gif
     

    Attached Files:

  3. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Hi! Thank you for giving me a quick answer!
    Yeah for my special case, using the line output and setting the target position was perfect for me, to do what I want with particle strips I will have to spawn particles also at the end of the line and then split the strips to create each individual lines. I knew I could do it but it's far more complex.

    Anyway, I understand the limitation of the line output, thanks for clarifying them!
     
    PaulDemeulenaere likes this.