Search Unity

Question Use distance node without a circle shape

Discussion in 'Shader Graph' started by dr4, Feb 24, 2020.

  1. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    Hi people!

    I have been working on this for some hours now and couldn't get to anything useful, I'm using the distance node to get some shader effects based on a world position, the node works perfectly if I want something with a circular effect (I have a few different things with that) the problem is that I can't manage to create anything that is not circular no matter what, if the distance node touches anything it automatically becomes circular, for example, I have an effect that changes some opacity based on distance, it works perfectly if I want to do it in a circle, but if for example I want it to have an rectangle shape even the rectangle becomes an circle:

    upload_2020-2-24_0-39-46.png #

    I tried to use other approaches instead of assigned it to the UV but then I just get an fixed rectangle in the middle that never follows the given point, for example:

    upload_2020-2-24_0-46-44.png

    upload_2020-2-24_0-59-16.png


    and even tried alternatives to the distance node, but I cannot get the opacity point to be a square instead of a circle, the above node works perfectly to display this (an opacity is applied to one sprite an shows the one below):


    upload_2020-2-24_0-57-17.png

    what I would like to achieve it getting the distance node to show the same effect on that position but in a different shape, so the above effect would look like this (for example):

    upload_2020-2-24_1-1-14.png
     
  2. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    found a solution, it looks like if I use Add instead of distance I still can play with the position without making everything become a circle, so this works for me:

    upload_2020-2-24_13-10-24.png