Search Unity

Question View Space Texture

Discussion in 'Shader Graph' started by btristan, Jul 30, 2019.

  1. btristan

    btristan

    Joined:
    Oct 15, 2018
    Posts:
    95
    Hello,

    I want to use a mesh as a mask for a texture so I thought I could just whip up a view-space shader in Shader Graph.

    To see an example of the effect, see the Detail Texture in Screen Space section on this page: https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html

    I used a Position node set to View Space and plugged it into the UV of a Checkerboard node. Then that outputs to my Unlit Master color:
    Screen Shot 2019-07-30 at 18.25.49.png

    I am not seeing the expected behavior. The texture is aligned with my camera but it is stretched out across my mesh:
    Screen Shot 2019-07-30 at 18.25.36.png

    Obviously I'm doing something wrong but I don't know what. Can anyone help me out?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    That's correct for view space. You probably want screen space (like it's called in the Surface Shader example). Use the Screen node.
     
  3. btristan

    btristan

    Joined:
    Oct 15, 2018
    Posts:
    95
    Thanks for getting me in the correct direction. For anyone else looking back to this post for help, looks for the "Screen Position" node. (as of Shader Graph 5.7.2)
     
    bgolus likes this.
  4. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    nice trick