Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Antialiasing of pixel art.  (Read 4522 times)

0 Members and 1 Guest are viewing this topic.

Arch_Shift

  • Newbie
  • *
  • Posts: 6
    • View Profile
Antialiasing of pixel art.
« on: September 21, 2013, 07:09:13 am »
Let's say I have some 8x8 px pixel art, and I want to rotate and scale it. This is fine; I know how to do that. However, since it is pixel art, I can't use setSmooth(true) because it would obviously become a blurry mess. If I don't setSmooth, though, it is not antialiased, which would make it look like crap when rotated (at small sizes).

Is there any way to antialias these pixel art images without manually blowing them up in GIMP and then downscaling them to the size I need in SFML?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Antialiasing of pixel art.
« Reply #1 on: September 21, 2013, 09:09:37 am »
I don't think there is a better solution :-\
Laurent Gomila - SFML developer

Sqasher

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Antialiasing of pixel art.
« Reply #2 on: September 21, 2013, 05:57:28 pm »
There are some anti-aliasing shaders like fxaa or smaa, but I don't know if they work with SFML.

Arch_Shift

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Antialiasing of pixel art.
« Reply #3 on: September 21, 2013, 07:41:31 pm »
Should I open up an issue on GitHub? (or do you prefer them to be on this forum?)

Sqasher

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Antialiasing of pixel art.
« Reply #4 on: September 21, 2013, 09:15:15 pm »
Before you do that, have you tried setting the antialiasingLevel with sf::ContextSettings? Or does that also give you a blurry mess?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Antialiasing of pixel art.
« Reply #5 on: September 21, 2013, 09:31:21 pm »
Quote
Should I open up an issue on GitHub?
About what?

Quote
Before you do that, have you tried setting the antialiasingLevel with sf::ContextSettings? Or does that also give you a blurry mess?
Antialiasing smoothes geometry edges, not texture pixels. What smoothes pixels is Texture::setSmooth, but it is not suited to pixel art. The kind of blur that is required here is too sophisticated for the simple linear filtering that the graphics card provides; so yes, a shader might be the only solution here (but I have no idea what algorithms exist, and if there is even one that could give you the expected results).
Laurent Gomila - SFML developer

Arch_Shift

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Antialiasing of pixel art.
« Reply #6 on: September 21, 2013, 10:21:57 pm »
About what?
I was thinking of a feature request for 2.x.

Quote
I have no idea what algorithms exist, and if there is even one that could give you the expected results
I know that Allegro 5 has a multisampling setting that allowed me to antialias blown-up pixel art. I'll try and look into that and find out what I can.
« Last Edit: September 21, 2013, 10:24:19 pm by Arch_Shift »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Antialiasing of pixel art.
« Reply #7 on: September 21, 2013, 10:35:17 pm »
Quote
I was thinking of a feature request for 2.x.
What feature? "Making rotated/scaled pixel art magically look perfect"? :P
We don't know what the problem is, what potential solutions exist, we don't even know if this is technically possible. A feature request must be more precise, which requires some investigation.
Laurent Gomila - SFML developer

Arch_Shift

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Antialiasing of pixel art.
« Reply #8 on: September 21, 2013, 11:17:11 pm »
I was thinking more like "Add support for FXAA / MSAA"  :P

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6278
  • Thor Developer
    • View Profile
    • Bromeon
Re: Antialiasing of pixel art.
« Reply #9 on: September 22, 2013, 12:39:30 am »
I doubt GLSL code will be part of SFML, shaders can be implemented on user side. So you should investigate this direction, and check if it's possible to achieve what you want ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: