#2D game pixel flickering
1 messages · Page 1 of 1 (latest)
The only flickering visible to me is from the camera (or sprites relative to it) moving in rapidly snapped increments, which can create an illusion of flicker, especially on monitors which suffer from color ghosting
There's a test site dedicated to testing what kind and how severe ghosting your monitor has (but be warned it can be very eye-straining!)
The worse the effect is the bigger the snap / lower the FPS is in motion, and the greater the color difference between object and background are
The thin bright line on the tile edge can cause ghosting not only relative to the background, but against the rest of the of the tile itself
In addition to your monitor's ghosting, another thing to look at is how you're moving the camera or if you're snapping the sprites
So you mean this might be caused by the camera moving in large steps?
I don’t think the screen is the problem; it flickers the same way on my phone as well.
I think so, at least I don't see any other type of flickering
It can happen if the movement is stepped by something, like fixedupdate / uninterpolated rigidbody, or pixel perfect camera component
The flickering itself is an optical illusion regardless of the screen
But some screens make the problem worse
Do I maybe need to scale up the sprites and then shrink the character to that size? That way the character would move fast in gameplay but relatively slower compared to the sprites, which might reduce the sprite flickering
If you'd like to review the project file I've prepared, I can send it to you.
It's probably enough to know how exactly you're moving the camera and/or sprites, and if you're using pixel perfect camera component
transform.position += direc * Vector3.right * (MathF.Round(speed * Time.deltaTime / unitPerPixel) * unitPerPixel);
Pixel Perfect Camera
This kind of position snapping will cause the kind of jitter you are seeing
And it's unnecessary with the pixel perfect camera because that component is already doing its own PPU-correct snapping
I'll try it and get back to you.
However, just letting the pixel perfect camera do the position snapping will not mean the problem will necessarily be fixed
Because the problem is caused by any kind of position snapping at its core
But it may be an improvement
People I see on YouTube can get a clean image even without using Pixel Perfect, but even though I’m doing everything correctly, I’m still facing these issues
Sad
Many just don't care if it's actually clean, and such problem don't always show up on video
Or occur at all, if the variables and circumstances just happen to align in a way where the visual artifacts are not noticeable
Do you think there’s still a bit of blurriness in the image?
I guess they don't encounter this problem because they move the camera very slowly?
transform.position +=Vector3.right* direc * speed * Time.deltaTime;
It actually seems to have gotten worse hahaha.
I really don't know about blurriness but your camera movement appears way, way too incremented
For every 1 sprite pixel the camera jumps 15 pixels each time it moves
This isn't really a sharp pixel style so either you shouldn't be using any kind of snapping or pixel perfect camera at all
If you do use pixel perfect camera component, you should be using it with 1:1 pixel ratio
That can help preserve one pixel wide details, but isn't necessary and even then it may still cause one pixel wide blurring in motion