Search Unity

Resolved Issue for getting a smooth AlphaClipThreshold (from a gradient 2D texture)

Discussion in 'Shader Graph' started by Azzulio, Apr 21, 2021.

  1. Azzulio

    Azzulio

    Joined:
    May 27, 2016
    Posts:
    2
    Hello everyone,

    I'm trying these days to create a shader where a video is appearing from nowhere. The process was to make it thanks to the alpha of the texture renderer and using a lerp for modifying it. The result will use the Alpha Clip Threshold (a 2D texture representing a centered gradient) to make appear and disappear from the center of the main texture. Look to the first link for getting all the processes.

    The issue is that even by increasing the size of the 2D texture gradient, the result is pixelated. Does anyone have any idea how I can modify it to make it smoother? I think it's because the 2D texture is a .jpeg but I don't know how to add a vectorize texture.

    Shadergraph node :
    https://pasteboard.co/JYncdWM.jpg

    Results :
    https://pasteboard.co/JYn96cA.jpg
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Hi and welcome,

    You could perhaps create a procedural mask. This will improve the quality and you don't need to waste texture memory. This comes of course with the cost of rendering the mask but it is probably not that significant cost.

    I made two examples how you can make a round mask procedurally. You can see the result in the bottom right corner, where the mask is applied to a quad on an opaque material.

    20210421_procedural_mask.PNG

    Here's the result in scene viewport:
    20210421_procedural_mask_result.PNG
     
    Azzulio likes this.
  3. Azzulio

    Azzulio

    Joined:
    May 27, 2016
    Posts:
    2