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 Setting up a model for material recoloring

Discussion in 'Shader Graph' started by Schneider21, Nov 28, 2022.

  1. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I'm making a customizable character feature and am trying to setup a system where a single material with a custom shader can be used to apply color to multiple parts of an object. I get the sense I'm missing one or two bits of information that'd help, though.

    My basic plan is that our model with all of its optional parts will be textured in Blender using a grayscale texture atlas. Then the material in Unity would have color properties that can be changed to adjust colors for things like hair, eyes, skin, and some clothing parts. Each character actively in the scene would have their own instance of this material (so changes in one character aren't reflected in another). This video is pretty close to what I'm thinking.

    Previously, I've done this by actually shifting the mesh's texture UVs a specified amount along a color texture atlas, but I don't like how this requires being limited to a set of defined colors, and I'm honestly not sure what the performance implications were for messing with the mesh directly in this way.

    The piece I feel like I'm missing is how to actually configure the model in Blender. Would I assign separate materials in Blender for the hair, skin, eyes, and clothing? If so, how do I get my shader to identify these material slots and apply a specific color property from the shader to those UVs?

    I hate to ask such a vague question, but I don't have much to go off just yet.