Recently, I was learning CocosSharp. It is a game engine which provides technology for making cross-platform games.
As soon as you hit the first line of code, you see this:
`application.PreferMultiSampling = false;`
Ok, I see that there is an application object and you are setting its property PreferMultiSampling
of type boolean to false
. But why should we do this?
MultiSampling is an anti-aliasing technique, which is also shortened as MSAA (MultiSample Anti-aliasing) and in the above line, we are not preferring multisampling in our game.
Before answering this, I have to explain about aliasing and how it impacts the game look and feel.
Aliasing occurs when rendering a high-resolution signal (such as a sharp edge) at a low resolution (such as in a render target with a fixed number of pixel locations.
Anti-aliasing smooths sharp edges by partially rendering to neighboring pixels or in an other way removes jaggies or stairCase effect from your video game in real-time making them appear smoother.
This technique is also called multisampling because each pixel value can be the result of multiple samples. In our case, as we are targeting mobile or hand-held devices for our game, enabling multisampling may have a large impact on performance.
2D games generally doesn't use heavy or high resolutions sprites (Assets) as they have to be rendered on a screen which may be smaller in size or the distortion is negligible. So anti-aliasing aka MSAA is not required in this case and so we are setting it OFF or false.
All the different types of anti-aliasing and their strengths and weaknesses:
- SSAA (also known as FSAA): Super sampling anti-aliasing was the first type of anti-aliasing available. It's useful on photorealistic images, but isn't very common in games anymore, because it uses so much processing power.
- MSAA: Multisample anti-aliasing is one of the more common types of anti-aliasing available in modern games. It only smooths out the edges of polygons, not anything else—which cuts down on processing power compared to SSAA, but doesn't solve pixelated textures. (MSAA still uses quite a bit of power, though.)
- CSAA and EQAA: These types of anti-aliasing (used by newer NVIDIA and AMD cards, respectively) are similar to MSAA, but at a fraction of the performance cost.
- FXAA: Fast approximate anti-aliasing, which we've mentioned before, has a very small performance cost, and smooths out edges in all parts of the image. However, it usually makes the image look blurry, which means it isn't ideal if you want crisp graphics.
- TXAA: Temporal anti-aliasing only works on certain newer graphics cards, but combines lots of different techniques to smooth out edges. It's better than FXAA, but still has some blurriness to it, and uses a bit more processing power.deProject