This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Creating a "Donut" polygon, i.e., cutting a polygon out of another polygon.

rossimorossimo Posts: 1Member

What's the best way to create a 2D filled polygon with a "cut-out" shape in the middle? Like a donut, but the shapes can be arbitrary?

Answers

  • KiwoTezKiwoTez Posts: 8Member
    edited July 2019

    I'm wondering the same thing and couldn't reach a definite answer. However, this article from the docs may provide a guide. It has an example in which a drawing function is defined. Maybe similar functions can be defined for other polygons? Or maybe it can be told only to draw an intersection of specific areas or shapes? Please share your experiences if you happen to find an answer, I will experiment with this as well.

  • MegalomaniakMegalomaniak Posts: 2,580Admin

    Well, as you might be aware gpu's only really draw(rasterize) triangles so you obviously wont be able to then cut one triangle out of another as a hole, at least not without producing more than one triangle surrounding the hole.

    In terms of fragments/pixels however it is possible to do pixel processing so that one triangles rasterized fragments would mask off a portion of another.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.