Dolphin, the GameCube and Wii emulator - Forums

Full Version: Antialiasing still broken
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
Man, you hold gold above your shoulders, do you know that? Really appreciated, let me read this now ^^

EDIT: Thank you very much for this, I'll keep an eye on your site. If you keep writing I'll keep reading from there Big Grin Your explanations are usually better than the others.
SSAA is the simplest method. It fixes aliasing by rendering the scene at a higher resolution then downscaling (averaging the color of each block of pixels to create the color of a single pixel) to a lower resolution. With 4xSSAA you're rendering 4 pixels for each pixel drawn to screen space. The pixels you are rendering with SSAA are called subpixels (a pixel within a pixel) and the word pixel refers to the output after downscaling. The idea is for each of those edge pixel we would actually render 4 subpixels, some would be bright red, some would be black. When they get averaged together by the box filter (the code which performs the downscaling/averaging/whatever you want to call it) we wind up with one dark red pixel, an average of all the color information. The more pixels you render for each output pixel the more accurate the resulting color will be since as the triangle picture shows you can have 4 samples for 1 pixel and even if the edge is covered about half/half between the two objects 3 of the 4 samples might still land on one of the two objects and only 1 sample on the other object. The more samples you have the less likely you are to run into a significant inaccuracy. Keep in mind the more diagonal an edge is the more likely this is to happen. Aliasing doesn't happen on perfectly horizontal or vertical edges because even those the pixels will be filled with either bright red or black in our example they will ALL be filled with the same color along that edge, so even though it's the wrong color there won't be any stair steps which come from alternating colors along the edge.

SSAA can be implemented one of two ways. With one additional framebuffer or multiple additional framebuffers. Once again I need to make an example so you can understand. Let's say we want to render a 1280 x 1024 image with 4xSSAA.

We can either create a 2560 x 1056 framebuffer (double the width and height, 2 x 2 = 4 times the resolution) and then average each block of 2x2 pixels into 1 pixel to fill another, 1280 x 1024, framebuffer.

Or we can create 4 1280 x 1024 framebuffers and render the scene at that resolution 4 times. With each pass we apply a different sample coordinate offset. So for each corresponding pixel in each buffer although it is the same pixel it's sample was taken from a different spot inside the pixel's coverage (the area of geometry that the pixel covers).

Images coming soon.
Man, this is insane. I mean, I knew that this was a complicated process, but now I understand what it is doing, for each pixel that will be antialiased in every frame... Now I see why this is so hardware consuming...
So, there is something there is bugging me since I started to read about this... The thing is, how does the antialias find what is an edge and what isn't? Cause after the frame is rasterized, its just a bunch of pixels right? it must be done before rendering, which makes sence to what you've explained so far, but then how can the program know what to antialias? We certainly can't antialias an entire 3D object from every possible angle at once, and antialiasing is done at the time of rendering, right?
Because I was thinking, every frame we see is merely an interpretation of what is there right? I mean, if we have a tree like x ft away from the camera, it will be rendered with a certain number of pixels. But if the same tree is 2x ft away from the camera, less pixels will be used to render it, so it will be more aliased. So, What is more far would need more antialiasing?
(07-26-2011, 04:03 AM)Runo Wrote: [ -> ]Because I was thinking, every frame we see is merely an interpretation of what is there right? I mean, if we have a tree like x ft away from the camera, it will be rendered with a certain number of pixels. But if the same tree is 2x ft away from the camera, less pixels will be used to render it, so it will be more aliased. So, What is more far would need more antialiasing?

Yup. That's easy with Dolphin, just try it out yourself.
Quote:So, there is something there is bugging me since I started to read about this... The thing is, how does the antialias find what is an edge and what isn't? Cause after the frame is rasterized, its just a bunch of pixels right? it must be done before rendering, which makes sence to what you've explained so far, but then how can the program know what to antialias? We certainly can't antialias an entire 3D object from every possible angle at once, and antialiasing is done at the time of rendering, right?

Uh....no. It doesn't "know" where the aliasing is. It anti-aliases EVERY pixel, whether it's on an edge or not. With 4xSSAA for example for every output pixel 4 pixels are rendered and averaged. If those 4 pixels aren't from an edge the resulting color will usually be the same as if you had just rendered one pixel (depending on the texture resolution). Thus you just wasted a bunch of processing power rendering extra pixels that you didn't need to. But you do this because you have no way of finding an edge with SSAA so you just have to do it with every pixel since that is guaranteed to fix the edge pixels. Some edge detect algorithms do exist, but they are not common and they tend to be even less efficient, demanding huge amounts of processing power to work and only being beneficial when large sample counts are used.

Quote:Man, this is insane. I mean, I knew that this was a complicated process, but now I understand what it is doing, for each pixel that will be antialiased in every frame... Now I see why this is so hardware consuming...

From what I understand computer science is all about taking complex tasks and reducing them all the way down to simple arithmetic operations, since at the lowest level that's all a computer can do, it's essentially just a glorified calculator. And this means for complex tasks with lots of data you need to run a lot of code over and over.

And yes you are right about your "distant objects are more likely to have aliasing" theory.
(07-26-2011, 04:51 AM)NaturalViolence Wrote: [ -> ]Uh....no. It doesn't "know" where the aliasing is. It anti-aliases EVERY pixel, whether it's on an edge or not.

What? I never noticed this. Shouldnt this, for example, make low res textures smoothier too then? It would make everything that has more then one color antialiased on the color edges... Does it? I could swear it only affected edges, all these years...
(07-26-2011, 05:10 AM)Runo Wrote: [ -> ]
(07-26-2011, 04:51 AM)NaturalViolence Wrote: [ -> ]Uh....no. It doesn't "know" where the aliasing is. It anti-aliases EVERY pixel, whether it's on an edge or not.

What? I never noticed this. Shouldnt this, for example, make low res textures smoothier too then? It would make everything that has more then one color antialiased on the color edges... Does it? I could swear it only affected edges, all these years...

It affects everything, just edges are a lot more noticeable.
meh...
It depends what kind of AA you're talking about. Super sampling is just rendering a massively inflated resolution of the image you're looking at and then downsampling with specific techniques and algorithms to achieve a cleaner look, most notably on aliasing. There are other techniques that look at edges, they're less resource intensive and more specific. Consoles aren't setup to always do 2x or really never 4x a game's resolution so they chiefly use other methods though I think pretty much all games are going away from super sampling even on pc because it really saps your power.

SSAA does make other things look better though. If you're zoomed in on a low resolution texture it won't do much, but for anything higher resolution or perhaps far away, it'll clean it up some, yes. I'm kind of getting a bit far into the subject considering what I actually know lol, so while I think that all should be pretty much good info, feel free to correct me.
Quote:What? I never noticed this. Shouldnt this, for example, make low res textures smoothier too then? It would make everything that has more then one color antialiased on the color edges... Does it? I could swear it only affected edges, all these years...

SSAA improves textures as well.

MSAA does not. MSAA takes one texture sample per pixel which is used by all of the samples of that pixel. MSAA was a genius method that somebody figured out of anti-aliasing an image without rendering additional pixels. MSAA does run on every pixel though. But the only pixels that will actually change color will be edge pixels.
Pages: 1 2 3 4 5 6 7