Search Unity

I would like particle effects to be rendered above the transparent layer

Discussion in 'Shaders' started by salvolannister, Jun 3, 2021.

  1. salvolannister

    salvolannister

    Joined:
    Jan 3, 2019
    Posts:
    50
    Hello folks,

    I have a panel (figure below) where I attached a transparent texture and when I point it with a 3D laser the particle effects at the end of the laser are rendered just after the panel as shown in the picture.

    I would like the particle effects to be rendered above the panel showing where the 3D laser hit the box collider attached to the panel.

    I am using URP and a lit material for the panel with the "X" shown in the picture.
    I also tried to play with the field where you can specify the transparent layer moving it from 3000 to 3001 but it didn't work ( I don't remember anymore where this can be changed).

    thank you for the attention
    particle_Problem.png
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Render order (which you can control by setting the queue) will ensure the effect will render over other transparent objects, but not opaque ones. For that you either need to actually move the particle towards the camera, or you need to use a shader that uses
    ZTest Always
    . Shader Graph doesn't expose the later option, and doesn't make moving the particle towards the camera without distortion easy (though it is possible). However you could write your own shader to do this, or you can try using one of the built in shaders that does. The FX/Flare shader for example might work for you.