ThirteenAG / WidescreenFixesPack

Plugins to make or improve widescreen resolutions support in games, add more features and fix bugs.
https://thirteenag.github.io/wfp
MIT License
2.27k stars 216 forks source link

[SH2] Fog fix/WineD3D/WSF incompatibilities #257

Closed seagull closed 7 years ago

seagull commented 7 years ago

Hi everyone; I've been doing a lot of my own research, but I can see I'm clearly in a very good group here, so I hope you'll all be patient with me and help me to work out the best combination of fixes for my device. I'm running an NVIDIA card, so SMAA shouldn't be an issue, at 1920x1200. In addition to the standard, boilerplate issues every SH2 fix remedies by now (looping sound, broken saving, single-core affinity, safe mode, screen resolution), here are the issues as I see them:

The biggest issue for me is that both WineD3D and the Fog Fix are called D3D8.dll. I tried using ThirteenAG's ultimate ASI loader but only the Fog Fix works with it, WineD3D doesn't – as such, the fix is pointless because it only works when they're running together. This basically forces users to choose between realistic fog or vertex shading. It's compounded by the fact that the fog fix is closed-source, making it impossible to merge into another project.

Has anyone been able to find a fix for this? I hate disabling my vertex shaders. Thanks everyone! Great work with this, you're doing a beautiful thing for SH fans.

Polymega commented 7 years ago

You may be right. I'm at work and am going off memory and if one thing has been certain these past months discussing the fixes with you all here is that my memory can be shoddy. The flashlight may be sexy-round right out the gate as you said. I'll definitely take your word on it!

Quaker762 commented 7 years ago

@Red-Pyramid-Head

definitely found out it is quite archaic though... Sort of. It's basically just flat RGB(A) image data with no compression. You might want to look here to see how it's done:

https://github.com/Quaker762/sh3redux/blob/master/source/SH3/graphics/texture.cpp

You need to look at the header to examine what type of pixel format has been used (RGBA5551, BGR, BGRA, RGBA, RGB or 8-bit indexed like a Microsoft BMP). Everything that isn't an indexed texture can be converted from a TGA back to .TEX by performing the appropriate translation. To convert a TGA back to an 8-bit indexed image, I'd go with the following route (at least a rough idea):

  1. First pass; walk the image and gather all colours used. Create some kind of index table.
  2. Rearrange colour table in reverse of what is in texture.cpp:197
  3. In the data area, write convert all pixels in the image to indexes.
  4. Copy rearranged palette to the palette area (at the end of the file).

Another interesting fact (and as @seagull 's video explains) is that the texture files are still in their Playstation 2 format. If you look at this paper you'll notice that if you load up the raw image data from SH2/3, they look identical to the ones seen on page 3.

Slightly more on topic, does anyone here know any more about fog? I assume it's textured and multi layered (i.e viewing frustum limit, distant fog and then animated texture fog), but we're a bit lost. (we desperately need more programmers/people reverse engineering haha).

Polymega commented 7 years ago

I'm not an authority for this but I believe the fog in SH2 are poly planes with alpha textures on them that float, squash, and stretch in the air.

SH3 it seems like they used some type of shader algorithm to make the fog?

Red-Pyramid-Head commented 7 years ago

@Quaker762

Thank you so much for compiling that detailed list (Also thanks @Aero52 ! I really appreciate both of you putting me in the right direction and in more clear ways I should focus rather than experimenting with the vast area). Apologies for being quite quiet, hopefully I will be able to return with some good results soon enough. This is 'fun' but at the same time... frustrating .. hah I find myself looping through nothingness sometimes... @_@

CHNSK commented 7 years ago

@Aero52 I have more good news to share. Nemesis2000 responded to my email and he apparently fixed the problem with the fog size and made some other changes. 😃 Download the latest archive from ps2wide.net and give it a try.

Just noticed. There are more settings. Is it possible to slow down the speed of the fog? I feel it's kinda fast, or it's just me?

seagull commented 7 years ago

It's Nemesis' fix, you'd need to ask him.

CHNSK commented 7 years ago

Nah, when I was very desperate to find something for the SH2 fog and first discovered his testing, I've insist too much for the release and been very 'spammy' about it on his channel and profile. He finally released it and replied to me he doesn't work on this kind of work anymore and moved on and that was long ago. Now that he recently updated the fix, I'd rather not to annoy him any further about this. So a lil 'windy' it is.

seagull commented 7 years ago

Everyone; The fix available from AppVeyor currently adds a setting for "Fix2D". Disabling it stretches the 2D assets, removing the grey bars from the map/save screen and, thusly, killing the final issue I had with the PC port. They've done it! Silent Hill 2 on PC is now as good as I reckon it can ever get. (I don't consider soft shadows to be within the remit of a widescreen fix.) I've donated a few bucks to the project. I hope it gets divided amongst whoever helped make this a reality. Silent Hill was an immensely important part of my youth and today I can finally say it's been done justice on modern devices. Thank you so much everyone who got involved, shared knowledge, etc. This is a huge day for me.

Polymega commented 7 years ago

Thank you for this notification. I'll also update the Widescreen Installation guide to address this in its FAQ. Any other noteworthy changes for SH2WF over the past month or so?

AeroWidescreen commented 7 years ago

We added SteamCrashFix. That's it I think.

Polymega commented 7 years ago

Thank you, sir.

Also, ThirteenAG implemented the revised ReShade code so ASI's built-in D3D8to9 works correctly with SH2 which means we can drop the ENB Converter from the installation steps.

(Also revising the Widescreen Installation guide for this as well.)

seagull commented 7 years ago

I'll be keeping a close eye on your new guide, @jdkubiak, so I don't mess it up. Fewer components means fewer links in the chain, but I'm terrified of removing something like the ENB converter and then finding that it breaks some tiny thing six months down the line.

I also think you should drop a variation of the heading "mating room lolr" in there.

Polymega commented 7 years ago

The guide has been updated. For your records @seagull (assuming you've followed the guide's steps) to update the files without doing a fresh install of everything:

seagull commented 7 years ago

Thank you! Can you think of any quick way off the top of your head to make sure it's working properly?

Polymega commented 7 years ago

I can! Any spot where you know black lines on faces can appear is an easy way to check. If they're not there then it's working.

Also, if you're an Nvidia user: Go the beginning of the game or to Woodside Apt, 2F, Rm 209. If the white shaders are fixed then it's working: https://youtu.be/878F2cbLAXo?t=2m39s

Polymega commented 7 years ago

Oh, and of course make sure you're still using WineD3D For Windows' files.

seagull commented 7 years ago

OK, I think it worked. I went to the beginning and couldn't see any white shaders or black lines. Nice one, much obliged.

AeroWidescreen commented 7 years ago

Sorry guys, I was busy earlier so I only glanced at each thread. Everything has been added to the stable release, so no need to use AppVeyor (dev build) to get these changes. Modupdater should take care of it for you, assuming you have it installed.

(Also revising the Widescreen Installation guide for this as well.)

I updated the wiki as well. Not much needed to be changed for Silent Hill 2, mostly Silent Hill 3.

Also forgot to mention: there seems to be a misunderstanding regarding donations. I don't get any money from those Patreon or PayPal links, which is fine, but I wanted to clarify so you know where your money is going.

seagull commented 6 years ago

Hi guys, just wanted to quickly say I made a short video showing off all the new features. https://www.youtube.com/watch?v=XQ1WGBk_obs Let me know what you think!

Polymega commented 6 years ago

Nice!!

Polymega commented 6 years ago

I've just made a directory tree listing all the fix files to help others: http://widescreenfix.townofsilenthill.com/SH2/#directorytree