Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / quick vsync q

Author
Message
Zeal
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 28th Jul 2006 01:56
When we finally get patched.. we will have the new 'vsync' flag. It makes things look 10x better if you can maintain a steady fps, but I just had a quick question about how it works.

From what I understand, when vsync is enabled, whenever 'sync' is called, things will stall, and the screen will only 'update' when the monitor refreshes. The sole purpose of this is to prevent tearing, right? So if you set your monitor refresh rate (outside dbpro) to 60hz, the MAX fps youll get inside dbpro is 60, correct?

My real question is, what happens if your app can only run at say 50fps? Does 'sync' still stall and wait for the next monitor refresh before drawing? What happens when the monitor refreshes in the middle of your main loop, or WHILE sync is drawing? Does the monitor just draw using the last 'complete' frame?

Im really curious to know, because most monitors (mine at least) cant do less than 60hz. Thus unless youre hitting a constant 60fps in your app, something nutty has to be going on behind the scenes, but what!?

All you need is zeal
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 28th Jul 2006 03:35
This explains it a bit.


Projects: Online CTF Game | Newcommer's Guide to FPS's
Zeal
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 28th Jul 2006 03:54
Hmm I still dont understand whats happening when the monitor is refreshing at 60hz, but your app is only running at 50fps.

All you need is zeal
Kaiyodo
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: UK
Posted: 28th Jul 2006 14:46
If your monitor is at 60Hz and your app can only run at 50fps then you will end up running at 30fps. If you miss your chance to update on the vsync then you'll have to wait until the next vsync comes along, which means you've wasted most of a frame waiting.

Kaiyodo.
Zeal
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 28th Jul 2006 15:48 Edited at: 28th Jul 2006 15:48
Ouch, so I guess the monitor just reuses the last frame then? Until the new one is ready?

Is there no better way to get rid of tearing?

All you need is zeal
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Jul 2006 16:00
Yep. What actually happens is that it doesn't swap the backbuffer with the frontbuffer until the electron beam is outside of the viewable area.

If you don't want tearing, then you have to either stick with the vsync method, or reduce the size of your movements (although that only makes tearing less apparent).

That means that for your app, if it's running under the speed of the refresh rate, has to adapt to the changing conditions - if your refresh is half what is required, double speeds and angle changes etc.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Kaiyodo
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: UK
Posted: 28th Jul 2006 16:08 Edited at: 28th Jul 2006 16:08
Yep, it just uses the last frame. If you want to keep your framerate and avoid tearing you could try using triple buffering, but I'm not sure you can do that easily from DGSDK.

Here's a quick link that explains the technique a little ..

http://www.ocworkbench.com/2006/articles/DXtweaker

Kaiyodo.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 28th Jul 2006 18:12 Edited at: 28th Jul 2006 18:13
Golden rule of smooth game refresh, don't ever let your logic code exceed the refresh timing. For a grand 60fps game, you have about 15 milliseconds to get all your game logic done per cycle. Stick to this and you will get 60fps all day long without tearing. If you find your game is eating 42ms per cycle, optimize like you're on fire until it is back down to 15ms. Good luck!

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
Zeal
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 28th Jul 2006 18:35
Yeah its nice to shoot for a constant 60fps, but im toying with the idea of aiming for something lower (maybe 30-45). A consistant framerate (with the help of my super duper motion blur shader) looks damn good, even pre 60fps. However, running below the monitors refresh rate scares me, isnt that just ASKING for tearing? Of course I could just enable vsync, but running below the refresh rate, according to Kaiyodo, could lock my fps all the way down to 30fps.

All you need is zeal

Login to post a reply

Server time is: 2024-06-17 07:04:29
Your offset time is: 2024-06-17 07:04:29