elishacloud / Silent-Hill-2-Enhancements

A project designed to enhance Silent Hill 2 (SH2) graphics and audio for the PC. It also includes scripts to build or modify SH2 audio files (SFX, BGM and Dialog).
http://www.enhanced.townofsilenthill.com/SH2/
zlib License
594 stars 41 forks source link

Humbly asking for guidance as I start a multi-year Silent Hill 2 endeavor. #339

Closed umbrellacorp53 closed 3 years ago

umbrellacorp53 commented 4 years ago

In this last update you replaced low resolution fullscreen images with HD upscaled replacements, and you also swapped out the fog texture from x256 to x512. If anyone knows how to answer my questions they're in this project. I'll try to keep it brief.

I've started perusing game assets and I've come up with a loose gameplan for a personal "HD Project". In all likelihood this will remain a pet project that takes a backseat to my education and career, but I absolutely love this game, and after the passing of a close friend of mine who introduced me to the series when he let me keep his copy of Silent Hill 2 for Xbox... I really want to do something special that I think he would have appreciated (or at least levied heavy criticism and insults at me for even trying lol).

Anyway, I've seen an old tool for inspecting and extracting game textures that's been floating around but before I go stabbing blindly and get heavily invested in this project I want to ask some questions:

What is the best tool for extracting textures and once edited at a higher resolution converting or repacking them?

Is there anything I can or should do in order to save on file size while preserving detail and minimizing conversion artifacts once I have a finished asset? Put simply, what are the best practices that you've observed either generally in the realm of game design, or more specifically with the design of textures made for this project? Put simplyerer, any dumb shit I should avoid other than cranking quality to eleven or saving in 8k resolution?

Have you seen any hard limits on RAM/VRAM usage during your work on the EE? I'd like to not cause serious stuttering or crashes. I know sometimes older engines DO NOT like being pushed beyond their expected memory usage. Not sure if anyone has experimented around with a high-res texture overhaul but I'd like to know if there's some technical quirk that would make this a fool's errand before I get elbow deep.

Finally, if you can think of anything else I haven't mentioned that was KEY in your workflow on the recent texture work or just general advice on the subject, or advice on life, or just want to tell me how your sex life is, I'm all ears.

So sorry if I've wasted anyone's time. I'm pretty set on this. If its just a dumb idea then I want to hear it, but even if I just swap out a few blurry wall textures for my own personal project I'll be a happy camper. Ideally though, I'd share it with you guys over time for constructive obliteration and passive aggressive shaming tactics. Thanks for reading.

umbrellacorp53 commented 4 years ago

I'd also like to follow up and say that I fully understand if you don't want to pour out a bunch of info that you've worked very hard to acquire to someone who may not even follow through and has shown nothing to warrant being taken seriously. I'm going to start extracting and editing files through SH Texture Explorer and will use trial and error for the time being. I will either update this issue with progress, or if you'd rather not have another open issue on your project I can work on this elsewhere. I'd like to maintain contact though and am not sure the best means to have an open communal discussion with the EE team without creating an issue.

Polymega commented 4 years ago

Hi umbrellacorp,

I'd also like to follow up and say that I fully understand if you don't want to pour out a bunch of info that you've worked very hard to acquire to someone who may not even follow through and has shown nothing to warrant being taken seriously.

You're fine. We've just been staying busy following up and helping newcomers to the project after our latest release from a few days ago. The downtime doesn't truly happen until a few weeks after an update release.

I'll try to answer your questions as concise as possible.

What is the best tool for extracting textures and once edited at a higher resolution converting or repacking them?

Opening the SH2 .tex files through a hex editor such a HxD. The SH Resource Editor SH Texture Explorer you're using introduces artifacts when exporting/re-importing textures, does wonky things to the alpha channel, is hardcoded to not allow you to change the texture resolution from its original size, and probably can't handle viewing upscaled textures after-the-fact.

The full screen textures (.tex) from the game are simply DXT (DDS) format images with a custom header. If you view the original textures in the SH Resource Editor SH Texture Explorer, it'll tell you what DXT format they are. Although, DXT2 is actually DXT3, and DXT4 is actually DXT5.

Is there anything I can or should do in order to save on file size while preserving detail and minimizing conversion artifacts once I have a finished asset?

It won't matter, as DXT is a lossy (compressed) file format. To save your images out in DXT format in Photoshop, you can download and install the DDS plugin for Photoshop made by Nvidia.

When you save out your images in Photoshop, choose the right DXT format, disable mipmapping, and that should be it. You'll then open this DDS file in a hex editor, copy the body of hex data, and paste it into the SH2 .tex file, replacing its body data with the new body data.

After you do this, you'll then need to edit the original header data of the SH2 .tex file to match the new details of your image.

These are the fields you'd need to change in the header of each texture file to increase its width/height, along with where the DXT format is held:

image

In the image above, you can see if you select the correct bytes it'll show you their conversions in different values. If you click/highlight the A0 05 bytes, it'll show you it is 1440 (width in pixels) when looking at the Int16 field off to the side, as an example.

You can change the value in this field and the bytes within the hex data will update itself accordingly.

(Note we have hardcoded certain textures to be widescreen, such as the main menu, save screens, and maps.)

Have you seen any hard limits on RAM/VRAM usage during your work on the EE? I'd like to not cause serious stuttering or crashes.

Yes, there are memory limits for the textures. This is something Elisha had to address to make the upscaled textures work in-game, by increasing the memory buffer for the textures.

Finally, if you can think of anything else I haven't mentioned that was KEY in your workflow on the recent texture work

Mostly that most of the full screen textures are very particular. Some require no alpha channel be saved out, some require the top and bottom of portions of the alpha channel to be 100% transparent, etc. The game is very finicky with alpha channels in general, so trial and (a lot of) error is what it boils down to, to ensure the game will play nice and not crash with the images.

but even if I just swap out a few blurry wall textures for my own personal project I'll be a happy camper

Do note that Elisha's increased memory buffer only works for upscaled full screen images. To upscale environmental textures (found in .map files) is a whole other ball game, of which we barely scratched the surface of and haven't truly cracked yet.

The good news is the memory sizes for environmental textures are held/contained within their respective .map files so, theoretically, the game shouldn't need to have any memory buffers increased to upscale these types of things; just everything needs to be correctly edited and accounted for in every .map file. But again, this is something we really haven't researched much into... yet.

While I was able to increase the fog texture's resolution, that is essentially a drop in the bucket of what else still needs to be researched and understood for the .map file format. To be honest: I was only able to increase the fog texture because of FrozenFish's preliminary findings with the .map data. I was able to use his findings and compare it against other pre-existing values for textures in other .map files to adjust the fog texture. To increase textures to all new, substantially higher resolutions in .map files is something I can't comfortably give you any advice on at this time, because so much is still unknown for me with them.

Polymega commented 4 years ago

Texture data within .tex, .map, and .tbn2 files is DXT format; it's all the same. You can use the photo above to find general location of bytes that determine DXT type, or could possibly be loaded in the old SH Resource Editor and it'll tell you DXT type there.

umbrellacorp53 commented 4 years ago

I'm sure it's been crazy busy after update 6, so thank you very much for following up. Your instructions and tips have saved me (at least) days of troubleshooting. There's literally nowhere else to go for some of this information as I'm sure you know. Of course, it's disheartening to hear how involved even a single texture swap is, considering the sheer number of textures, but I'm sure it's par for the course that you guys have been dealing with.

The extent of my coding experience is writing a text adventure on the Commodore 64 in junior high, so I'm certain the only progress I'll make will be through the contents of this post and a lot of trial and error. However, when the time comes, if the EE team happens to make a breakthrough, I will be working on the DDS files and trying to make them work and I may ask for input or feedback when things settle down.

Thanks again and good luck with the specularity fix and whatever else is coming up!