Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
This question was closed May 09, 2015 at 10:29 PM by joshua-lyness for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by joshua-lyness · Mar 02, 2015 at 06:30 PM · shadermaterialruntimecolour

Multi materials for one mesh

I need to be able to change which faces use what material during run time, on a single mesh. I need a way for each face on a mesh to be able to change from green to transparent, be two different materials, or a shaded of some sort. The problem is being able to define which faces use which shader, or colour. How do I do this? Thanks.

Comment
Add comment · Show 7
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 fafase · Mar 02, 2015 at 06:38 PM 1
Share

I would think the material is bound to the mesh filter so if one material on a mesh it will take care of the whole mesh.

You would have to cut your mesh in sub models.

I could be wrong though but most modelers d it that way so there must be a reason.

avatar image joshua-lyness · Mar 02, 2015 at 06:43 PM 0
Share

Huh. That's a shame. I'm making a city builder, so I need to make some faces turn transparent when a subway station is plopped down, otherwise the ground covers it over. The zone is about 500*500 tiles, so that would be about 1 million vertices if there was a sub mesh for each grid space. :(

avatar image joshua-lyness · Mar 02, 2015 at 06:45 PM 0
Share

Could you have one shader that turns a face of the model transparent if a Boolean value is true? So if transparent= true, it would turn the face alpha to 100%, but only for that face and not the whole mesh?

avatar image Cherno · Mar 02, 2015 at 07:04 PM 1
Share

It's possible to make certain parts of the mesh use one of the object's materials. Look into Sub$$anonymous$$eshes, these are basically arrays that take vertex indices just like the normal triangle array of a mesh, but you can have multiples. They correspond to the material array of the renderer.

avatar image Cherno · Mar 02, 2015 at 07:44 PM 1
Share

As I wrote above, you have to look into Sub$$anonymous$$eshes. Understanding the basic $$anonymous$$esh class is a must.

Show more comments

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animated colour material 1 Answer

How do I change render.material at runtime seamlessly? 2 Answers

Check What Material is Being Used? 1 Answer

How to update texture during runtime to display damage? 0 Answers

Building a Unity 5 Standard Material at runtime 3 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