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

Would it be possible to adjust the anti-aliasing level for the display ? #23

Open
maiaaan opened this issue Oct 6, 2023 · 4 comments
Open
Labels
About GAML This issue concerns the GAML language 🤗 Enhancement This is a request for enhancement

Comments

@maiaaan
Copy link

maiaaan commented Oct 6, 2023

Is your request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I wanted to apply anti-aliasing on all the images displayed. First, I used the function antialiased(). However, there is no parameter in the function to adjust the level of anti-aliasing, so the function has to be applied several time for the desired level of aliasing which is impractical and can quickly become unreadable. In the same way, in the default rendering properties settings, it is not possible to adjust the level of anti-aliasing.

Describe the improvement you'd like
A clear and concise description of what you want to happen.

  1. A parameter that allows to adjust the desired level of anti-aliasing in the antialiased() function.
  2. A parameter that allows to adjust the desired level of anti-aliasing in the default rendering properties settings.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@AlexisDrogoul
Copy link
Member

Hi -- there is no such thing as a "level of antialiasing" or at least not really.

For individual images, antialiased corresponds to the application of a light blur convolution mask. So what you are doing is correct : applying x times the mask will progressively soften the image. If you find it more convenient than repeatedly calling this operator, I can provide an alternative operator with a second parameter (the "level", which would the number of times you apply it). For instance: im2 <- antialised(im1, 5);.

In that case, I should also provide it for blurred and sharpened (and maybe add a percentage to brighter to be aligned with darker), as they obey the same principle.

Regarding antialiasing the display, it is more delicate. In Java2D, antialias is on or off (no levels), and it comes accompanied by options (quality of sampling, resizing, etc.) which sometimes have levels, sometimes have not. So basically, setting antialias: to true means more or less "use the best quality to render a crisp image". In OpenGL, it's even more complicated as some platforms will not implement some aspects of antialiasing, so we set all options to true in the settings -- and there are no real levels unless we implement them using shaders ...

So the only (cheap but fast) solution is to implement the image operators above. What do you think ?

AlexisDrogoul referenced this issue in gama-platform/gama.old Oct 7, 2023
Implemented for antialiased, blurred and sharpened
@maiaaan
Copy link
Author

maiaaan commented Oct 9, 2023

Yes, it seems to be a good solution to add a parameter indicating how many times to apply the mask.

@lesquoyb
Copy link
Contributor

The new operator seem to work, however I found an edge case where I'm not sure the antialiased function is doing the right thing:
if used on images containing transparent pixels, the operator will add transparency everywhere, while in my opinion of some pixels are purely transparent they should completely be excluded from the algorithm.
Example with this model:
image
the hand is an image the size of the world with most of it's content being transparent pixels, so I can create a complex stack of image layers. But if I use the antialiased operator on it I end up getting this (here with 200 repetition but it obviously already shows unwanted effects with lower values):
image

@lesquoyb
Copy link
Contributor

lesquoyb commented Dec 6, 2023

I think it's safe to say that the main request has been answered and the point I raised is secondary and will be done in next release

@benoitgaudou benoitgaudou transferred this issue from gama-platform/gama.old Feb 21, 2024
@lesquoyb lesquoyb added 🤗 Enhancement This is a request for enhancement About GAML This issue concerns the GAML language labels Mar 22, 2024
@lesquoyb lesquoyb removed this from GAMA 2024-11 Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
About GAML This issue concerns the GAML language 🤗 Enhancement This is a request for enhancement
Projects
None yet
Development

No branches or pull requests

3 participants