Search Unity

How to obtain particle system emissions in shader

Discussion in 'Shaders' started by coldwarrior5, May 1, 2020.

  1. coldwarrior5

    coldwarrior5

    Joined:
    Nov 9, 2016
    Posts:
    12
    I am writing a custom shader that takes the materials present in the scene and assigns them a color based on the category it belongs, i.e. segmentation. However, I have a problem with particle systems where they render the emissions and my shader is unable to see them, I would like to be able to grab all of the particles and assign them with segmentation color.

    The problem is, the particles emitted are not part of the scene, and as such, they are not fed into the custom shader to be shaded, so the resulting image does not see the particles because they do not "exist" in the scene but are rendered on top of the camera view.

    Is there a way that I could grab all of the particles in the scene and change their texture with the one I want but after they have been emitted, not it the particle system settings?

    Thank you for your help.
     
  2. Wayward_Studios

    Wayward_Studios

    Joined:
    Dec 15, 2018
    Posts:
    23
    I don't fully understand hwat you're trying to do, but changing the particles texture on runtime is not a problem, you could just write a simple particle shade ror modify the unity default particle shader to have a global variable you can set via a script.