Search Unity

Question How to get UV related nodes when all i know is thier cg names

Discussion in 'Shader Graph' started by bugaj, Jan 24, 2020.

  1. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    58
    How to get UV related nodes when all i know is thier cg names

    v.texcoord0.z
    variable *
    _WarpTex_ST.zw

    i read that
    "
    When the mesh data contains fewer components than are needed by the vertex shader input, the rest are filled with zeroes, except for the .w component which defaults to 1. For example, mesh texture coordinates are often 2D vectors with just x and y components. If a vertex shader declares a float4 input with TEXCOORD0 semantic, the value received by the vertex shader
    will contain (x,y,0,1)."

    so wont ZW would always be float2=0,1
    but i see it used often in codes, so it must mean something else
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    The texture coordinates in the vertex data are float4s, and all of the components can be set with a full Vector4 from c# if wanted. The fact zw is being set to 0 and 1 is just a Unity convention. For procedural meshes it's not uncommon to pack two texture coordinates into the first uv set.