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

Author Topic: Blurred text at non-integral coordinates  (Read 16177 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Blurred text at non-integral coordinates
« Reply #15 on: September 19, 2010, 04:23:58 pm »
Quote
In my opinion, a user-side solution covering the most artifacts would be okay. Maybe something like the proposed PixelPerfectDraw(), but without undefined behaviour

You're probably right, there are some problems that can never be solved in an elegant way.

Quote
Do you know how other graphic libraries handle this issue?

"Old" 2D libraries like SDL and Allegro handle pixels, there's no decimal coordinates and thus no problem at all. But I suppose that they have the same problems with continuous transformations.

I've never tested other libraries that have decimal coordinates, I should probably do.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Blurred text at non-integral coordinates
« Reply #16 on: September 19, 2010, 04:45:40 pm »
A spontanous idea I just had (probably not a very good one, but I thought I'd tell it anyway :D):

What do you think about
Code: [Select]
RenderWindow::Draw(const Drawable& drawable, bool pixelPerfect = false);
You could write in the documentation the truth: If the user wants drawable objects to be aligned at full pixels, even if coordinates aren't integral, pixelPerfect shall be true. If he rather wants objects to move smoothly, taking into account that they look slightly different depending on the coordinate, pixelPerfect has to be false.

I'm not too good at formulating docs, but this would be the smallest problem. The implementation might be similar to the one in revision 1389, with the overall rounding applied...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Blurred text at non-integral coordinates
« Reply #17 on: September 19, 2010, 04:54:05 pm »
This is not a bad idea, but I don't know if it's enough. Maybe users will want to set it once globally for all drawables, or once for a single drawable rather than at every Draw.

And I don't know if real use cases are as obvious as our minimal examples. I will probably not be clear whether this attribute must be used or not, in real situations.

What's your opinion?
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Blurred text at non-integral coordinates
« Reply #18 on: September 19, 2010, 05:10:13 pm »
Quote from: "Laurent"
What's your opinion?
I agree, it's hard to find out only by reflecting. Maybe you should try it out for some time and announce it in a thread, so that you get feedback from many SFML users. ;)

In my opinion, it's better to test such things now than later, when SFML 2 is released and you have to change the API.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

The DarK'

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Blurred text at non-integral coordinates
« Reply #19 on: September 19, 2010, 06:07:14 pm »
IMHO I think the best solution is like the smooth filter. SetSmooth/SetPixelPerfect.

Or better, SetSmooth(bool smooth, bool pixelPerfect = false);.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Blurred text at non-integral coordinates
« Reply #20 on: September 19, 2010, 06:16:59 pm »
Quote from: "The DarK'"
IMHO I think that the best solution is like the smooth filter. SetSmooth/SetPixelPerfect.
The smooth filter only applies to sf::Image in specific, while pixel-perfect rendering concerns all drawables. And I'm not sure whether sf::Drawable is the right place for such a function, hence my alternative suggestion for sf::RenderWindow...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Wollnashorn

  • Newbie
  • *
  • Posts: 3
    • View Profile
Blurred text at non-integral coordinates
« Reply #21 on: September 20, 2010, 12:29:56 am »
You could simply deactivate the linear filter for the font texture.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Blurred text at non-integral coordinates
« Reply #22 on: September 20, 2010, 07:59:30 am »
Quote from: "Wollnashorn"
You could simply deactivate the linear filter for the font texture.

It would make text ugly when scaled. Anyway, the problem is not only for text, but for all drawables.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Blurred text at non-integral coordinates
« Reply #23 on: September 21, 2010, 09:07:36 am »
I tested ClanLib 2, and it seems to have the same issue, decimal coordinates produce blurry items. However, I couldn't find a single user complaining about that on their forums.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Blurred text at non-integral coordinates
« Reply #24 on: September 23, 2010, 07:10:47 pm »
Thank you for the effort.

Quote from: "Laurent"
However, I couldn't find a single user complaining about that on their forums.
Maybe I'm really the only one who isn't completely satisfied with the current solution. That's why I suggested to ask more SFML users... ;)
On the other side, do the SDL and Allegro users complain about the pixel-perfect rendering?

By the way, I don't want to hurry, just take your time. It's far better to decide carefully. The topic isn't very urgent, especially as I currently use the shown partial workaround.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Blurred text at non-integral coordinates
« Reply #25 on: October 03, 2010, 11:14:19 am »
Quote
Maybe I'm really the only one who isn't completely satisfied with the current solution

No you're not. I'm not too, and I'm sure that a lot of users will complain when SFML 2 is used more widely.

Quote
On the other side, do the SDL and Allegro users complain about the pixel-perfect rendering?

I don't know. Their users are probably ok with pixels, and don't even think about having a finer rendering resolution.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Blurred text at non-integral coordinates
« Reply #26 on: October 04, 2010, 09:52:31 pm »
Okay, thanks. If there should be any news, keep us informed ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything