narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
893 stars 67 forks source link

Question about Pixel Mixing #169

Closed PlayNeth closed 1 year ago

PlayNeth commented 1 year ago

Would it be possible to implement it into a standalone post-processing effect for DirectX 8-9 games? It is legit the best upscaling method I've ever come across, so having it available for most mid-late 2000s games that use dx8 and 9 would be fantastic.

narzoul commented 1 year ago

It's technically possible of course, but a completely new project would be a lot more time consuming than it sounds. The shader itself is trivial (https://github.com/narzoul/DDrawCompat/blob/master/DDrawCompat/Shaders/GenBilinear.hlsl), but it's not a "post-processing effect", it's a scaling filter, which is a lot more problematic to inject, since it involves overriding the display resolution that the game uses.

Overriding the display resolution introduces a bunch of other problems. For example, the actual desktop resolution will be different than what the game expects. The game's window either won't cover the full screen as a result, or it will be larger than what the game expects. A maximized window would also have a different size than with the expected desktop resolution. The mouse cursor has to be handled in some special way. If it's allowed to use the new resolution, then all cursor coordinates need to be translated to the bounds expected by the game. If it's instead restricted to the game's expected bounds, then any hardware cursor needs to be hidden and replaced by a software cursor at translated coordinates. If the game has additional top-level windows (on top of the fullscreen window), those may need to be scaled as well. All of this requires a lot of additional hooks to make sure the game displays as expected and doesn't run into any errors due to any of the above discrepancies.

Maybe it can be added to some existing projects that already support some kind of display scaling, e.g. GeDoSaTo or dgVoodoo 2. The latter already supports nearest neighbor upscaling + bilinear downscaling as far as I know, which should have pretty similar results.

I personally don't have time to work on any such projects. DDrawCompat may be eventually extended to DX8-9, but this is not likely to happen in the near future.

PlayNeth commented 1 year ago

I see. Thank you very much for your insight. By the way, just want to say that I'm very much grateful your hard work on the wrapper, it has completely breathed new life onto my favorite old PC games and without it I bet getting them to work at all would be a huge darn headache, so thanks again.