Search Unity

Question Tex2D in a Custom Node not working?

Discussion in 'Shader Graph' started by bunp, Jun 10, 2019.

  1. bunp

    bunp

    Joined:
    Feb 21, 2019
    Posts:
    70
    I have a custom node that needs to get Tex2D, but it errors every time. Is there a way to get a tex2D properly? I cant figure out what I am doing wrong or find any documentation or example of someone else who has done it right.

    The code inside of the custom node is:

    surfaceHeight = Tex2D(ParallaxMap, uv + uvOffset);

    That line errors if I compile though, removing it all works 100% right, but I need that line.

    If I know what the Tex2D is, could I input that texture into the node via an in node link? How would I re-write that line in that case?
     
    Last edited: Jun 10, 2019
  2. Bouwie

    Bouwie

    Joined:
    Apr 16, 2014
    Posts:
    3
  3. miracletechteam1

    miracletechteam1

    Joined:
    Sep 18, 2019
    Posts:
    24
    use this:
    SAMPLE_TEXTURE2D(texture, SamplerState, UV)

    *SamplerState node is exist