Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
avatar image
0
Question by ez06 · Jun 17, 2016 at 02:29 AM · materialrendereruvmapping

How to dynamically apply a color to one portion of a UV map?

Let's say I want the user to choose the character's shirt color.

What should I do it by script to apply a tint color to a certain part of my UV map? Or is there another way than by script?

Comment
Add comment
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

2 Replies

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

Answer by _Yash_ · Jun 17, 2016 at 05:25 AM

You can create a shader for this. There are two ways to do it.

1) create an image in which every part has different RGB values and your shader replaces specific RGB value with the one you provide. for example, if your shirt part in the reference image is red(1,0,0), your shader will replace red with your given color. create this pair for each part.

2) create mask images for every part and use that masks to change the color of the specific part. use all images to change color in the shader.

Comment
Add comment · Show 4 · 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 ez06 · Jun 17, 2016 at 09:10 AM 0
Share

Hi there, Thanks for your response. Would that mean I would have to write my own shader? I don't know how to, so I'm better off finding one, or some plug-in. Any suggestion for a ready made shader/plugin? Thanks a lot

avatar image _Yash_ ez06 · Jun 17, 2016 at 09:49 AM 0
Share

I don't think you will find this shader online. Because as far as I know shaders can not have the variable number of properties, so you have to make your own shader. It is an easy one, just take one Unlit shader and modify it's fragment function.

avatar image ez06 _Yash_ · Jun 17, 2016 at 01:39 PM 0
Share

Thank you for the clarification.

Say I created a Color property called _shirtColor, and the shirt is in the square between (0,0) and (0.5,0.5) in my UV $$anonymous$$ap. What line should I add to this standard frag function? Is it some kind of Combine line? I really don't know what to do.

     fixed4 col = tex2D(_$$anonymous$$ainTex, i.uv);
     UNITY_APPLY_FOG(i.fogCoord, col);
     return col;

Thank you very much for your help

Show more comments
avatar image
0

Answer by qwnick · Dec 22, 2020 at 07:39 PM

You can create model with a couple of sockets for materials, and then change color of each material instance independently.

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

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.

Follow this Question

Answers Answers and Comments

47 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 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 avatar image avatar image avatar image

Related Questions

Changing two different objects renderer colour 1 Answer

Are Mesh Filters Really Necessary? 1 Answer

Trying to make a side scroller. I'm following a tutorial and getting this error. 1 Answer

Gameobject not the right color 0 Answers

Changing specific materials onTriggerEnter 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