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

tessellation tiling

Discussion in 'Editor & General Support' started by Jmanpie, Mar 8, 2013.

  1. Jmanpie

    Jmanpie

    Joined:
    Oct 7, 2012
    Posts:
    132
    Hey guys i was just wondering is there any reason why tessellation doesn't let you tile the displacement map this is the main one as well as it handles the height if you have a tillable texture and you increase the tiling it just doesn't work (dx 11 tessellation bumped specular). I increased the height on the second image so you can see what is happening the displacement is set to alpha from grey scale.

    $example.png
     
  2. Ceryni

    Ceryni

    Joined:
    Apr 6, 2013
    Posts:
    8
    Hi,

    i had the same issue. Just multiply your texture coordinates by your tiling factor like this:

    Code (csharp):
    1.  
    2. void disp (inout appdata v)
    3.         {
    4.             float d = tex2Dlod(_DispTex ,float4(v.texcoord.xy*_Tiling,0,0)).r * _Displacement;
    5.             v.vertex.xyz += v.normal *d;
    6.         }
    7.  
     
  3. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    nice, can you offer a screenshot too?
     
  4. Ceryni

    Ceryni

    Joined:
    Apr 6, 2013
    Posts:
    8
    $dx11_tess_terrain.jpg

    I am currently trying to make an TerrainSystem for educational Purpose. (As you can see its very bad atm)
     
  5. Sahkan

    Sahkan

    Joined:
    Mar 3, 2013
    Posts:
    204
    Is it requiring unity 4.1 or 4.1.2 ? cus it dosnt work for me and i'v got unity 4.0.1 .
     
  6. Sahkan

    Sahkan

    Joined:
    Mar 3, 2013
    Posts:
    204
    Ok i had to add a varible _Tiling and an slider, what about Offseting, what can i do it ?
     
  7. Ceryni

    Ceryni

    Joined:
    Apr 6, 2013
    Posts:
    8
    actually its the same just add your offset to the uvs. If you want a different offset for the y-direction you have to split th uv in x and y like that:

    Code (csharp):
    1. float4((v.texcoord.x*30+0.1f)(v.texcoord.y*30+0.2f),0,0)
     
  8. William White

    William White

    Joined:
    Nov 7, 2013
    Posts:
    4
    Hi, Ceryni

    I am trying to make it work but I am completely lost!
    Could you please share the shader?

    W
     
  9. hdd-op

    hdd-op

    Joined:
    Dec 30, 2013
    Posts:
    5
    Any news about heightmap tiling
     
  10. smirlianos

    smirlianos

    Joined:
    Aug 2, 2012
    Posts:
    177
    It doesn't seem to work...
    Can someone post the full shader?
     
  11. Jmanpie

    Jmanpie

    Joined:
    Oct 7, 2012
    Posts:
    132
    Okay so locate the tessellation shader Assets -> standard assets -> tessellation shaders double click BumpedSpecularDisplacment
    Navigate to line 38
    insert the following over the disp void function

    Code (csharp):
    1. float4 _ParallaxMap_ST;
    2.  
    3. void disp (inout appdata v)
    4. {
    5.         float d = tex2Dlod(_ParallaxMap, float4(v.texcoord.xy * _ParallaxMap_ST,0,0)).a * _Parallax;
    6.         v.vertex.xyz += v.normal * d;
    7. }
    8.