-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add "universal" anti-aliasing in 2D (MSAA and/or SSAA) #1297
Comments
You mention stars in a background, however it's important to know what rendering technique you refer to. I'm not sure if MSAA works with pixels of textures, only polygon edges (quads that make up sprites, lines etc), doesn't it? |
Do we want to be able to use different MSAA levels in 2D and 3D in the same viewport? For instance, if you want lines to always be smooth but can't afford using MSAA in 3D for performance reasons.
Individual rects are considered polygons, but a single texture with stars inside will be a single polygon. Therefore, MSAA won't be able to smooth out the insides of a texture. |
I discussed some approaches for implementing here. godotengine/godot#40866 |
Eventually it will be nice to support SSAA which would fix the texture issue. But for now we should set the precedent of anti aliasing settings to be both 2D and 3D |
@nathanfranke SSAA is already supported. See the 3D viewport scaling demo (which can also apply to 2D the same way). Keep in mind it has a significant performance cost though, making it less than ideal for 2D rendering. There are usually better ways to solve aliasing compared to a brute-force approach (except for offline rendering where quality is your primary goal). |
I couldn't figure out a way to use this on a 2D project, the image outputted was only 1/2 my resolution. |
@kCenk I got it to work. Did you enable filtering in Viewport texture -> resource? |
@nathanfranke TextureRect Flags? I did set it to 4, texture_rect.texture.flags = 4 |
Rotated Sprites and TextureRects will always have staircase edges, regardless of any project or import settings: This is especially problematic for cardgames. Exampe: Only workaround I found was to use Polygon2D instead of Sprites and TextureRects, enable the "antialiased" property and assign it the texture. |
@golddotasksquestions There are two other ways to solve it:
|
For rotated sprites, there should definitely be a MSAA option for 2D (Or just making the current option work for 2D). As for anti-aliasing within textures of sprites, this can only be solved with SSAA (MSAA doesn't help with textures anyways). I propose an option next to MSAA for SSAA. I think this is a bit nicer than the viewport workaround. |
I have a very simple way to achieve this anti-aliased line: // in overrid _Draw() , don't forget call Update() in _Process()
Smooity.DrawLine(this, new Vector2[] { Vector2.Zero, GetLocalMousePosition() }, Colors.White, 0.5f); Is no problem over here? Unfortunately not:
|
@endlesstravel Edit: I see that in |
In |
This comment was marked as off-topic.
This comment was marked as off-topic.
@hazarek Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@hazarek The vast majority of contributors to this project are doing so out of their own spare time for free. It is impossible to fix every issue in a small amount of time. The only way to speed up this issue is either solving it yourself, hiring someone who can, or donating to the project so the maintainers can hire someone themselves. (Edit: No further responses). |
This problem has existed for at least 6-7 years as far as I know. It's really pathetic to blame the users instead of apologizing to users. |
I released an add-on for better 2D line and polygon antialiasing in Godot 3.x. Check it out 🙂 |
Implemented by godotengine/godot#63003. |
Can we get this backported to 3.x, should I open a different proposal for that? |
godotengine/godot#63003 doesn't include the GLES3 part anymore (as per godotengine/godot#63003 (comment)), so @Geometror would have to make it available again somehow so this can be backported for I don't think you need to open a separate proposal – backports of fully backwards-compatible functionality are something anyone can work on. |
Hi, sorry to comment again this closed issue, but I have two things to say :
I made an HD layer with a canvaslayer for my game, but the graphics are not so great because of this issue with MSAA Not sure this is the good place to ask, but if anyone can tell me it could be great. |
It's technically possible to reimplement this in 3.x, but it's a lot of work – you can't just copy-paste code and expect it to work, even for GLES3. Also, nobody among the core contributors is available to do this work.
If graphics appear smoother on a viewport, it's because you're downsampling it somehow (e.g. because you're using the
Are you sure the visual issue is because you don't have access to MSAA in 2D? Can you post a screenshot here? What's your project's base window size, and which stretch mode are you using? |
Old Issue: godotengine/godot#12840
See above issue for previous discussion
Describe the project you are working on:
Any project
Describe the problem or limitation you are having in your project:
In some instances aliasing is very clear to see. It would be optimal to make AntiAliasing work in 2D.
For example, background stars in a space game that are the size of only a few pixels.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
AntiAliasing settings should work in both 2D and 3D. (Even if eventually we add FXAA, SSAA, etc.)
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

Ideally, this would work with the already existing
rendering/quality/filters/msaa
project setting.If this enhancement will not be used often, can it be worked around with a few lines of script?:
This setting will be used often, but it also cannot be worked around easily.
Is there a reason why this should be core and not an add-on in the asset library?:
This is a core renderer problem so unlikely to be solved in an add-on.
The text was updated successfully, but these errors were encountered: