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 /
avatar image
4
Question by AlucardJay · Jul 16, 2013 at 08:14 PM · meshcolorvertex

Vertex colours not blending across triangle face

alt text

Assigning colours to vertices of procedurally generated mesh. Noticed the colours seem very 'polarized' around the vertex and not blended evenly along the face of the triangle. Is there a setting I'm missing, like the FilterMode when creating a texture? Is the answer just to create more vertices?

This is the shader I'm using : http://wiki.unity3d.com/index.php/VertexColorUnlit

Quad colour code :

 // -- Colours --
 
 colors[0] = new Color( 1, 0, 0, 1 );
 colors[1] = new Color( 1, 1, 1, 1 );
 colors[2] = new Color( 0, 0, 0, 1 );
 colors[3] = new Color( 0, 0, 0, 1 );
 
 mesh.colors = colors;
 
 // ----

example :

alt text

vertcoloursnotblending2.jpg (58.2 kB)
vertcoloursnotblending.jpg (185.9 kB)
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 AlucardJay · Jul 17, 2013 at 03:20 PM 0
Share

Look at the quad. see there is a distinct line where the colour transitions from white to a shade of red. This is not a smooth transition, it stays pure white and there is a distinct visible white line before the red starts to blend.

I've just finished the logic behind the colour picker. The effect can be clearly seen in this demo : http://www.alucardj.net16.net/unityquestions2013/ColourPicker.html

Click and drag around the wheel, watch the colours of the quad. This is not a smooth gradient.

If you click and drag on the center quad, you can see what colour is supposed to be at that part of the quad.

avatar image AlucardJay · Jul 17, 2013 at 03:37 PM 0
Share

alt text

vertcoloursnotblending2.jpg (58.2 kB)
avatar image AlucardJay · Jul 18, 2013 at 05:56 AM 2
Share

Yeah Jessy, thanks for nothing. That was really huge of you to downvote this question, of all the stupid questions here you feel obliged to opinionate yourself on $$anonymous$$e. Sure, it was a simple mistake, but did you understand the question? No. You only downvoted after someone else gave to answer, which is now obvious to all of us. You deliberately left an opinionated vote after the correct answer was given. Way to show integrity.

Isn't that what Unity Answers is for? To help the OP see their error when they cannot? Did I provide enough information to make this a valid question? Yes. I did not even consider the shader (not being a shader programmer), but I included the link.

While you're feeling vindictive, why don't you go and find my question where I simply forgot to increment the loop variable and downvote that too. Way to exercise your power as a mod ....

Why am I pissed? Of all the stupid (yes stupid) questions that were on the same page as this one, $$anonymous$$e got downvoted.

Stuff this 'site and all the idiots that dwell within. No wonder there are no pros here

avatar image AlucardJay · Jul 21, 2013 at 10:20 AM 0
Share

What I find inane is you think you have a point. Read the question, read the comments, regardless of my apparent shader faux pas, the colours are very 'polarized' around the vertex and not blended evenly along the face of the triangle.

There is a big difference between reading something and comprehending something, a simple concept which you don't seem to understand.

You're welcome to have at it, there's the link to my profile right at the end of the comment.

If you have nothing constructive to say, why are you here?

You should have a serious think about that, while the rest of us continue with actually helping people.

avatar image Jessy · Jul 21, 2013 at 11:35 PM 0
Share

Again, I have no idea what you're talking about. You complain about stupid questions, then say that yours are the stupid ones? It does not make sense. You are bad at communicating ideas. There was a time, before the majority of users were people who do what you're doing, that this site was useful.

Show more comments

1 Reply

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

Answer by Kiloblargh · Jul 17, 2013 at 04:01 PM

From the linked page:

Both shaders allow for overbrightening, so using (.5, .5, .5) as vertex color values results in 100% brightness, and values above that brighten the texture accordingly, as shown by the VertexColorUnlit shader:

Meaning, you need to adjust your original colors to be half as bright to not blow out the highlight, or modify 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 Kiloblargh · Jul 17, 2013 at 04:06 PM 3
Share

I think the only modification you have to make to the shader to get it to render properly is delete the word DOUBLE from the combine line.

avatar image AlucardJay · Jul 17, 2013 at 04:42 PM 0
Share

Thanks, I feel silly for missing that. Sometimes I cannot see what's right in front of me, and I admit all I read was that the shader was by Eric, so I assumed it would just work as I expected. I don't understand shaders, so your fix really helped (removing DOUBLE). Thanks for showing me and helping me understand what I could not see (or fix if I could).

avatar image AlucardJay · Jul 18, 2013 at 07:31 AM 0
Share

Ok, now that is resolved, and I have changed the vert windings on the quad, I believe I still have the initial problem.

The colour is not blending incrementally/smoothly across the face of the triangle.

Here is the updated build : http://www.alucardj.net16.net/unityquestions2013/ColourPicker.html

And a comment on my forum post : http://forum.unity3d.com/threads/190968-$$anonymous$$aking-a-Colour-Picker?p=1301404#post1301404

Lookin good, but whats in the top right box doesn't quite appear to be the same shade as selected in all cases, try a dark blue, middle of the box

This is true, here is an image :

alt text

I'm about to try my initial idea of changing the quad to a plane, with more vertices to blend colours between. Do you have any suggestions? Is this a 'shader thing'? Should I try and find a better Unlit Vertex Shader?

vertcoloursnotblending3.jpg (41.7 kB)
avatar image AlucardJay · Jul 18, 2013 at 10:04 AM 0
Share

As you can see, when I use a plane the colours have an even spread :

alt text

vertcoloursnotblending4.jpg (201.5 kB)

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

16 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

Related Questions

Need help with using world position in shader 1 Answer

Vertex Color to Texture2D?? 0 Answers

Colors do not work with a mesh created in script? 3 Answers

How to assign different colorsets to objects that are using the same mesh? 0 Answers

how to remove vertices of a certain colour range from a mesh? 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