Search Unity

VFX graph particles not affected by "Set Alpha"

Discussion in 'Visual Effect Graph' started by garyalanridgway, Apr 18, 2022.

  1. garyalanridgway

    garyalanridgway

    Joined:
    Jul 5, 2017
    Posts:
    4
    Hello there! Hope you are having a nice day!

    I have been trying to get a particle system working but I just can't seem to get it right. I did the following things to get to where I am:
    1. Created a mesh to output as a particle
    2. Created a lit particle system outputting this mesh
    3. fiddled with the rotation over time and whatnot
    4. created a shadergraph vfx graph for texturing the particle (This uses some alpha, could this be a problem?)
    My Particle system now looks like this:



    But unfortunately I seem to not be able to further affect the alpha of my particles. I would love to fade them in and out over their lifetime, but adding a `Set alpha over lifetime` to either the `output particle lit mesh`, or the `update particle` sections seems to have any effect. Even here as you can see, setting the alpha to 0 on the face you can see does nothing.



    I am unsure of what to do from this point, so i thought I would make a post here! Thanks for taking a peek!

    Additionally, here is my shader graph vfx graph for reference if it is relevant as well:

     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    Blocks like Set Color, Set Alpha, Set Size etc. work on particle attributes and they don't know anything about shader. When default shader is selected (graph is set to none) output takes some attributes and passes them automatically to the default shader (including alpha attribute).
    If you set custom shader graph it does not happen and you must pass data you need there - currently the only source of alpha is your texture.

    In short your shader has no clue about alpha from vfx graph. You need to add property in shader graph to pass alpha and then feed with data.
    upload_2022-4-18_15-36-11.png
     
  3. garyalanridgway

    garyalanridgway

    Joined:
    Jul 5, 2017
    Posts:
    4
    @Qriva thank you so much for responding! after getting back from work today I looked for the place where you are adding your variable in, and I don't seem to have it on either of my inputs:



    was there something you had to do to get it to show up?
     
  4. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    upload_2022-4-19_4-39-43.png
    You need to implement this in your shader (and multiply property with alpha from texture)
     
    Gooren likes this.
  5. Maeve_

    Maeve_

    Joined:
    Feb 16, 2022
    Posts:
    4
    Hey ! I have a problem with my alpha too....
    if i control it in the inspector or just with a flat value in the shader graph, its perfect, BUT if I use the VFX graph, the alpha dont work... (in the 2nd image, i dont want the black background) :,(
    upload_2022-12-8_11-22-36.png upload_2022-12-8_11-23-17.png
     
    zankenpon likes this.
  6. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    There is opaque mode enabled, so there is no transparency.
     
  7. Maeve_

    Maeve_

    Joined:
    Feb 16, 2022
    Posts:
    4
    thanks for the help ! It was because a YT tuto said that opaque was good for what i wanted..i guess that was a lie :,(
     
  8. whyatme

    whyatme

    Joined:
    Apr 4, 2021
    Posts:
    20
    This was what I needed, thank you
     
  9. zankenpon

    zankenpon

    Joined:
    Feb 27, 2019
    Posts:
    3
    I'm saved from this post LOL
     
  10. promatan1

    promatan1

    Joined:
    Mar 26, 2014
    Posts:
    4
    Hi all,
    im using Set Alpha block to spread particles over an animated 2D texture array, by connecting the SampleTexture2DArray to the Set Alpha block in the Initialize Particle.

    i like the result im getting, but im worried about performance. my problem is that the results only looks good when using a very large amount of particles - i think its becouse the particle rate fills the entire image including the Alpha parts (when invisible particles) instead of only drawing particles where that are visible.

    Does any body knows how can i render particles only where they need to be drawn? will that improve performance and reduce the amount of particles needed to achive the same result?
     

    Attached Files: