Pixel Perfect Camera Smoothing

Hello everyone! First things first, Thank you for taking your time on reading this, it’s appreciated.

Recently after working a bit on a prototype for a platformer, I’ve recently been going crazy on an issue. I’ve been doing research and such. I believe it may be my camera.

I have a web player set up. https://dl.dropboxusercontent.com/u/67760294/Webplayer/Webplayer.html

Please have a look and if you move around and jump around the map, you can see the tiles (grass/dirt) blocks have a ghosting effect the tiles blur together, but the player does not.

How can I remove this ghosting effect on the tiles, so I have a nice pixel perfect smooth camera, where as the player moves, the tiles and player don’t have a blur, (delayed) effect. I’ve done research about pixel perfect and some say that Unity doesn’t have the capability to do so? Unsure. Any idea where I can start from to remove this ghosting effect?

I’m using the CameraFor2D asset, by David Kontz, and with every other camera script I’ve made it just doesn’t make a difference. Also I do know that in the web player the pixels are distorted, that’s simply because of the web player, it’s pixel perfect in unity and on a standalone.

I hope this is clear enough to understand, if I will try to clarify.

Ideas and comments are appreciated.

Much thanks.

Retry by Rovio has been made with Unity and it doesn’t look like it’s having this issue. So I’d say Unity is fine for 2D pixel perfect games. You probably have to make sure that your camera is set correctly.

It’s not Unity’s fault that the result does not get pixel perfect. You just have to make some adjustments.

Please read the following threads: link1, link2. Also read my in-depth explanation in my blog post.

In order to render a sprite (using point filtering) in a pixel-perfect way (without distortion and artifacts) you should set the orthographic camera’s size so that an asset pixel renders to an integer amount of screen pixels.

I have created a simple camera script (which is free) that works on this principle. You can set the desired camera height (or width) and the script will find the closest pixel-perfect camera size. See it in action in this HTML5 demo.

2 Likes