godot-demo-projects/2d/polygons_lines
Hugo Locurcio 78bbd99f0d
Add a 2D polygons and lines demo
2024-06-25 18:09:34 +02:00
..
screenshots Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
README.md Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
icon.webp Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
icon.webp.import Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
line_10px.png Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
line_10px.png.import Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
line_30px.png Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
line_30px.png.import Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
polygons_lines.gd Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
polygons_lines.tscn Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
project.godot Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00

README.md

2D Polygons and Lines

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

Screenshots

Screenshot