Open berightben opened 2 years ago
One wise man says: it is not a bug, it is a feature
The difference between "medium" and "simple" is not a bug. This is perfectly normal. You will get a similar result with a quad with colored vertices in Blender. This is because 2 triangles are used to draw this. The result you are expecting in "medium" is from an image editor which does not exploit vertices from 2 triangles to render using vertex interpolation alone.
If you want a result like "medium" you may use a shader in which you do the interpolation in the fragment function (something like mix(mix(color1, color3, UV.y), mix(color2, color4, UV.y), UV.x)
), or have more subdivided triangles with pre-blended colors (applying the expected result to specific positions and have the triangulation fill the gaps approximately), or use a texture maybe.
Now the "observed" behavior... you have even different colors there. Is that comparable? Is your problem the presence of a color you did not want? Or is it the discrepancy between "medium" and "simple"? Either way, the way gradients spread is caused by triangulation, and is pretty much normal with such approach.
Update for colors comparison:
expect
observed *I try to match the color
So it looks to me you just want to control in which orientation the triangulation occurs. I'm not sure if that's possible with Polygon2D. There is MeshInstance2D but it is Unity-style-kinda-meh (needs 3D vertices set into a mesh to then be flattened to 2D).
You might be able to get the triangulation you want with custom drawing, with draw_primitive
maybe. Or you could rotate the polygon.
Godot version
Godot 3.3.stable, 3.4.stable
System information
Windows 8.1 x64, GLES2, GLES3, Nvidia Geforce650M(425.31)
Issue description
The visual behavior of color vertex in Polygon2D is inconsistent, Weird visual behavior can be seen with simple square, with 4 different color in each corner of Polygon2D. See the example below:
Expected behavior:
Observed behavior: *notice overlapping dominance of certain color.
It is however extremely noticeable in common shape with higher number of vertexes. The cases can be seen in the example below: *for some reason color from vertex[0] (top left) has special behavior
I had tested it in other OS (popOS godot 3.3.4), it behaves the same way. I think it has something to do with how Polygon triangulation behave, and how vertex color is represented within the triangulation.
Steps to reproduce
Minimal reproduction project
debug_gradient_godot3.3.zip