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

Tiling with texture atlas

Discussion in 'Shaders' started by RiokuTheSlayer, May 23, 2015.

  1. RiokuTheSlayer

    RiokuTheSlayer

    Joined:
    Aug 22, 2013
    Posts:
    356
    (This was originally posted in scripting but then I realized I needed to move it here.)

    My problem is pretty simple. I have mesh I'm generating using some custom code I've written, and it uses Greedy Meshing to significantly reduce the amount of faces being drawn.

    My problem has to do with textures. When using greedy meshing, the faces are stretched as big as they can be. That's all fine and good. But my problem is that textures aren't mapped correctly because of this. They stretch to match the size of the face rather than staying the same scale always.



    As you can see, the left face of the square is 4x4 large. But it just looks like the texture was enlarged.

    On the right face, the texture is stretched upward an extra unit, but keeps the same width, as it's only one wide.

    Does ANYONE know how I could fix something like this? Do I HAVE to scrap my greedy meshing system and make every unit have it's own face?

    I do know it's possible somehow, as I've seen it in this video:


    Any help would be greatly appreciated!