BC46 / freelancer-hd-edition

Freelancer: HD Edition is a mod that aims to improve every aspect of the game Freelancer (2003) while keeping the look and feel as close to vanilla as possible.
https://www.moddb.com/mods/freelancer-hd-edition
168 stars 15 forks source link

Proper DX8 wrapper that only fixes Freelancer compatibility issues #14

Open BC46 opened 3 years ago

BC46 commented 3 years ago

In Windows 10 update 2004, Microsoft made changes to the DirectX rendering pipeline which caused the lighting in many base interiors to be broken. Additionally, the environment map materials for glass textures no longer work either. This particular issue has been present even before the Windows 10 update 2004.

Currently, we use dgVoodoo2 (a legacy DirectX wrapper) as an optional patch to fix all of the issues mentioned above. Unfortunately, its stability cannot be guaranteed as it may cause stutters, bugs and crashes while playing. Therefore, a custom DX8 wrapper that is both stable and focuses on fixing all of the issues mentioned would be a great replacement.

Edit: A DirectX 8 wrapper can be created using the DirectX-Wrappers project. By intercepting the set light calls it's possible to fix the lighting bug directly. Here's a proof of concept: https://github.com/BC46/freelancer-lighting-bug-fix. With this wrapper it's also possible to force native AA and AF within DirectX 8, which is ideal.

Freelancer on Windows 10 update 2004 and later

image

What it's supposed to look like:

image

BC46 commented 2 years ago

I found a stable solution that utilizes a d3d8.dll from an older Windows 10 version. Simply add it to the EXE folder of the installation and it'll work. It's so ingenious and I can't believe I never thought of this before.

Download it here: https://www.moddb.com/games/freelancer/downloads/freelancer-broken-interior-lighting-fix

One of the downsides is that it doesn't fix the glass reflection map issue, as that has been a problem long before that d3d8.dll was created. Additionally, other Freelancer-related compatibility issues will still be present since this solution can't be combined with d3d8to9 afaik.

BC46 commented 2 years ago

I found a stable solution that utilizes a d3d8.dll from an older Windows version. Simply add it to the EXE folder of the installation and it'll work. It's so ingenious and I can't believe I never thought of this before.

One of the downsides is that it doesn't fix the glass reflection map issue, as that has been a problem long before that d3d8.dll was created. Additionally, other Freelancer-related compatibility issues will still be present since this solution can't be combined with d3d8to9 afaik.

Looks like it is possible to do this with dxwrapper. Unfortunately with my configuration this doesn't seem to work properly https://github.com/elishacloud/dxwrapper/issues/134 . It's possible that I did something wrong here but I'm not sure.

dmutlu commented 2 years ago

Hi, I would like to see if I can replicate the issue. What station did you take your screenshots at? From my own testing, using dxwrapper with the stub, everything looks fine on Planet Manhattan and Newark Station. Thanks.

BC46 commented 2 years ago

Hi, neither Planet Manhattan nor Newark Station are affected by the lighting bug AFAICT. The screenshots from this issue were taken at Freeport 1 in Omega-3 I believe. In case you didn't already know, you can beam yourself there using the base bw01_02_base console command. Though this base interior specifically can be found at other bases too like Southampton Shipyard and Trafalgar Base in New London.

I think the lighting bug is most noticeable at the Liberty Dreadnoughts like Battleship Missouri in New York (base Missouri). At the ship dealer there, you can see that the lighting is very sharp and the shadows seem to look off too. Here's a good before and after screenshot: https://imgsli.com/NzM0ODI.

Also, what version of Windows are you using?

dmutlu commented 2 years ago

Thanks @BC46, I will check out both locations. I am using Windows 10 Enterprise 64-bit (10.0.19041).