Hot answers tagged

118

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 ...


67

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 ...


49

Performance is generally the major reason these features can be switched on and off by the user. Generally, they are expensive, and by allowing users to toggle them off a developer broadens the set of machines that effectively run the game to include more lower-end machines. This translates to potentially more players, and thus potentially more sales ...


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 ...


11

As Josh Petrie already pointed out, the most important concern is performance. Not only can't you know how powerful the end-users hardware is, when you are building an engine you don't even know how people are going to use it. Maybe the game developers want to build a game which puts so many polygons on the screen that even the best hardware can't render it ...


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

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.


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;


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

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

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

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

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 ...


5

Of course, performance. Some effects such as Crepuscular Rays, Depth of Field and Bloom are very taxing of fps, in particular in older GPUs. Also a good way to gain some extra fps is to reduce or disable reflections and shadows. Also - to repeat Artelius point - visual effects will also hit battery life. Besides that: Some effects may be glitchy. Not all ...


5

Something not mentioned by others yet: Disabling graphics features might be a valid workaround for problems with a certain setup, unrelated to performance. Just one example, some graphics options simply don't work correctly with a given rendering engine when running a Windows game on Wine (the Windows compatibility layer for Linux). For a certain ...


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

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 ...


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

Clarity of view in competitive games Players in competitive online games may well prefer a simpler or clearer view to a more beautiful view even if performance is not a concern - many visual options add visual realism but obscure the things that players actually want to see. It may easily be that in your game it is easier to notice or target an enemy if ...


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

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

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. ...



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