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

Author Topic: Is there any way to eliminate aliasing?  (Read 4406 times)

0 Members and 1 Guest are viewing this topic.

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Is there any way to eliminate aliasing?
« on: November 15, 2015, 01:25:53 am »
I'm already using AA=16, so there is even fonts looks a little blurry.
But when I drawing lines with RenderWindow.Draw (with PrimitiveType.Lines) and change View zoom and position, the result is still aliased. It looks very ugly and each line jumps from pixel to pixel when view position or zoom is changed.
So, how can I draw antialiased lines?
« Last Edit: November 15, 2015, 01:27:36 am by mkalex777 »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Is there any way to eliminate aliasing?
« Reply #1 on: November 15, 2015, 04:01:18 pm »
There are various workarounds, why don't you search a bit?
http://stackoverflow.com/questions/1813035/opengl-es-iphone-drawing-anti-aliased-lines
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Is there any way to eliminate aliasing?
« Reply #2 on: November 15, 2015, 09:42:06 pm »
All those solutions requires direct access to opengl functions. I'm using sfml.net and don't want to inject opengl code into my code. And all those solutions is a bit complicated. I just need to render simple line. So, why I need to implement those shaders, triangulation and complicated render code?

Ztormi

  • Jr. Member
  • **
  • Posts: 71
  • Web developer by day. Game developer by night.
    • View Profile
Re: Is there any way to eliminate aliasing?
« Reply #3 on: November 16, 2015, 11:15:52 am »
I just need to render simple line. So, why I need to implement those shaders, triangulation and complicated render code?

Yes, that triangulation approach is definitely neat but may be an overkill most of the times.
Other than that, I'm not really sure what are you expecting. Shaders are integral part of graphics programming and SFML too. There are so many ways of doing antialiasing it would be kinda pointless to include them in SFML in my opinion considering how many shader resources there are online.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Is there any way to eliminate aliasing?
« Reply #4 on: November 16, 2015, 11:29:30 am »
I'm curious, can you show the result that you get with native 16x AA?
Laurent Gomila - SFML developer

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Is there any way to eliminate aliasing?
« Reply #5 on: November 16, 2015, 09:40:25 pm »
I'm curious, can you show the result that you get with native 16x AA?

yes:


I magnified it for 4x (with no interpolation of course).
As you can see, there is difference between lines, but actually all they rendered with one call to the RenderWindow.Draw function with the same color. In action it looks much more ugly, because all these artifacts jumping from one line to another and it looks terribly, especially with black background.

PS: just tried to round vertex coordinates to integer and it definitely looks much better, but with some  specific zoom factors, aliasing still exists. I see moire effect with moving view position and zoom.

here is screenshot with integer vertex coordinates (zoom and position is different with previous screenshot, because it's changed everytime)
« Last Edit: November 16, 2015, 10:11:30 pm by mkalex777 »

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Is there any way to eliminate aliasing?
« Reply #6 on: December 02, 2015, 06:48:11 am »
It seems that AA is a problem here. Because AA=16 leads to moire effect for dynamic objects.
I can eliminate it by decreasing AA level, but it leads to aliasing.
So it seems that there is no way to render lines with no moire and aliasing artefacts... :(

 

anything