Hugo Locurcio 78bbd99f0d Add a 2D polygons and lines demo | 5 місяців тому | |
---|---|---|
.. | ||
screenshots | 5 місяців тому | |
README.md | 5 місяців тому | |
icon.webp | 5 місяців тому | |
icon.webp.import | 5 місяців тому | |
line_10px.png | 5 місяців тому | |
line_10px.png.import | 5 місяців тому | |
line_30px.png | 5 місяців тому | |
line_30px.png.import | 5 місяців тому | |
polygons_lines.gd | 5 місяців тому | |
polygons_lines.tscn | 5 місяців тому | |
project.godot | 5 місяців тому |
A demo of solid and textured 2D polygons and lines using Polygon2D and Line2D.
In this project, solid Line2Ds are antialiased by using a specially crafted texture. By using a texture that is solid white on all its pixels except the top and bottom edges (which are fully transparent white), the border appears smooth thanks to bilinear filtering. A more extensive variation of this concept (which works better with variable-width lines) can be found in the unofficial Antialiased Line2D add-on.
2D multisample antialiasing (MSAA) is also supported when using the Forward+ and Mobile rendering methods. This is a slower approach, but it works on all 2D drawing performed within the viewport, including Polygon2D nodes or custom drawing. This approach can be used at the same time as the aforementioned Line2D antialiasing technique.
Language: GDScript
Renderer: Mobile