Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Keywords for light calculation in vfx graph

Discussion in 'Visual Effect Graph' started by pap3rhat, Apr 14, 2024.

  1. pap3rhat

    pap3rhat

    Joined:
    May 2, 2020
    Posts:
    6
    Hey, I have a question regarding keywords and shader graphs used in VFX graphs. I have an unlit shader that uses custom lighting to create a toon effect. In order to calculate the lighting, I have to specify several Unity internal keywords (_SHADOWS_SOFT, _MAIN_LIGHT, _FORWARD_PLUS) so Unity calculates the necessary values for me, although I am not using a Lit material (where I would not have to specify these values in the shader graph). The problem now arises that the VFX graph does not support keywords within the shader graphs (yet). Is there any possibility for me to set the necessary keywords via a script or enable them differently for the VFX graph? I have already tried using
    Code (CSharp):
    1. Shader.EnableKeyword(GlobalKeyword.Create("_MAIN_LIGHT"))
    in a script, but that did not change anything. I have also tried just using a Lit material, but then Unity's own lighting calculation added to mine looks bad.
    Thank you very much!