Skip to content
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

Polygon2D node not configured for AA as of 3.1 #26823

Closed
insomniacUNDERSCORElemon opened this issue Mar 9, 2019 · 9 comments · Fixed by #33857
Closed

Polygon2D node not configured for AA as of 3.1 #26823

insomniacUNDERSCORElemon opened this issue Mar 9, 2019 · 9 comments · Fixed by #33857

Comments

@insomniacUNDERSCORElemon
Copy link

insomniacUNDERSCORElemon commented Mar 9, 2019

EDIT 2: I've discovered this issue is caused by changes to scene/2d/polygon_2d.cpp, changes introduced in a 2018 May commit by reduz (skeleton for 2D WIP).

Before (line 200):

VS::get_singleton()->canvas_item_add_polygon(get_canvas_item(), points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID(), RID(), antialiased);

After (line 277):

VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());

Aside from the obvious lack of the antialiased option in the newer line, it's also using canvas_item_add_triangle_array which was also used before 3.0, and there are 3 of the get_singleton lines that look like they should have all options.

Tacking antialiased to the existing lines doesn't work (it will actually break them in 2 of the 3, even if set to false instead). Just replacing all 3 lines with the older line does bring AA back, but obviously that breaks the 3.1 changes.

I suspect that reduz configured the 3.1 polygon2D node specifically for character animation (skeletons and internal vertices) whilst thinking 3.0's AA was flat broken (like I've said elsewhere, it works with disabled HDR and/or setting 2D framebuffer allocation), so it's not exactly a regression and I'm guessing things would need to be at least slightly reworked for AA to work with reduz' changes.


EDIT: Still present as of 3.2 alpha 3. AA enabled via gdscript drawing works fine, so it seems to be just the checkbox in the editor that is broken.


(below is the original issue info, which is less correct/relevant than the above)

It just doesn't work anymore. Tested on Linux+nVidia and W10+AMD (different hardware), so I don't think this is a compatibility issue. Also happens both with GLES3 and GLES2 renderers.

This is a regression present even in 3.1 alpha 1, so the change that resulted in this was likely made in the master branch between 3.0.6 and alpha 1. This directly relates to issue #10241 in that this issue is a regression on the progress to fulfill it... although after this issue is fixed AA will still need to be implemented on line2D for 10241 to be fulfilled.

This still affects 3.1 RC 1.

Notes:

  • AA in 3.0.6 conflicted with HDR (which was on by default). Turning HDR off in the project settings was needed for AA to work, aside from on nVidia hardware where HDR could be on if the framebuffer was explicitly set to 2D. That might be related or might need to be a separate issue (I'll make it if it still occurs after AA comes back). Inner AA seemed to still work with partially transparent shapes, so the issue with HDR and/or 3D framebuffer was likely an issue with passes.

  • AA for HTML5 in 3.0.6 didn't work at all, and I have no idea about MacOS, iPhone, Android, Blackberry etc.


Hopefully this is an accidental breakage, but I can understand if this cannot be fixed until the renderer is adapted to use Vulkan. And it's somewhat made better by the fact that 3.0.6 can still be used, albeit while missing features/fixes.

This issue is also related to (less important) issue #25120 in that both related to polygonal art.

@akien-mga akien-mga added this to the 3.2 milestone Mar 9, 2019
@starry-abyss
Copy link
Contributor

For me it never really worked in 2D (#12840)
But there were some workarounds which helped: https://www.reddit.com/r/godot/comments/8v90z9/polygon2d_antialialiasing_smoothing_msaa_shader/

@insomniacUNDERSCORElemon
Copy link
Author

@starry-abyss you may notice I'm in that thread, I suggested 2 workarounds there (1 seen in OP's edit and another in the comments which they noted but never added) and I've noted both of those here.

As I said in the issue description, if this is fixed I'll open a dedicated bug for that if it still persists. Sure it wasn't working out-of-the-box, but it least it was able to work.

@Jummit
Copy link
Contributor

Jummit commented Apr 18, 2019

This is also quite annoying for people working in VisualScript, since it looks extremely ugly now.
I also hope this was just an accident, since I want it back as soon as possible.

@Calinou
Copy link
Member

Calinou commented Apr 18, 2019

It works for me in GLES3, but not in GLES2 (where it was likely never implemented).

GLES3

image

GLES2

image

I wonder if the line drawing logic could be copied over as-is, since Godot uses triangle strips to draw wide, smooth lines.

@Jummit
Copy link
Contributor

Jummit commented Apr 18, 2019

I am not getting that behavior, neither on GLES2 nor on GLES3, not even on 2.0 or 3.0 so it must be a hardware issue, since I get AA on my other computer.
Specs:
Opengl: Mesa DRI
Processor: i5
OS: Ubuntu 18

@insomniacUNDERSCORElemon
Copy link
Author

@Calinou: testing it now, I can confirm AA is working in the visual script editor (w/ GLES3 at least), but still not in my game itself. Also not in the project viewport, although that didn't work in 3.0.6 either so that's expected.

For @Jummit, my GPU is a GTX 1050 Ti w/proprietary drivers (v418.56) on Antergos. If you're using integrated Intel graphics, then yeah I'm fairly sure AA was not working there even with the proper settings back in 3.0.6 (AMD+nVidia GPUs working fine, at least with desktop exports).

@lucaslcode
Copy link
Contributor

I'm using polygons with AA in my project in 3.1. I found that Polygon2D doesn't antialias, but using draw_colored_polygon works when I disable HDR.

@insomniacUNDERSCORElemon
Copy link
Author

Good point @lucaslcode, I can confirm with draw_line at least.

This and AA working in the VS editor likely means something with configuration is broken somewhere.

In 3.0.6 if you got things working, there was inner AA only present on partially-transparent shapes, where something done incorrectly makes it show up as an outline (or glimmer with slow-moving objects)... even if AA was broken by HDR (but not in HTML). It is possibly related/similar to that. Or, maybe the checkbox in the editor is just broken.

@insomniacUNDERSCORElemon insomniacUNDERSCORElemon changed the title Polygon2D AA broken as of 3.1 Polygon2D node antialiased checkbox broken as of 3.1 Oct 25, 2019
@insomniacUNDERSCORElemon insomniacUNDERSCORElemon changed the title Polygon2D node antialiased checkbox broken as of 3.1 Polygon2D node not configured for AA as of 3.1 Nov 13, 2019
@insomniacUNDERSCORElemon
Copy link
Author

I've discovered this is an issue with how the Polygon2D node is configured, caused by changes made by @reduz (info in top edit). I'm not sure how easily this can be fixed, but it might need someone who understands rendering (or just reduz himself).

Although if anyone could point me towards a rigged polygon skeleton2D example/template (one with dynamic motion like animations would be great), it would allow me to test how the lazy fix (pasting old lines in) works with that.

pouleyKetchoupp added a commit to nekomatata/godot that referenced this issue Nov 28, 2019
Polygon2D:
The property wasn't used anymore after switching from canvas_item_add_polygon() to canvas_item_add_triangle_array() for drawing.

Line2D:
Added the same property as for Polygon2D & fixed smooth line drawing to use indices correctly.

Fixes godotengine#26823
marstaik pushed a commit to marstaik/godot that referenced this issue Dec 24, 2019
Polygon2D:
The property wasn't used anymore after switching from canvas_item_add_polygon() to canvas_item_add_triangle_array() for drawing.

Line2D:
Added the same property as for Polygon2D & fixed smooth line drawing to use indices correctly.

Fixes godotengine#26823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants