-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Godot create an extra vertex? #49322
Comments
When you convert a Sprite to a Polygon2D Godot tries to fit the Polygon2D around the opaque parts of the image. Because the corners of the sprite are transparent, the resulting polygon is not simply a quad with 4 corners. You can see this very clearly in the docs for converting a sprite into a mesh |
Ok, now I understand the transparency and leaving that aside I can see the following: |
This is a common issue with triangles and interpolation (graphics cards work with triangles). The only way to workaround this is to use a shader that performs quadrilateral interpolation instead https://www.reedbeta.com/blog/quadrilateral-interpolation-part-1/ |
Make a square polygon instead of using convert sprite to polygon? |
The other way to work around it is to subdivide the mesh to use more internal vertices. If your mesh looks like a grid with 4 squares it will also interpolate correctly (for this texture, more detailed textures may need more subdivisions) |
Why isn't there a node to 2D (or some kind of polygon) that does the same thing krita does in the gif? |
There is, what I told you, it's just not the default in realtime rendering. |
But I don't know how to create that shader, and I will also have to add the shader to all the nodes that need it, I mean you say there is "there is" but there isn't if you don't create the shader you indicated before. |
Godot version:
3.3.2 stable mono
OS/device including version:
win10
Issue description:
When I convert a sprite to polygon2D godot creates 5 vertices: 0-1-2-3-4
I think it should create 4 vertices.
Steps to reproduce:
Convert a sprite to polygon2d with the default values.
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: