Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Custom Mesh UV mapping

Discussion in 'General Graphics' started by WaffleDragon, Feb 19, 2021.

  1. WaffleDragon

    WaffleDragon

    Joined:
    Aug 11, 2020
    Posts:
    8
    I've been following along with Catlike Coding's hex map tutorial - as a guide for a similar terrain, so some code variance - and I'm having difficulty with texturing the procedural mesh. In the tutorial, we use vertex colours for a splat map along with a texture array so we can blend between different textures per tile. The shader code in the tutorial, however, is pre-URP, and so incompatible with my project; and I have next to no shader knowledge. I have made a texture array material in shader graph, which works fine on basic geometry, but appears stretched on the custom mesh. I am not entirely sure where I am going wrong so any guidance would be greatly appreciated.

    Catlike Coding's Tutorial: https://catlikecoding.com/unity/tutorials/hex-map/part-14/

    upload_2021-2-19_14-35-18.png
    upload_2021-2-19_14-46-4.png

    upload_2021-2-19_14-48-32.png upload_2021-2-19_14-47-0.png
     
  2. WaffleDragon

    WaffleDragon

    Joined:
    Aug 11, 2020
    Posts:
    8
    I should add that Catlike Coding does not seem to ever bother setting the UVs for the custom terrain mesh, yet his terrain is textured fine using his custom shader, which again, is not URP compatible.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    11,926
    To quote the tutorial itself:
    In Shader Graph, the XYZ components are generally labelled as RGB.
     
    WaffleDragon likes this.
  4. WaffleDragon

    WaffleDragon

    Joined:
    Aug 11, 2020
    Posts:
    8
    Cheers, this helped me get it working.

    For anyone who might like to see the graph:
    upload_2021-2-19_18-3-23.png
     
  5. WaffleDragon

    WaffleDragon

    Joined:
    Aug 11, 2020
    Posts:
    8
    If I could request your assistance again good sir; how can I select a colour for my texture based on the chosen index, which is stored in the UVs.
    upload_2021-2-20_13-14-42.png
     
  6. mcittar

    mcittar

    Joined:
    Jun 18, 2018
    Posts:
    1
    This configuration worked for me
     

    Attached Files: