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

Author Topic: Antialias polygon edges.  (Read 6248 times)

0 Members and 1 Guest are viewing this topic.

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« on: April 05, 2011, 10:49:27 pm »
Is there a way to anti alias polygon edges? Right now when I draw my tiles they look great other than when the camera moves; the edge pixels cant decide what pixel to draw on so they "flash" on and off of adjacent pixels and its very unattractive.

My current solution was to set everything to smooth and create a transparent border around all of my images such that the edges of the polygons are invisible so you cant see them regardless. This works great for my dynamic objects, however I have yet to come up with a graceful solution for my tile sets. Any ideas?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Antialias polygon edges.
« Reply #1 on: April 05, 2011, 10:58:15 pm »
Can you show a screenshot of what you describe? I'm not sure it would help, but you can try enabling anti-aliasing.
Laurent Gomila - SFML developer

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« Reply #2 on: April 05, 2011, 11:19:48 pm »
A screenshot wouldnt effectively show what I'm describing. Its really only noticeable when the camera is moving slowly. Turning anti aliasing on didnt seem to change anything. The best way to describe it is that the edges of the polygons cant decide which pixel they want to be drawn on. I have the same problem with the texture pixels inside the poly until I turn set smooth on.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Antialias polygon edges.
« Reply #3 on: April 06, 2011, 08:00:36 am »
Are you using SFML 1.6?
Laurent Gomila - SFML developer

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« Reply #4 on: April 06, 2011, 12:08:15 pm »
No-- 2.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Antialias polygon edges.
« Reply #5 on: April 06, 2011, 12:12:25 pm »
A recent one? That shouldn't happen.
Laurent Gomila - SFML developer

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« Reply #6 on: April 06, 2011, 01:06:18 pm »
Maybe two months old?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Antialias polygon edges.
« Reply #7 on: April 06, 2011, 01:32:46 pm »
Hmm should be ok.

Maybe you could show me a simple source code that I can test, or even send me a precompiled executable?
Laurent Gomila - SFML developer

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« Reply #8 on: April 06, 2011, 02:37:44 pm »
I uploaded the executables. There is one with smoothing and one without. Use 'A' to move left, 'D' to move right and 'J' to jump. Again, its most noticeable when the camera is moving small distances.. So jumping is probably the easiest way to see it.

The one without smoothing is pretty bad. You see it everywhere. The edges of the character, the edges of the tiles, the little squares in the tile texture... its bad. Everywhere.

I figured I'd just up the res of my images and set smoothing for an easy fix. This eliminates a lot of the problem. Its only noticeable at the edge of a polygon now. This is why I thought antialiasing might help. Turning antialiasing on didnt seem to do anything so im assuming my machine doesnt support it...

Anyway, take a look at this and let me know what you think. I could be doing something terribly wrong??

http://www.megaupload.com/?d=63UF7707

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Antialias polygon edges.
« Reply #9 on: April 06, 2011, 03:16:05 pm »
Your game looks really cool, seems like there are interesting things to do with the physics :)

I need to do some tests to figure out why edges are not smoothed when they fall between two pixels, I'll do that as soon as possible.
Laurent Gomila - SFML developer

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« Reply #10 on: April 27, 2011, 01:29:04 am »
Just wondering if there is any progress on this issue.

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
Antialias polygon edges.
« Reply #11 on: April 27, 2011, 03:10:06 am »
This is an inevitable result, because you are drawing the edges of a texture. For example, if you've a 16x16 bitmap, and want to draw entire bitmap with antialias, you must use a 18x18 bitmap (16+2 x 16+2) with original image in the center, and must use a source rectangle (x=1,y=1,width=16,height=16). There's no way to do antialias in a texture bounds, because there's no color info outside of texture limits.
This issue exists in various game engines, and could be useful for some effects if you know how to use it for your benefits.

Offtopic:
   Are you the creator of Ogmo Editor? :D
   I Love the global idea, the generic mecanism based on xml predefinitions is so great! (the map editing features of Tiled, mix with the predefinition features of ogmo editor, could be THE PERFECT map editor!)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Antialias polygon edges.
« Reply #12 on: April 27, 2011, 07:41:36 am »
Quote
Just wondering if there is any progress on this issue.

Not yet, sorry.
Laurent Gomila - SFML developer

vidjogamer

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Antialias polygon edges.
« Reply #13 on: April 30, 2011, 04:46:53 am »
Quote from: "NinjaFighter"


Offtopic:
   Are you the creator of Ogmo Editor? :D
   I Love the global idea, the generic mecanism based on xml predefinitions is so great! (the map editing features of Tiled, mix with the predefinition features of ogmo editor, could be THE PERFECT map editor!)


Haha no I am not. I was using ogmo for level creation and so I was just using the prepackaged tiles for testing my tile engine.

I do agree that the predefinition feature is very nice. As a developer I like to be able to restrict the editor to only engine supported features for non developer use.

Tiled is amazing as well. The editing features are just fantastic and its really matured over the years.

I have since switched over to DAME (http://dambots.com/dame-editor/). DAME is feature rich. It has a lot of the features that make Tiled so appealing. Tile brushes, dynamic properties, etc.. but in addition supports in-editor parallax scrolling and scripted exporting via lua so you can make your level file meet your exact specifications. The only downside I have with it so far is that it gets a little laggy sometimes.

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
Antialias polygon edges.
« Reply #14 on: April 30, 2011, 05:38:22 am »
:o  I has never seen this program before, looks great! Thanks for the info!

 

anything