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

Colorizing sections of an Atlas

Discussion in 'Shaders' started by Gigasaurus, Jul 30, 2014.

  1. Gigasaurus

    Gigasaurus

    Joined:
    Jan 4, 2014
    Posts:
    6
    I'm doing a project that involves making a variety of buildings. Most of these buildings have similar materials (ie wood siding, shingles, single-board window/door-frames) except that the wood and shingles have to be a different color on each building (one building may have red wood siding and grey shingles, another building might have yellow wood siding and brown shingles). To improve performance, I'm wondering if there is a way to have a single Atlased material that gets used across the various buildings, but to be able to colorize different parts of the atlas as needed. The colors I use are specific (since I am following a branded color-scheme) so I can't compromise too much on the colors (and they sometimes need to be very saturated colors). Does anyone have any suggestions?
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    One approach would be to put the tint colours you want into your models as vertex data, and use a shader that supports vertex colours. This means more model data, but you can share one material across many different models and still have them batch.
     
  3. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Or add a second texture with the colors in it, map it on the second uv channel and disable filtering on it. Then in the shader just multiply the two textures. This also enables batching, but does lead to even more model data. The up side is that it's probably a bit easier to adjust the colors later on.