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 diffuse textures

Discussion in 'Shaders' started by baylor, Jan 9, 2010.

  1. baylor

    baylor

    Joined:
    Oct 29, 2009
    Posts:
    25
    Hi, i'm new to 3D and certainly to shaders and have what i think is a super simple question

    i'm working on a fashion game and need the ability to render multiple textures on a skinned mesh. As an example, the base texture might be a bra, then an undershirt, an overshirt, a vest then a jacket. Another example are tattoos and makeup. Obviously, the textures have alpha channels, normally full transparent but sometimes partially transparent

    From a different forum i was told the default shaders only support a single diffuse texture so if i want more, i need to write my own shader. Aside from my total ignorance, i've had a couple of problems

    First, i looked at the source of the existing shaders. Many are short and simple but the alpha ones look *seriously* complex - there's hundreds of lines of code, assembler, card-specific code, etc. Is that going to be necessary? If so, i know my limits, maybe i'll give up on this now

    Second, with a single texture my model wasn't rendering correctly with the default shaders. Looks perfect in Torque but in Unity the shirt mesh was showing through/on top of the overcoat mesh. Apparently i had to switch to something called a transparent cutout diffuse mesh. Don't know what's the issue but i assume i need whatever function is in that shader (which i couldn't find the source for). Unfortunately, i read that shader can't do partial transparency

    Since source is given out, i was hoping it would be as easy as stealing one of the many, many existing shaders and modifying them (using the manual, which i've been reading). Does this sound feasible?

    An alternative we're looking at is using Texture2D.SetPixels(texture2.getPixels()) to merge everything to a single texture and then just use a normal shader. We're still testing/learning about that approach
     
  2. Deleted User

    Deleted User

    Guest