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

0 favourites
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Here's a video example of what am I talking about :

    I do believe that I might just be doing something wrong, so if someone could guide me to remove these stripes, please do. <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    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)

    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

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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)

  • Furthermore, I've noticed that still downscaled sprites flicker even with Linear sampling (during camera movement).

    How do I remove that aswell?

  • Recorded another video :

    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.

  • 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.

  • newt

    First of all, its placeholder so that the real ones wont get stolen. Exactly the same happens on real sprites. Are you suggesting that the fix would be not to use one pixel lines and make every line fatter? Thats a bit weird and limits visual design quite a bit

    Second of all, how would you explain same lines appearing of the grass, where there are no 1 pixel lines?

    (Thank you for spotting the source of the problem tho)

  • newt

    And why, again, Construct is drawing lines between whole points if i've got Pixel rounding on?

  • It can happen to straight lines of any width, it can happen to a line of any length, and while you may have pixel rounding on, the scroll, and the upscale mean you still have sub-pixel placement.

    The scale probably has less to do with it than the scroll.

    That can be avoided using integer positions, which will probably look jerky.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • newt

    First of all, thanks for paying attention.

    1. The "camera" object to which the ScrollTo is done is only located on integer positions, but flickering still occurs on some scales. Is there a way to make it "more integer"

    2. Did I get it right that the existence of render lines depends on window size? (if letterbox scale is used?)

  • OMG absolutely 0 flickering if you disable scaling completely. O_o

    ...

    ..

    .

    How do I make the game resizeable then

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)