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

Question Tiling and Offset with Sliced Textures

Discussion in 'Shader Graph' started by TheSky, Sep 14, 2022.

  1. TheSky

    TheSky

    Joined:
    Feb 16, 2015
    Posts:
    46
    I made a simple shader in shadergraph. I'm simply combining a main-Texture with a seperate alpha-texture.
    If i use that shader on a regular unsliced sprite image (left), everything looks as expected.
    But i actually want to use it on the single slices of a sliced image. (like it can be seen on the right).
    For an alpha-texture to fit a single slice, i can use the Tiling-and-Offset-Node.
    But how can i calculate the correct values for this node inside shadergraph, so every alpha-texture fits the sliced image?



     
  2. TheSky

    TheSky

    Joined:
    Feb 16, 2015
    Posts:
    46
    Okay, figured it out.
    I just set the wrap mode of the alpha-texture to repeat and set the tiling to the amount of rows and colums of the sliced image.
    Now everything works as i want.