Why are my simple triangles sometimes very jagged? (screenshots inside)

Started by
4 comments, last by Matt Aufderheide 16 years, 10 months ago
I'm trying to draw a bunch of triangles (using a Delphi DirectX v9.0 wrapper called Asphyre) and I noticed that sometimes my triangles are very jagged. It seems like the triangle is more or less jagged depending on the angles used to create the triangle. What is causing this and how can I smooth it out? Here are three examples: Both sides are jagged: Only the right side is jagged: No sides are jagged (everything is smooth) EDIT: These forums use regular HTML 'img' tags to include images in forum posts... [Edited by - jollyjeffers on June 13, 2007 8:36:37 AM]
Advertisement
Looks like a standard case of spacial aliasing. I'm sure you've heard of MSAA - "Multisample Anti-Aliasing"? Gamers love it [smile]

As a test, go into your GPU's control panel and set it to force a level of MSAA on your application, 2x or 4x should be sufficient. Most hardware and drivers of the last few years will have an override capability.

Once this is done, re-run your app and see if it's improved. Assuming it has, do some reading on MSAA and set up your application to request it be enabled on start-up [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Thanks for the information...

It just seems like a lot of games I play don't require turning on MSAA/FSAA (are they the same thing?) in order to have the game look good. I guess it's possible they are turning on MSAA behind the scenes without telling me, but are there any tricks for not requiring MSAA/FSAA?

I've tried out every MSAA/FSAA setting on my triangle image and it definitely helps a TON. However, it seems like I need at least 4x for it to look "good".

Here is a screenshot of the image with every different antialiasing available:
http://farm2.static.flickr.com/1112/543942868_f31b4070e5_o.png
(I didn't inline the image because its fairly big [resolution, not file size])

Here is a link to the flickr page for the screenshot (for viewing different sizes of the image, etc):
http://farm2.static.flickr.com/1112/543942868_f31b4070e5_o.png

Quote:Original post by sofakng
Thanks for the information...

It just seems like a lot of games I play don't require turning on MSAA/FSAA (are they the same thing?) in order to have the game look good.

You've got pretty much the worst case for showing aliasing in your image above - a long, straight edge with high contrast. A typical game is probably much lower contrast, and when you've got lots of texture and lighting detail it'll be less noticable too.

Theres a few less heavyweight hacks you can do as well - polygon smoothing will antialias the edges of polys and is good for vector graphics, but will require sorting your polys for correct results. You may also be able to do tricks with textures and blending to remove some edges as well.
I'm planning to make a retro vector-based (that's the art style I'm going for) game so would polygon smoothing work for me?

Actually all I really want to do is render a really nice polygon to a bitmap (eg. render target/texture). After it's generated I'll just draw the texture and won't have to worry about antialiasing.

Can I do this somehow in software? (eg. enable software 8x antialiasing, render the polygon to a render target/texture, and then disable software 8x antialiasing)
you can render to a render target larger than your display resolution, then shrink it down with filtering. You could also apply a blur filter to make it softer...

This topic is closed to new replies.

Advertisement