FWGS / xash3d

DEPRECATED in favor of https://github.com/FWGS/xash3d-fwgs. Only bugfixes are accepted.
https://xash.su
GNU General Public License v3.0
551 stars 107 forks source link

StrobeAPI Implementation #353

Closed fuzun closed 6 years ago

fuzun commented 6 years ago

Pull request for the v1: https://github.com/FWGS/xash3d/pull/343 Discussion: https://forums.blurbusters.com/viewtopic.php?f=7&t=3815

News (v3):

News (v2):

Todo:

Sample screenshot from the debug mode: https://camo.githubusercontent.com/081e3641e118be7554e42f54149dc9ce5c862724/68747470733a2f2f7667792e6d652f54646634675a2e706e67

This pull request will be edited and updated! It stands for review now. (9.03.2018)

a1batross commented 6 years ago

Great, I will review it ASAP.

fuzun commented 6 years ago

In maintenance... Will be reopened.

fuzun commented 6 years ago

@a1batross - Take a look. OOP in C :) I hope you like macros.

I could not do some of your suggestions yet, but will try to do.

a1batross commented 6 years ago

Well... I think I need to write something like contributing recommendations.

a1batross commented 6 years ago

https://github.com/FWGS/xash3d/blob/master/CONTRIBUTING.md

Oops. I forgot about it.

a1batross commented 6 years ago

Just comment here, when it will be ready.

I also will merge it for upcoming code base sync with Xash3D 1.0.

fuzun commented 6 years ago

@a1batross Will FPS be global ? You have mentioned about flag operations, does version 1.0 contain new macros for that purpose ? And I have used some reserved keywords like "this" thinking it would not matter since it is a c file and therefore must be treated as c code, should I revert it to _this ?

Also will white color be added to the color table? I think it can be added after the "default" color (+1 increased array size).

fuzun commented 6 years ago

https://github.com/fuzun/strobe-api

fuzun commented 6 years ago

sample-strobe-screenshot

How to hook a StrobeAPI derived work (StrobeAPI implementation) into xash3d ?

How StrobeAPI and StrobeAPI implementations exposed to xash3d ?

Console variables

These variables are common in all StrobeAPI implementations because they are defined in StrobeAPI. In future these variables should be defined in implementations instead of StrobeAPI.

a1batross commented 6 years ago

Good. I will test it ASAP and merge for old engine. New engine isn't ready for public and things may change, but I hope new engine will support strobing too.

I have a question, though. Will strobing help to defeat motion blur at 60 Hz? I got a new device recently, it's 60 Hz but too blurry.

fuzun commented 6 years ago

I never intended to make this C89 compatible but for some reason compiler that Travis using can not compile if variables are defined in for statements due to "C89 compatibility". It does not need variables to be defined at start of a block.

I have a 60 hz screen and I am not satisfied with the strobing performance. Because even with the least aggressive strobe method (1 or -1), effective fps drops to 60/2 = 30 fps and frequency of signal drops to 30 hz. I find 30 fps/hz to be not enough for games xash3d support. r_strobe -2 method makes effective fps 40 but signal frequency (I call it PWM simulation) drops to 20 hz (60 * 1/3). I think at 20 hz it should not be even called as "strobing".

When I overclock the screen to 75 hz, strobing does not become annoying. So I think 75hz might be bare minimum for strobing.

I have another 60 hz screen that I overclocked it to 108 hz. Strobing helps too much for eliminating motion blur however that screen has only 220 cd/m2 peak brightness and even with least aggressive strobe method, screen becomes too dark. It also had image retention problem but it is fixed with r_strobe_swapinterval setting thanks to @mdrejhon .

And the last monitor I tested strobing is 144 hz. It has built-in hardware strobing so effective fps does not drop. The game is playable even with aggressive strobe methods like r_strobe = 2, 3 or -2 . I think that performance of software strobe method is like 30-35% of the built in hardware strobing.

There is an utility called CRU (Custom resolution utility) for overclocking monitors. I suggest you to try it.

As for this pull request, there are a few things that need to be corrected. They are not critical so you can merge it in my opinion. When I have time I will try to update it.