Search Unity

Help Wanted [SOLVED] How to get VFX blocks parameters in custom VFX shader?

Discussion in 'Shader Graph' started by sergiusz308, Jan 26, 2020.

  1. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    78
    Hi there, I created a custom VFX Graph shader with Shader Graph but I can't access VFX block parameters in there.

    For example, there's a "Set Alpha" block in VFX graph which is completely ignored when using custom shader.

    In order to get alpha fading out over life time I need to manually re-create it in the custom shader, in Shader Graph.

    Is this a way to go or I am missing something?

    upload_2020-1-27_0-27-36.png

    Thanks,
    S.
     
  2. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    78
    Anyone? Is there any other way to access VFX blocks parameters from custom shader?

    @alexandral_unity C'mon guys, little help, considering very basic documentation...
     
  3. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    119
    VFX blocks are not accessible from the Shader Graph. To do what you want, you need to expose a property on the blackboard and plug it in to the alpha, then perform your calculations in the VFX graph and feed the output to the shader (the slots will appear where you see the texture 2d slots).
     
    sergiusz308 likes this.
  4. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    78
    OK, so for everyone looking for this, based on Alexandra reply I did it following way:

    upload_2020-2-6_14-33-56.png

    There's built-in alpha control block from VFX, where I set up particle-wise parameters for alpha, i.e. "Set Alpha over Life"

    Then there's "Get Attribute" for alpha, which is connected to the property exposed in my shader, i.e. "In Alpha over Lifetime"
     
unityunity