Blur Busters Forums

Who you gonna call? The Blur Busters! For Everything Better Than 60Hz™ Skip to content

Using a reshade black frame insertion shader fx?

Talk to software developers and aspiring geeks. Programming tips. Improve motion fluidity. Reduce input lag. Come Present() yourself!

Re: Using a reshade black frame insertion shader fx?

Postby deama » 24 Aug 2019, 10:06

Kheri wrote:Well, I haven't much luck with the program yet -- it just flickers like mad.

I did something like this to get it working on the primary display:
https://docs.microsoft.com/en-us/window ... terfromhdc
Code: Select all
   DISPLAY_DEVICE dd;
   memset(&dd, 0, sizeof(dd));
   dd.cb = sizeof dd;
   int i;
   for (i = 0; EnumDisplayDevicesA(NULL, i, &dd, 0); ++i) {
      if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
         break;
      }
   }

   oa.hDc = CreateDC(NULL, dd.DeviceName, NULL, NULL);

What are you supposed to do with that code?
deama
 
Posts: 9
Joined: 07 Aug 2019, 12:00

Re: Using a reshade black frame insertion shader fx?

Postby Kheri » 24 Aug 2019, 16:59

deama wrote:What are you supposed to do with that code?


That's just a code snippet I put into my own copy of the source code to get the program detecting my primary monitor; I have a multi-monitor setup. I didn't feel like putting it up on GitHub. I'm also not sure how good/appropriate of a solution it is.. I believe there are other ways to get the Device Context or Monitor ID. All of that code snippet replaces the single "oa.hDc = ..." line in the source code. (Then you would have to "Build" it into an executable, of course.) Hope that makes sense.

Edit: to be clear, the snippet is just for detecting the main monitor. I couldn't successfully run the previous executable because it was failing to do so. It doesn't prevent the monitor from flickering.
Kheri
 
Posts: 59
Joined: 29 Sep 2018, 13:39

Re: Using a reshade black frame insertion shader fx?

Postby deama » 24 Aug 2019, 23:16

Kheri wrote:
deama wrote:What are you supposed to do with that code?


That's just a code snippet I put into my own copy of the source code to get the program detecting my primary monitor; I have a multi-monitor setup. I didn't feel like putting it up on GitHub. I'm also not sure how good/appropriate of a solution it is.. I believe there are other ways to get the Device Context or Monitor ID. All of that code snippet replaces the single "oa.hDc = ..." line in the source code. (Then you would have to "Build" it into an executable, of course.) Hope that makes sense.

Edit: to be clear, the snippet is just for detecting the main monitor. I couldn't successfully run the previous executable because it was failing to do so. It doesn't prevent the monitor from flickering.

Oh ok, I only got 1 monitor.
deama
 
Posts: 9
Joined: 07 Aug 2019, 12:00

Re: Using a reshade black frame insertion shader fx?

Postby fuzun » 30 Aug 2019, 19:55

squeaksci wrote:I got it to work! It's a tiny C++ program, if you want to compile it, it uses the Windows Driver Kit for a v-sync function.
Github page: https://github.com/squeaksci/desktopbfi
Download, if you're comfortable running a program from a stranger: https://github.com/squeaksci/desktopbfi/releases
Problems are likely, I'm not a great programmer. Let me know how it goes!


I think that this project is really interesting. This was something that I wanted to do in my free time.
I have tested it and in my computer it works quite good.

If you are interested, I have integrated my small and not very well coded "strobe" library into this project.
With it, this is now much more flexible. If you have 144hz monitor, now you can try [RENDER - BLACK - BLACK] sequence instead of classic [RENDER - BLACK] as R-B causes some color problems.

I suggest Render Mode: 2 or -2 for 144hz monitor. Note that even modes have advantages because they don't require algorithms to prevent image retention.

Source Code:
https://github.com/fuzun/desktopbfi

Binary:
https://github.com/fuzun/desktopbfi/releases/tag/v1.1

Usage:
desktopBFI.exe [Strobe Mode] [Phase Switch Interval in Seconds] [Debug Mode]

if you set debug mode = 1, this will show up:
Image
fuzun
 
Posts: 17
Joined: 20 Jan 2018, 21:18

Re: Using a reshade black frame insertion shader fx?

Postby deama » 01 Sep 2019, 03:11

fuzun wrote:
squeaksci wrote:I got it to work! It's a tiny C++ program, if you want to compile it, it uses the Windows Driver Kit for a v-sync function.
Github page: https://github.com/squeaksci/desktopbfi
Download, if you're comfortable running a program from a stranger: https://github.com/squeaksci/desktopbfi/releases
Problems are likely, I'm not a great programmer. Let me know how it goes!


I think that this project is really interesting. This was something that I wanted to do in my free time.
I have tested it and in my computer it works quite good.

If you are interested, I have integrated my small and not very well coded "strobe" library into this project.
With it, this is now much more flexible. If you have 144hz monitor, now you can try [RENDER - BLACK - BLACK] sequence instead of classic [RENDER - BLACK] as R-B causes some color problems.

I suggest Render Mode: 2 or -2 for 144hz monitor. Note that even modes have advantages because they don't require algorithms to prevent image retention.

Source Code:
https://github.com/fuzun/desktopbfi

Binary:
https://github.com/fuzun/desktopbfi/releases/tag/v1.1

Usage:
desktopBFI.exe [Strobe Mode] [Phase Switch Interval in Seconds] [Debug Mode]

if you set debug mode = 1, this will show up:
Image

I tried it and I still get lots of flickering, what's going on? Is it something to do with my monitor or computer?
Here's a picture of the debug, it seems like it can't really reach 144fps? I tried setting the priority of the program to high but didn't really make a difference.
Image


EDIT: Hmm, ok, maybe not, I tried again with a -2 render mode this time and the fps was higher, but there was still a bunch of flickering:
Image
deama
 
Posts: 9
Joined: 07 Aug 2019, 12:00

Re: Using a reshade black frame insertion shader fx?

Postby Chief Blur Buster » 04 Sep 2019, 23:19

One could also temporarily switch to the Performance plan temporarily while running this BFI module.

This can also be done programmatically (using API to switch to high performance mode) via the PowerGetActiveScheme() and PowerSetActiveScheme() to force the computer to 100% GPU. At least you'd notify the user of reduced accuracy if you're on the battery-miser power plan...

This will kill battery, but can dramatically increases BFI precision.
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter

       To support Blur Busters:
       • Official List of Best Gaming Monitors
       • List of G-SYNC Monitors
       • List of FreeSync Monitors
       • List of Ultrawide Monitors
User avatar
Chief Blur Buster
Site Admin
 
Posts: 6312
Joined: 05 Dec 2013, 15:44

Previous

Return to Software Developers / Low-Lag Code / Game Programming

Who is online

Users browsing this forum: No registered users and 2 guests