- Home /
Anti aliasing with sprites
I am developing a 2D game using Unity 4.3.
Can I acheive the same anti aliasing effect using Sprites (img 2) as with Mesh Renderer + Quad Mesh Filter (img 1)?
The problem is as follows: On the image: The first image uses Mesh Renderer and Quad Mesh Filter, which looks ok. However, I am using several images with several color variations. I wanted to minimise the number of drawcalls, so I created a sprite texture with all the images in it. Although the number of drawcalls dropped significantly, the result, as you can see on the second image, is not affected by anti aliasing.
(image is enlarged by 200%)
I could use the same sprite texture with mesh renderer and just change offset and tiling values, or use UV mapping on mesh, but every time I would need to change the color, a new instance of a material would be added and so the number of drawcalls would increase. (I suppose)
Is there any other solution how to minimise the number of drawcalls and still use anti aliasing?
Hi, is the sprite texture in bilinear or trilinear (with mipmap) mode ? It looks like the texture is reduced to be displayed, in that case, trilinear will help blur pixels because it will use texels from a lower resolution mipmap (well, I'm not sure sprite renderer can use trinilear/mipmap as mesh renderer does, that could explain the difference)
This is using trilinear. I don't know what the mipmap mode is, the inspector doesn't give any such option for the sprite texture type
I have the trilinear + "generate mip maps" option with unity 4.6, this might have been added recently. I can also use the sprite editor with the "advanced" texture mode that propose even more options but I'm not sure it was available with 4.3. $$anonymous$$aybe it's time to upgrade (or just install the 4.6 in another directory so you can see if it works with it ?)
If you have to stick with 4.3 and want to reduce drawcalls, I would suggest using a shader that supports vertex color and change the vertex colors in the mesh itself at run time. Using small meshes with the same shader should allow dynamic batching to work.
in 4.6, trilinear + "generate mip maps" solved the problem, thanks
It screwed up my physics2D though. I you happen to know how to fix it please let me know here