Search Unity

Particle strips fade out from camera depending on orientation

Discussion in 'Visual Effect Graph' started by cocapasteque, Jul 15, 2021.

  1. cocapasteque

    cocapasteque

    Joined:
    Sep 30, 2016
    Posts:
    20
    Hi,

    First of all:
    • Unity 2020.1.17f1,
    • URP 9.0.0-preview.72
    • VFX Graph 9.0.0-preview.72

    I'm trying to make a projector VFX with VFX Graph, and I'm kind of lost here.
    I got this effect working in a test scene correctly, it rendered ok and I could see it properly.
    Now when I move it to the scene I want it in, the particles fade out depending on the camera orientation.
    I tried to look into the render queues, see if it was correctly assigned there but couldn't really find anything helpful.

    Here's a video of my issue:


    The wall mesh behind the projector has a dissolve effect shader using alpha clip and set to 2450 for the render queue. I also found a script on the forum to set the render queue of the VFX so I used that to set the VFX render queue to 3000 (I tried 2450 as well but same effect):

    Code (CSharp):
    1. public class VfxRenderQueue : MonoBehaviour
    2. {
    3.     public int sortPriority = 0;
    4.     public int renderQueue = 3000;
    5.     private static readonly int TransparentSortPriority = Shader.PropertyToID("_TransparentSortPriority");
    6.  
    7.     private void OnValidate()
    8.     {
    9.         Setup();
    10.     }
    11.  
    12.     private void Start()
    13.     {
    14.         Setup();
    15.     }
    16.  
    17.     private void Setup()
    18.     {
    19.         var r = GetComponent<Renderer>();
    20.         if (r == null)
    21.         {
    22.             Debug.Log("Renderer not found in VFX");
    23.             enabled = false;
    24.             return;
    25.         }
    26.  
    27.         r.sharedMaterial.renderQueue = renderQueue + sortPriority;
    28.         r.sharedMaterial.SetFloat(TransparentSortPriority, sortPriority);
    29.     }
    30. }
    upload_2021-7-15_14-31-32.png


    And the VFX Graph :
    upload_2021-7-15_14-32-6.png

    So I'm kinda lost now, I don't really know where to look for answers and what to try :)

    Thanks!