2D camera ghosting

I am working on a 2D endless runner and I have a problem with my objects appearing to ghost as the player object moves past them. I am attaching my camera to my player object through script. I have tried to put the camera code into Update, LateUpdate, and FixedUpdate with no change in behavior. I’ve seen other posts about ghosting, but I haven’t seen anyone come up with an answer on the Answers section of the site. Is there a known issue with the orthographic camera that I may be missing?

Here is a video of the problem: https://www.youtube.com/watch?v=N5f3G9dd_SQ&feature=youtu.be

You can really see it on the clouds and coins.

Here is a image of the camera settings

Here is the code for the camera

    using UnityEngine;
    using System.Collections;
     
    public class CameraFollow : MonoBehaviour {
     
    public Transform objectToFollow;
    float bottom = 0.0f;
    float lead = 10f;
    float above = 5f;
    float minView = 16;
     
    void Start () {
     
    }
     
    void FixedUpdate(){
    float height = objectToFollow.position.y + above - bottom;
    height = Mathf.Max(height,minView);
    height /= 2.0f;
    Camera.main.orthographicSize = height;
    transform.position = new Vector3 (objectToFollow.position.x + lead, bottom + height, transform.position.z);
    }
}

This is most likely a problem with your monitor’s response time.

Monitors will be advertised as having a response time of a certain numbers of milliseconds. This number measures how long it takes the monitor to change the colors of the pixels. The lower the better as lower is faster. If your monitor has a slower response time, you will see “ghosting” as the pixels are still in transition from one color to another. Also, some colors/contrasts may be more noticeable than others, depending on your monitor.

This is not a problem with Unity or the Orthographic camera. It’s simply a result of your monitor’s (in)ability to quickly change colors of the pixels.

Something that may help with this is changing the colors of the objects or the background, to make it easier for your monitor to keep up.

I agree with Deozaan; notice that if you pause the Youtube video at any point, there is no ghost image in the still frame.

At that speed, you might consider implementing some sort of motion blur.

I really disagree with you guys. There really seems to be a problem with 2D ghosting in Unity games when the camera is moving.

For example, in games such as Braid there is no ghosting at all (even when the camera moves fast):

In games that are made in Unity - that are not “pixel perfected” (just google for pixel perfect 2D Unity) - there is ghosting pretty much anytime the camera moves. The ghosting is mainly seen in the backgrounds, which are not supposed to have any motion blur. Watch any Ori and the Blind Forest gameplay video:

The reason behind the ghosting is that the pixels get rounded to incorrect values (probably connected to the shaders and the scaling of sprites in some way).

Sprites will move 1 step forward, 1 step backward and then 2 step forward when the camera is just moving in 1 direction! Since this happens very fast (if we are at 60 FPS and an object moves 60 pixels, then this basically means that 30 frames are erroneous and create a trailing effect). This makes it look like a very small motion blur effect or ghosting effect. I have the feeling that someone at Unity f*cked up when writing the transforms for the sprite shader.

1 Like