Search Unity

Emission Color over time for Particle Systems?

Discussion in 'General Graphics' started by TickTakashi, Jun 2, 2019.

  1. TickTakashi

    TickTakashi

    Joined:
    Mar 14, 2013
    Posts:
    31
    Hi

    is there a way to use the particle system component to modify the Emission Color of a particle material over time instead of the regular material Color? Same question goes for Line Renderers?

    At present i'm having to duplicate lots of materials just to adjust their emission color slightly, or do it manually in code.

    Just to be clear, i'm not talking about particle system "Emission" module. I'm talking about this:

    upload_2019-6-2_14-17-18.png

    Alternatively, is there a way to have the normal Color module have an effect on materials which have emission?currently adjusting the Color doesn't make a difference if the material is emissive.
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    There are a couple of options but both have downsides (sorry) :)

    1. Write a custom surface shader to hook up the color stream to the emission. (Can also use the custom data module to define an additional color) The downside of this is needing to write your own shader, which means needing to recreate any other functionality from the standard particle shaders.

    2. Keyframe animate the emission color. Downsides are: need lots of materials, hence not great performance, and color is tied to animation time not particle playback time (only matters for looping systems)
     
    TickTakashi likes this.
  3. TickTakashi

    TickTakashi

    Joined:
    Mar 14, 2013
    Posts:
    31
    Thank you for the solution. I'm very much a beginner when it comes to Shaders - only ever written shaders with shader graph - is this possible with Shader Graph?
     
  4. TickTakashi

    TickTakashi

    Joined:
    Mar 14, 2013
    Posts:
    31
    Ah! I have figured something out that works. Will post back here with my solution shortly
     
  5. TickTakashi

    TickTakashi

    Joined:
    Mar 14, 2013
    Posts:
    31
    upload_2019-6-2_23-58-3.png

    So here's what I came up with.

    The Color functionality of Particle Systems uses Vertex Color. So i've very quickly thrown together a shader that multiplies in an emissive intensity to the regular Color. Mathematically the intensity of a HDR color is used like this:

    `Color = Color * 2^(Intensity)`

    So i've just added some nodes that allow the shader to take that intensity value directly instead of an emissive color, and do the math. Results:

    upload_2019-6-3_0-4-21.png


    Particle system controlled emissive color :) No texture or anything like that in the shader but it's quick to add. Thanks for your help!
     
    zhuhaiyia1, scealux, Ryan900 and 3 others like this.
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Ah yes I forgot about solution #3 .. ShaderGraph! :) Nice one!
     
    scealux likes this.
  7. unity_W1EqLbofuuUaxQ

    unity_W1EqLbofuuUaxQ

    Joined:
    Jan 20, 2020
    Posts:
    1
    Does this solutions still works? Because i've got this upload_2020-7-14_15-49-56.png
     
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    What texcoords is the shader using?