[Solved] fix Point Sampling (w/ Pixel Rounding) flickering!

Discussion and feedback on Construct 2

Post » Sun Jul 16, 2017 9:58 pm

Here's a video example of what am I talking about :
https://www.youtube.com/watch?v=-e5fUSC3RIE

I do believe that I might just be doing something wrong, so if someone could guide me to remove these stripes, please do. :cry:

It puts a heavy strain onto players eyes and ruins my game.
Thanks for any help in advance!

UPD : Another video without rotation (Spoiler : flickering persisted)
https://www.youtube.com/watch?v=gB-FTN6 ... e=youtu.be

UPD : [!!!] To other nooby people like me, setting 'Fullscreen in Browser' to 'none' removes all lines. Odd that noone could tell me that before @newt hinted that
Last edited by HellMax on Thu Jul 27, 2017 6:26 pm, edited 4 times in total.
B
6
S
2
Posts: 98
Reputation: 1,334

Post » Mon Jul 17, 2017 3:59 am

Hey Max. The thing about pixel rounding is that it will ensure that the pixels are only ever in 1 spot. This means instead of a perfectly smooth motion like you get with linear sampling (where it actually moves between pixels) you can sometimes end up with slightly jaggy movement.

Switch to linear sampling. If you hate the way your image is now distorted, try importing a big version of the car and scale it down. You now have the best of both worlds with the downside being that you are using large assets :/

In a small game though that shouldn't matter for you.
ImageImage
B
118
S
23
G
7
Posts: 1,070
Reputation: 12,964

Post » Mon Jul 17, 2017 8:47 am

Hello! Thank you for a quick reply.
I would not mind the movement being a bit jittery and moving one pixel at a time (the way it's set up that the car can only have int as its position)

I have a problem with weird lines going over my sprite as it moves; which should NOT occur on pixel rounding unless its bugged or I'm dumb.
B
6
S
2
Posts: 98
Reputation: 1,334

Post » Mon Jul 17, 2017 11:28 am

The sprite is rotated yeah? Though sprites snap to game resolution integers with pixel rounding on, everything is still drawn at screen resolution so when you rotate a sprite, the sprite gets rotated with as much pixel precision as the screen resolution allows, basically. That's probably where your lines are coming from. If you want to avoid that you can try using low-quality fullscreen scaling instead.
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Mon Jul 17, 2017 11:59 am

There is a reason why pixel rounding is there, to improve performance at a cost of less smother gameplay, you cant "Fix" it without making the game more performance heavy which will defeat the purpose of pixel rounding in first place.

You want smother movement don't use pixel rounding, you can make pixel rounding look more smoother by making the screen resolution bigger then it will be less noticeable, but bigger resolution more stuff on the screen == reduced fps, so it wont really improve performance or it will by such a small amount it will be neglectable and you might as turn it off.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Mon Jul 17, 2017 12:25 pm

It looks like the object is slightly rotated. Small rotations often don't look good with point sampling since aliasing becomes very obvious, as you have noticed. This is a normal result in computer graphics, and this is why most games either use linear sampling, or use a retro-style which generally avoids rotation.
Scirra Founder
B
395
S
232
G
88
Posts: 24,368
Reputation: 193,756

Post » Thu Jul 27, 2017 10:52 am

Testing on 0 rotation and through "Move forward 1 pixel" + having turned off pixel rounding, I still get lines and flickering on my sprite. (No change with pixel rounding either, lines that situated 90 degrees against movement direction flicker so bad)

What am I doing wrong? Does the sprite need a bigger/smaller resolution? (Current is 255x111 for a 1280x720 screen size)
B
6
S
2
Posts: 98
Reputation: 1,334

Post » Thu Jul 27, 2017 12:24 pm

Furthermore, I've noticed that still downscaled sprites flicker even with Linear sampling (during camera movement).
How do I remove that aswell?
B
6
S
2
Posts: 98
Reputation: 1,334

Post » Thu Jul 27, 2017 1:05 pm

Recorded another video :

https://www.youtube.com/watch?v=gB-FTN6 ... e=youtu.be

The object is not rotated, the camera scrolls to an object (which falls under pixel rounding hence is also only on integers). Scirra, why is this happening?

Perhaps it is my fault but, if so, please tell me what should I do to remove the lines that have been ruining my game for a month.

Thank you in advance.
B
6
S
2
Posts: 98
Reputation: 1,334

Post » Thu Jul 27, 2017 3:41 pm

Its subpixel placement. It happens when you try to render line in between whole points. It happens everywhere to everyone.
The fix is simple, don't use crappy graphics, and don't expect lines that are 1 pixel wide to render.
Image ImageImage
B
169
S
50
G
169
Posts: 8,285
Reputation: 108,214

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Tinimations and 1 guest