MSAA smoothing movement?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
fishbool
Prole
Posts: 3
Joined: Tue Dec 29, 2015 1:04 pm

MSAA smoothing movement?

Post by fishbool »

Hey all,

I'm pretty new to love/lua and I'm working on a simple game using basic shapes (squares), but I've noticed that any movement of these shapes with vsync enabled is not smooth (the shapes seem to jitter a bit while moving). Disabling vsync fixes this problem, but the fps jumps to over 600. This is fine since I'm using dt to calibrate movement, but it hogs a lot more processing power.

Here's a small test program I wrote that has jittery movement with vsync enabled.

Code: Select all

x = 0
y = 200

function love.update(dt)
    x = (x+5)%800
end

function love.draw()
    love.graphics.rectangle("fill", x, y, 100, 100)
end
I read a little bit about implementing a more advanced timestep (with interpolation) to fix this, but I noticed today that enabling msaa completely smooths the movement with vsync enabled. I'm a little puzzled as to why this is smoothing the movement, as I thought msaa smoothed edges, not movement. In fact, if I take a screenshot of the program with msaa enabled and then zoom in, the edges are still hard, so it isn't blending the movement between frames or anything. Is there a specific reason why this happens or is something weird going on with my graphics driver?
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: MSAA smoothing movement?

Post by Davidobot »

I got this exact same problem and just disregarded it as a driver problem. I think this may indeed by a bug in 0.10.0 as this jittering, which also results in the outer pixels of images to spontaneously appearing and disappearing while moving.
I will check if enabling MSAA fixes it and report back.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
slime
Solid Snayke
Posts: 3134
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: MSAA smoothing movement?

Post by slime »

I don't get any jitter on my system. Do your delta-time values fluctuate a lot?
fishbool
Prole
Posts: 3
Joined: Tue Dec 29, 2015 1:04 pm

Re: MSAA smoothing movement?

Post by fishbool »

Davidobot wrote:I got this exact same problem and just disregarded it as a driver problem. I think this may indeed by a bug in 0.10.0 as this jittering, which also results in the outer pixels of images to spontaneously appearing and disappearing while moving.
I will check if enabling MSAA fixes it and report back.
It's of note that this was happening for me in 0.9.2 as well.
slime wrote:I don't get any jitter on my system. Do your delta-time values fluctuate a lot?
Here is a sample of delta-times without msaa:

Code: Select all

0.016498046577908
0.017002579872496
0.016513691050932
0.01699573546648 
0.016505868756212
0.016507824300788
0.016500491066836
0.017001602100208
0.016502935439348
0.016498535405844
0.017006979906   
0.016489246627316
0.016503424267285
0.017010402167216
0.01650049095042 
0.016494624316692
0.01701969106216 
0.01649560208898 
0.016493157716468
0.017015291028656
0.016494135372341
0.01649560208898 
0.017013335600495
0.016493646427989
0.016497557749972
0.01701186876744 
0.016495113261044
0.016503913211636
0.016997691011056
0.016516624367796
0.016993290977553
0.016009157639928
0.016991335432976
0.016505868756212
0.017002579988912
0.01651173538994 
0.01650195766706 
0.016994757694192
0.016502935439348
0.016496579861268
0.017430846695788
0.016074668732472
0.016548402025364
0.016956624458544
0.016509290901013
0.01649560208898 
0.016998179955408
0.01650831324514 
0.016499513178132
0.017001113272272
0.016517113195732
0.016488757682964
0.017002579872496
0.017001602216624
0.016006224206649
0.016992802149616
0.016502935439348
w/ standard deviation of .0003

And delta times with msaa (8x):

Code: Select all

0.017496846732683
0.016002801945433
0.016501468839124
0.01700209104456 
0.016493646544404
0.016529824235477
0.016978624393232
0.016498046577908
0.01651173538994 
0.016994757810608
0.016506357584149
0.01651809096802 
0.016981557710096
0.01650831324514 
0.016499024350196
0.01700062432792 
0.016505868756212
0.016496091033332
0.017004535417072
0.016505868756212
0.016516624367796
0.016980579937808
0.016504402039573
0.016507335472852
0.017004535533488
0.016507824300788
0.016493157600053
0.016997691127472
0.016508313128725
0.016516135423444
0.01648093550466 
0.017004046589136
0.016549868742004
0.016968357726   
0.016489735455252
0.016501468722709
0.017008935450576
0.016491690999828
0.016502935439348
0.0165068465285  
0.016999646672048
0.016501468722709
0.017010402167216
0.016498535405844
0.016493157716468
0.01700551318936 
0.016522002173588
0.016488268738613
0.016999157727696
0.016502446494997
0.016507824300788
0.016994757694192
0.016519068856724
0.016487290966325
0.016502935439348
0.017003068816848
0.016499024233781
w/ standard deviation of .00027

I'm not sure if that's a normal amount of fluctuation. It doesn't seem like msaa makes a significant impact on the SD of those samples, so idk if it's an issue with the dt.
User avatar
slime
Solid Snayke
Posts: 3134
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: MSAA smoothing movement?

Post by slime »

Does the jitter still happen if you make the window exclusive-fullscreen? i.e. love.window.setMode(width, height, {fullscreen=true, fullscreentype="exclusive"})
fishbool
Prole
Posts: 3
Joined: Tue Dec 29, 2015 1:04 pm

Re: MSAA smoothing movement?

Post by fishbool »

slime wrote:Does the jitter still happen if you make the window exclusive-fullscreen? i.e. love.window.setMode(width, height, {fullscreen=true, fullscreentype="exclusive"})
Nope, it seems to be quite smooth with exclusive fullscreen. In fact, I just tried simply re-sizing the window to 1920x1080 in windowed mode (instead of the default 800x600) and that smooths it out a bit as well (still a little jittery every now and again but a lot better).
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: MSAA smoothing movement?

Post by zorg »

I modified the test code a bit, and on my pc (win7x64, with love 0.10.0 64bit; two nvidia gpus, >1 screen) i get the following results:
(Only modifications i did was to disable the sleep in love.run if and only if vsync was on; i attached the love file also.)

Code: Select all

windowed             msaa 0,1,2,4      vsync ON  - stutters
windowed             msaa 8,16         vsync ON  - sometimes randomly gets smooth, then begins to stutter again
desktop   fullscreen msaa 0,1,2,4,8,16 vsync ON  - stutters (on any non-primary screen; primary works fine [b]if it has focus[/b])
exclusive fullscreen msaa 0,1,2,4,8,16 vsync ON  - same as above
windowed             msaa 0,1,2,4,8,16 vsync OFF - stutters, but a bit less visibly
desktop fullscreen   msaa 0,1,2,4,8,16 vsync OFF - stutters (on any non-primary screen; primary works fine [b]if it has focus[/b])
exclusive fullscreen msaa 0,1,2,4,8,16 vsync OFF - same as above
Seems like on my computer, msaa doesn't really make it run less jittery.

On the other hand, editing application-specific settings in the nvidia control panel may work wonders;
i set a few things like disabled the power saving mode (max. performance always), vsync controlled by application of course, and turned on triple buffering;
these settings resulted in that i now have dt variance in the 5th digits only after the decimal point (previously it sometimes went up to the 4th), when fullscreen, and non-vsynced windowed does not stutter either (vsynced still does though).

Edit: Just as fishbool had it, windowed mode resized to near the screen size doesn't stutter for me neither.

Edit2: For the record, NOT using Aero completely eliminates stutter, even when windowed...
And not running f.lux also helps get rid of the occasional hiccup apparently
Attachments
microstutter.love
(2.5 KiB) Downloaded 56 times
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: MSAA smoothing movement?

Post by Karai17 »

The issue is Windows Aero is garbage, especially on Windows 7. Disabling Aero or upgrading to Windows 10 will fix the issue.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: MSAA smoothing movement?

Post by Davidobot »

None of the solutions presented here work for my game. I run Win 10.
To see the jitter, move left or right using A or D. (the left and right-most pixels appear and disappear)
All the player code is under stt/game.lua
Attachments
PolandBall.love
(461.22 KiB) Downloaded 73 times
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: MSAA smoothing movement?

Post by Karai17 »

Are you flooring the draw positions?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests