Hot answers tagged

116

The accepted answer is not strictly correct, although it addresses the most common usage in computer graphics. Aliasing is a fundamental concept in signal processing and the mathematical theory of it predates computer displays. It is also not really true that "it is a side effect of the fact that pixels are square". Aliasing exists any time you discretely ...


66

Adding to the other two answers, here is a more intuitive explanation of what happens. The grid squares represent pixels. The red polygon on the left is the shape being drawn, represented internally as a sequence of points. When it is rendered, it is converted from a list of points to a buffer of pixel colors. The discrete sampling determines which pixels ...


58

Is it a physical phenomena ? or numerical ? This question sorta implies to me that you don't actually know what aliasing/anti-aliasing means. I mean, you say you "know what it looks like" but if you actually knew what the terms mean, you'd probably realize your question is nonsensical. Aliasing is a side-effect of how computer graphics are rendered, and ...


20

What you're looking for is aliasing. It's little different from aliasing of hard 3d edges drawn on screen. Both come from rendering pixels too strictly, with one color or another. Antialiasing methods like mip-mapping only help blurring the edges so that intermediate colors are rendered. This can be applied to single textures but also to the whole screen. ...


19

There are several alternatives to native MSAA in OpenGL. With post-processing effects, the best thing about them is that you can usually just throw in the shader to the final, unprocessed image and it does the rest. Here are three methods worth taking a look: Fast Approximate Anti-Aliasing (Geeks3D) - Good in most cases. Pretty easy to apply and ...


14

Aliasing artifacts/moiré patterns https://en.wikipedia.org/wiki/Mipmap https://en.wikipedia.org/wiki/Aliasing


11

The second option - drawing at a higher resolution than the target and downsampling to the target resolution - is known as supersampling and is considered a form of AA; if you read about this topic you'll see it referred to as SSAA. It will almost certainly be slower than turning on other AA techniques built into modern games, such as MSAA (multisampled ...


7

With polygon-based graphics, the only option you have to better approximate a circle is to subdivide further. 720 triangles will result in a smoother circle, but 1440 will give you an even smoother circle, but 2880... A perfect circle, created using polygons, would require an infinite amount of infinitesimally small polygon sections (in other words, it just ...


6

Create a new SamplerState of your own and set it like this: mySampler.Filter = TextureFilter.Linear; mySampler.AddressU = TextureAddressMode.Clamp; mySampler.AddressV = TextureAddressMode.Wrap; mySampler.AddressW = TextureAddressMode.Wrap; The V coordinate will be wrapped (since you want horizontal repeat) and the U will be clamped.


6

You should set the sampler state to Point: graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;


6

Taking your example, you have a step function of the distance, which produces a perfectly hard (aliased) edge. A simple way to antialias the circle would be to turn that into a soft threshold, like: float distFromEdge = 1.0 - dist; // positive when inside the circle float thresholdWidth = 0.01; // a constant you'd tune to get the right level of softness ...


6

Is there any specific name for it? That flicker you are talking about is called in this certain case moiré effect / pattern. It's a form of spatial aliasing as already mentioned in other answers. However, aliasing itself can result in a lot more things than just moiré patterns.


5

There was a SIGGRAPH 2011 course on antialiasing in games, which will probably give you far more information about many more types of AA than you really want. :) When you run a typical PC game and in the options it gives you a choice of "2X, 4X, or 8X" antialiasing, it's referring to multisample antialiasing, MSAA. This stores super-resolution frame ...


5

Multisampling runs the pixel shader once per pixel, while visibility (geometry coverage, depth/stencil tests, etc.) are done per sample. The same color output from the pixel shader is replicated to all the samples that pass the visibility tests. The fact that the pixel shader is only run once per pixel is what makes MSAA faster than supersampling. In ...


5

There's lots of ways to do antialiasing. One is to use multisample antialiasing (MSAA), where your back buffer actually stores multiple sub-pixel samples, and when you render triangles, lines, etc. the system automatically fills in the correct set of samples in each pixel. Then at the end of rendering the image is "resolved" by averaging over all the ...


5

Try this in Photoshop: Make a new document. Make a new layer. It will be transparent. Delete the background layer. Your document should be all transparent now. It will look like a checkerboard. Draw the hexagon onto that transparent layer. Save this as a 24-bit PNG with transparency. Now bring that into PyGame. You may need to do some convert_alpha() ...


5

If you want to do vector graphics with OpenGL, you should do taht in shaders. E.g. gl_FragColor = ( length(gl_FragCoord.xy) < 0.5 ) ? vec4(1,1,1,1) : vec4(0,0,0,1); You can do some "supersampling" to make it smooth, or analytically compute the area of pixel, which is overlapped by circle. BTW. there is also OpenVG API out there.


5

To get better results you will need to check for MSAA (http://www.opengl.org/wiki/Multisampling) Define how many samples you want for Anti-Aliasing in WGL_SAMPLES_ARB attribute passed to the function wglChoosePixelFormatARB (for Windows). You can find code for that here : http://nehe.gamedev.net/tutorial/fullscreen_antialiasing/16008/ This paper is also ...


4

Here's a solution, but you'll need to call createDeviceEx instead of the current function. You'll have to pass a SIrrlichtCreationParameters structure to the above function, with the AntiAlias member set to true (or another value ? It seems that the variable is an unsigned integer, and not a bool, never noticed that). Of course you'll have to define some ...


4

If you are dealing with more than one triangle in your world, the corners aren't even the only problem. If you're rendering an antialiased triangle over a known background, you can calculate the coverage at a pixel and blend using that alpha. But if you then render a second triangle over the first one, you have to ask a question: Did this second triangle ...


4

You are almost right about it, but XNA has some built-in features to help you with all of that! Render to Texture My first hunch is to render the scene into a texture Almost. You would start by rendering your scene into a RenderTarget2D (which actually inherits from Texture2D so it does qualify as rendering to a texture). Something like: ...


4

Um, why don't you just use multisampling like everyone else? Even if you're using deferred rendering, there are ways to use multisampling in tandem with that. Multisampling covers triangle edge aliasing, while anisotropic filtering covers texture aliasing. Between those two, you pretty much have all the antialiasing techniques you need. Unless you're ...


3

Your TextureOptions settings are likely to be the cause, see the call that you use for creating your TextureAtlas. Try the different TextureOptions and see which one you like the most. For more information, see the related thread on the AndEngine forum.


3

That method was removed in XNA4 since it was no longer needed since we now have the reach and hi-def profiles. You can now just prefer multisampling or not and the framework will set an appropriate MultiSampleCount if possible. You can still set this value yourself here but setting it too high won't cause an error. ...


3

Without seeing any code it's hard to guess, but here are two three major pitfalls to look out for: On 3D graphics hardware, the edges of adjacent polygons are only guaranteed to align 100% if their vertices are 100% the same. So if you generate the vertices for each cube individually, and you use an algoritm that introduces tiny floating point errors... ...


3

Generally speaking, yes, postprocess antialiasing like FXAA is making MSAA much less popular. As you mentioned, the performance hit for MSAA is very high, mainly due to the increased memory bandwidth required for reading/writing render targets. It also, of course, consumes a lot more memory for those render targets - not as big a deal for PC gamers who ...


3

The default texture magnification filter seems to be bilinear filtering, which will interpolate linearly between texels if the texture needs to be blown up to cover the target. If the sample doesn't lie on a texel center, bilinear filtering takes the closest pixels horizontally and vertically and blends them together based on their distance to the sample ...


3

2. They may not always be normalized after transformation into projection or world space, even if you provide the correct inverse transpose of the vertex transformation.


3

The modern technique is to render your scene to one or several framebuffer objects of the desired size, then use these framebuffer objects as textures and render them to the screen. Basic usage means setting the texture to GL_LINEAR and does not require a shader. Advanced usage means using a shader to enhance the antialiasing, for instance by doing edge ...


3

As you have noticed clipping or regions in GDI+ are not antialiased as they are both pixel based where a given pixel can either be completely included or excluded. To do what you want in GDI+ you can apply an alpha mask to the image yourself. Basically you fill a rectangle of the size of the area affected with black color and then draw the hole with white ...



Only top voted, non community-wiki answers of a minimum length are eligible