• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by baylor · Jan 06, 2010 at 09:42 PM · texture

Using multiple textures per material

How does one make a material that has multiple textures and how does one change those textures at run time?

Our game is a dress up/fashion game. There are ~35 layers/types of clothing (including tattoos and makeup). Many things are mounted (belts, hair, mustaches, glasses, etc.) but quite a few are not. The doll has 4 skinned meshes (body (divided into regions to allow different tattoos), upper (shirts, vests, bikini tops, etc.), lower (pants, shorts, socks, etc.) and over (dress, coat, cape, etc.)). Each mesh has a material. Different layers of clothing go in different parts of the mesh - bra is upper[1], undershirt is upper[2], necklace is upper[3], overshirt is upper[4], jacket is over[1], etc. We could, of course, use multiple skinned meshes but those get to be a real pain once you have several

In T3D (where we prototyped the game), a material has a texture array and setting/changing one was done with the code myMaterial.diffuseMap[1] = "tshirt.png". i'm trying to find the Unity equivalent. i'm fairly sure Unity supports multiple textures per material (the skybox seems to use 6), i just haven't figured out the keywords to make it work

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gregacuna · Sep 04, 2015 at 02:45 PM 0
Share

Does anyone have any new information about how to do this? How are people doing this for basic avatar creators?

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by duck · Jan 06, 2010 at 10:28 PM

Generally, a material only has more than one texture when those textures are used in combination with each other on a single mesh - such as a lightmap on top of a diffuse map, or a bump map and reflection map applied over a diffuse map. The skybox material is an unusual exception to this rule (and I'm not sure how it works!).

However, if you want to do this kind of character skinning using texture swapping in Unity, the more typical way would be to apply a different material to each mesh using the renderer.material property of the renderer on each mesh. Or, if the separate parts of the body that you mention are collapsed into a single multi-material mesh (i.e. it has submeshes), you would assign a different material to each element in the renderer.materials array.

Also important to note is that if you modify a Renderer's materials in this way and any other Renderers were using the same material, it will generate a temporary runtime clone of the Material. Other renderers will go on using the original. In practice, this means if you change one avatar's clothing, all other avatars will remain untouched. If you want to affect all instances of a material, use .sharedMaterial or .sharedMaterials instead.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Ryuuguu · Jan 07, 2010 at 09:50 AM

You may want to look at http://unity3d.com/support/resources/example-projects/charactercustomization example project. A lot of it's focus is downloading AssetBundles, but is basically a "dress up/fashion game" prototype done by unity Programmers.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gregacuna · Sep 04, 2015 at 03:31 AM 0
Share

Is it possible to still get the character customization example project? I'm not seeing it there.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Assigning UV Map to model at runtime 0 Answers

how to dispatch textures as tiles in one terrain 0 Answers

Else load next texture. 1 Answer

More than one Kernel in Compute Shader 1 Answer

weird texture distortion 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges