- Home /
Vertex colours not blending across triangle face
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 :
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.
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
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.
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.
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.
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.
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).
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 :
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?
As you can see, when I use a plane the colours have an even spread :
Your answer
Follow this Question
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