Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Custom Function Node / Accessing samplers /_CameraMotionVectorsTexture

Discussion in 'Shader Graph' started by jwtrp, May 31, 2019.

  1. jwtrp

    jwtrp

    Joined:
    Dec 16, 2016
    Posts:
    6
    Helllo everyone.

    I'm working on an effect for a project and trying to adapt some stuff for shadergraph.
    what I would need is to define the sampler2D _CameraMotionVectorsTexture so I can use the Motion Vectors.

    At the moment I try to access that via a Custom Function Node with no success. always throws new errors at me. As you can see, I'm not a shader expert.

    What I'm trying for example:

    Code (CSharp):
    1. sampler2d _CameraMotionVectorsTexture;
    2. Output = tex2D(_CameraMotionVectorsTexture, uv);
    3.  
    Erros I get for example:
    SamplerState object does not have methods or that the sampler state needs to come from a literal expression.

    https://docs.unity3d.com/ScriptReference/DepthTextureMode.MotionVectors.html


    Is it possible to access the motion vectors in a node based approach?
    I guess it is also a problem where the custom node is injecting the code. right?

    Is there a minimal template / reference on how to write injectable .hlsl files that I could include?

    Is this even the right approach to access the motion vector within the SRP or is it bascially "legacy"/ standard pipeline?


    Thanks for reading.
    J
     
  2. jwtrp

    jwtrp

    Joined:
    Dec 16, 2016
    Posts:
    6
    Push