Search Unity

Question Repeat UV texture without repeating tiles in editor

Discussion in 'Shader Graph' started by Blueeyesjt10, Sep 8, 2022.

  1. Blueeyesjt10

    Blueeyesjt10

    Joined:
    Mar 18, 2019
    Posts:
    7
    I'm developing a voxel game and have begun working on a greedy-mesh algorithm to decrease the number of vertices used in each chunk mesh. Since fewer vertices exist, now the UVs are being stretched.
    Since varying portions of the chunk mesh have different levels of UV-stretching, I can't simply have the tile texture repeat x-amount of times across the board. From what I've read, my only solution to this is to create the shader myself.
    upload_2022-9-8_11-45-25.png
    Here's essentially what I want the end product to result in:
    upload_2022-9-8_11-49-0.png
    In addition, the texture map has over 10,000 unique texture tiles on it. In some way, I have to tell the shader to use its given UV coordinates, and then repeat the said texture based on- I imagine world space?
    upload_2022-9-8_11-52-24.png
    I hope someone will be able to help me out! Let me know if any other information is needed. Thank you!
     

    Attached Files:

  2. Blueeyesjt10

    Blueeyesjt10

    Joined:
    Mar 18, 2019
    Posts:
    7
    From what I've read, 2D texture arrays seem to be a possible solution because that would allow for singular textures to individually repeat. Though, an issue with it is its limit of 2048 textures/'slices' per array. The texture image above is 10,000 tiles... Still hoping to find a better solution!
     
    Last edited: Sep 14, 2022
  3. Zenchuck

    Zenchuck

    Joined:
    Jun 2, 2010
    Posts:
    297
    You could use world or local coordinates, like you say. Local if the blocks move or scale.
     
  4. Blueeyesjt10

    Blueeyesjt10

    Joined:
    Mar 18, 2019
    Posts:
    7
    After several months of development, 2D texture arrays were the way to go! Though they have memory limits, I had the textures distribute across multiple submeshes to allow for it.