Search Unity

Render a shader on top of a specific shader

Discussion in 'Shaders' started by EdyH, Oct 21, 2021.

  1. EdyH

    EdyH

    Joined:
    Jun 20, 2019
    Posts:
    13
    Hi fellow devs,
    I have been working on a very specific feature of my game. The situation is:
    I have two lines in the shape of cylinders and I need where the first one is in the middle of the other one. The idea is to have a flowing animation along the line in the center (look at the laser). In fact the laser in the picture is 2D but I am working on a 3D situation.
    upload_2021-10-21_14-28-45.png

    I was trying to use depth but it seems to be quite expensive as I read in another thread.
    Any help or idea is appreciated.

    [EDIT] I tried setting depth but didn't have any effect(see answer).
     
    Last edited: Oct 21, 2021
  2. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    250
    Im not exactly sure what you want,
    Perhaps you can just do a distance test from the fragment to the linesegment of the cylinder and if its close enough then render flowing animation