Search Unity

Question Tiling Shaderlab shader

Discussion in 'General Graphics' started by eco_bach, Mar 24, 2021.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Would the following be correct in changing the UV tiling for a Shaderlab shader? ie Here simply doubling the tiling amount. For an iOS app so extremely time consuming proceeding by trial and error, publishing, compiling and deploying to a test device
    Code (CSharp):
    1. v2f vert (appdata v)
    2.             {
    3.                 v2f o;
    4.                 _MainTex_ST.x=2;
    5.                 _MainTex_ST.y=2;
    6.                 o.vertex = UnityObjectToClipPos(v.vertex);
    7.                 o.uv = TRANSFORM_TEX(v.uv, _MainTex);
    8.                 UNITY_TRANSFER_FOG(o,o.vertex);
    9.                 return o;
    10.             }
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    I mean the "correct" way is to change the tiling amount on the material. But that works fine too.
     
  3. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Thanks. Having better luck doing it this way. Just need a way to dynamically change at runtime so its not a trial and error process.