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

Multiple textures on single Object

Discussion in 'Shaders' started by TomH, Jun 16, 2014.

  1. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    Hallo.

    I want to tile 8 textures in a grid of 4 columns and 2 rows on a single object (currently a simple sphere). My problem is, that I don't know how to do the proper texture lookup since I only have a single UV. Any idea or example how to put multiple texures next to each other on a single object?
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    First you need some geometry with texture coordinates on it. Maybe since want a grid, for simplicity's sake, set them so that the tex coords at 0..4 horizontally and 0..2 vertically. Then in the shader, using the texture coords, you're going to have to do a bunch of `if` statements to isolate which region of the object you're in and then choose which texture to lookup and output.. .. e.g. `if texcoord.x < 1 and texcoord.y<1 then output top left texture pixel`.