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.
  2. Dismiss Notice

How to color/tint a single section of a texture atlas

Discussion in 'General Graphics' started by CashCache, May 29, 2016.

  1. CashCache

    CashCache

    Joined:
    May 16, 2016
    Posts:
    11
    Hi Everyone,

    I'm experimenting by adding textures to cube faces. I'm using one Texture Atlas and then choosing a tile at run time to add to the face of the cube. So far this all works as expected, but now I want to be able to tint or color one of the tiles differently than all the others, but can't figure out how to do it. I have figured out how to color a full texture, but not just one tile.

    I'm currently using a texture atlas that does contain some transparency in it - just in case that makes a difference.

    Thanks in advance!
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    How are you choosing a tile? Do you have a different material on each face, or are you modifying the UVs of the mesh itself? If it's different materials then you can just have a time l tint built into the material. If you're modifying the meshs UVs then you might want to just modify the vertex colors.
     
  3. CashCache

    CashCache

    Joined:
    May 16, 2016
    Posts:
    11
    I have one texture and proceduraly creating a mesh one object at a time, then assigning the UV coords for the tile to each face. I thought modifying the vertex colors would just "override" the texture tile being applied? Would I need to incorporate a custom shader to get the affect I am looking for?

    I'm just wanting to color certain white texture tiles to make them the color of the sky, dirt, grass, etc.

    Thanks.
     
  4. AkiraWong89

    AkiraWong89

    Joined:
    Oct 30, 2015
    Posts:
    662
    Like @bgolus said. In this case I think you can only use vertex paint to get the result.
    It won't override the texture. White vector color = Your original texture color.
    Other vertex colors blend into that colors by using multiply method.
     
  5. CashCache

    CashCache

    Joined:
    May 16, 2016
    Posts:
    11
    Yes, that was what I was looking for. Thank you both.