Hot answers tagged antialiasing
14
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 ...
6
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.
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() ...
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 ...
4
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
...
4
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 ...
3
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.
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
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 ...
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
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... ...
2
If I understand your question correctly, the calculation you're trying to do is very similar to the standard projection or primary-ray generation calculations.
Here's a rough diagram that illustrates the solution.
2
N_a is the result of the normal map fetch, which is usually not unit length because it is a linear blend of almost-unit vectors.
The normal map typically encodes normals in tangent space, which is to say that a normal in the map with the value [0,0,1] points directly away from the surface along the surface normal.
You are right that N_a is "the normal ... ...
2
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 ...
2
Have a read of this article on texture aliasing (and the ones it links). It explains exactly why you are having this issue.
While there are many techniques for rendering an anti-aliased circle, the simplest one for your situation is to turn on mipmaps for your texture.
To do so, make sure your texture is in an XNA Content Project. Select it and press F4. ...
1
As far as I know, SFML doesn't provide own anti aliasing. Well, when you create a new window, there is an optional parameter for the anti-aliasing level. But this super-sample anti-aliasing is a default handeled by the graphics driver instead of SFML. You can easily get that with GLUT, too.
Internally, SFML doesn't use render to texture, I think. But there ...
1
That code seems more complicated than necessary, what you need is to just draw your image with the right transformation matrix.
I don't speak Java so there may be mistakes in this, but it should look something like:
AffineTransform transform = new AffineTransform();
transform.rotate(angle,img.getWidth()/2,img.getHeight()/2);
transform.scale(scale,scale);
...
1
Multisampling is a property of the backbuffer. So: no, you cannot change it mid-draw.
Where you call ApplyChanges you're causing the graphics device to get torn down - you should never call this during Draw.
One thing you could do is render your UI to a render target without multisampling. Or alternately render your 3D geometry to a render target with ...
1
Based on your code example, it looks like you use the alpha channel in your bitmask to determine whether or not to draw a pixel. It also looks like you treat an alpha of 0 as "draw the pixel" and anything > 0 to "not draw the pixel." I'm also going to assume that in your bitmask, you can make anti-aliased edges in the alpha channel where the alpha value ...
1
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 ...
1
For your antialiasing problem, could it be your hardware settings?
For your tiled texture, instead of using tiling options in max, use the uvw unwrap modifier and scale that face to cover multiple tiles in the Edit box.
As for the last part, you need to provide more information about the problem, screenshots, exporter options, and anything else.
1
While I would personally resort to munificents solution, here's a way to get a crisp sprite using ImageMagick.
Use the tool of your choice to draw your sprite. Export it as PNG with alpha channel. Your exported image might look like this:
Then you can use ImageMagick to convert this image to a sprite with magenta background using the following command:
...
1
For your pink halo-ing, the issue is exactly what you described: anti-aliasing. If you have Photoshop, just create the hexagon with two layers, one with all pink (0xFF00FF) and another with the hexagon. Make sure when you create the hexagon all feathering and anti-aliasing settings are set to zero for all the tools you use, and all brushes are set to 100% ...
1
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 ...
Only top voted, non community-wiki answers of a minimum length are eligible