• 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 0tacun · Sep 19, 2014 at 06:08 PM · shadercolorvertexinformation

How much information can you store in vertex color?

I use the color of the vertex to decide which texture should be used and got 4 textures working:

  • Texture 1 : Red

  • Texture 2 : Green

  • Texture 3 : Blue

  • Texture 4 : Black

I tried to add the color White to gain a fifth texture, but this didn't work because it behaved like a overlay on top of the other textures (Well, this could be expected...).

So my question is: how could I store more information into my vertics?

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
0
Best Answer

Answer by 0tacun · Oct 09, 2014 at 08:13 PM

I came to the conclusion: How much you need. It is possible to get the color value from a certain range:

     half value = step( 0.5, IN.color.r);
     half value2 = 1-step( 0.5, IN.color.r );
 
 tex2D( _Tex1, IN.uv_Tex1 ) * value +     tex2D( _Tex2, IN.uv_Tex1 ) * value2

value is in the range of the red channel from 0.5 to 1.0, while value 2 is in 0.0 to 0.5. Both return 1 if the step function is true. How much performance it costs is a different matter.

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
0

Answer by Cherno · Sep 19, 2014 at 06:24 PM

I found a shader that supported 8 diffuse textures, but I think that's the limit. Anything more will have to emulate Unity Terrain's splat map system (which I would love to clone for custom meshes).

The name of the shader is "TMG_8SplatShader_Diffuse".

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 0tacun · Sep 19, 2014 at 06:31 PM 0
Share

Ah thank you for your reply! Well it looks like he is using two textures to have 8 information. That would do, but I use the vertex color aprouch so I don't need to uv the control map. Unfortnuatly in Blender I can't paint the alpha channel on the vertics, if I could I would gain one extra texture.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

25 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

Related Questions

Change vertex color of a mesh. 2 Answers

Color depending on vertex normal 1 Answer

Strange artifacts on Vertex Color Shader 0 Answers

Shader to change Vertex Colors 0 Answers

Need help with using world position in shader 1 Answer


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