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
562 stars 41 forks source link

Help Needed: Specialized Room Adjustments #63

Closed Polymega closed 2 years ago

Polymega commented 5 years ago

@Bigmanjapan

Continuing from email conversation here are details about other rooms/areas that could use some love. Some of these have been discussed in the past but will be posted here just to make them easier to find/discuss, if needed:

Hotel Room 312 Chair Shadow (rr91.map)

The chair James sits on while watching the VHS tape doesn't cast a shadow while the cutscene plays. However, both before and after the cutscene the chair has a shadow once more:

image

Here you can also see a video of the chair regaining its shadow once the cutscene ends: https://youtu.be/JH109aNOpCA

This is a problem because, without the chair's shadow during the cutscene, we see only James' shadow and during certain parts of the cutscene chunks of his shadow are masked out:

image

image

I studied the parts of James' shadow that are bugged/masked out and it seems to actually make an abstract outline of where the chair's shadow should actually be.

And here is a PCSX2 (PS2) screenshot showing that the chair should have its shadow during this part:

image

If you watch the video link from above, we can see that James' can cast his shadow on the chair while the chair itself casts its own shadow (after the cutscene ends).

Since we know it's possible for the chair to cast its own shadow and the chair can also receive James' shadow, is there then anyway to restore the shadow to this chair during the cutscene?

Polymega commented 5 years ago

Perfect. Thank you again, Bigmanjapan.

One thing that completely confuses me is why adjusting most .tbn2 files doesn't change anything. For example, I can alter the flashlight lens flare (lens_flare.tbn2) and see changes in-game. If I do the same for something like the Strange Area 2 water texture (gesui01.tbn2) the game acts as if nothing changed.

There are two folders these files are saved under: \data\pic\effect\ and \data\etc\effect\

All files within seem to be identical and, at least for the modified lens flare, it pulls that one from \data\etc\effect\

sh2pc 2019-02-02 14-33-27

AeroWidescreen commented 5 years ago

One thing that completely confuses me is why adjusting most .tbn2 files doesn't change anything. For example, I can alter the flashlight lens flare (lens_flare.tbn2) and see changes in-game. If I do the same for something like the Strange Area 2 water texture (gesui01.tbn2) the game acts as if nothing changed.

I remember trying to replace the fog texture before, and naturally I assumed it had to be fog.tbn2 or fog.tex since those were the only two fog related files I could find. To make a long story short, I ended up deleting both of those files and the fog continued to work as normal. I gave up after that.

It's highly likely the game doesn't use those files, and if that's the case then where is it getting the textures for the water, fog, and other effects?

Polymega commented 5 years ago

Frustrated as well some months back, I was convinced the game has these textures (besides the lens flare, apparently?) stored in the main binary. So I removed all .tbn2 files from the game's directory and... The game would hang on launch. So whether or not the game actually uses those files for the textures, it seems to at least call/check if they're there to launch.

They're DTX3 DDS images just like any other texture the game uses, so I don't think it's anything proprietary or that the images are swizzled or such.

Bigmanjapan commented 5 years ago

I looked into this issue using an Xbox original console. Xbox and PC builds are almost identical and share the same useless files. Also if softmodded properly an Xbox original console usually has an option to clear a cache which covers a possibilty of some files being cached (in comparison to a Windows platform).

All files located in /data/pic/effect/ are not called by the executable at all. All files except for footmark.tbn2 and lens_flare.tbn2 located in /data/etc/effect/ are not called by the executable at all.

Since PC version is mostly an Xbox port, the same remains true for PC version: only footmark.tbn2 and lens_flare.tbn2 are needed to be present.

Nothing else in the Xbox/PC builds left that could contain fog, water and other effects assets which makes it save to assume that sh2pc.exe file contains all the effects.

As for why the useless files are present on Xbox builds at all.

Konami's porting team might have left all the files just in case an executable would want to call something. The same thing happened later on during Xbox to PC porting process when Calver's team left the unused files there just in case: https://twitter.com/DeanoC/status/1047870669067866112

Another scenario might be a failed attempt of Konami's team to parse PS2 files and make an Xbox executable use them directly. Maybe the platfroms were too different. If you use a Nisto's extraction script on any PS2 build, you will see that on PS2 builds there is no /data/etc/effect/ folder at all and /data/pic/effect/ folder has way less files. Meaning a lot of the files were added during PS2 to Xbox porting process but never used.

A simple copy-paste mistake is also a possibility.

Polymega commented 5 years ago

All files located in [...] are not called by the executable at all. [...] Nothing else in the Xbox/PC builds left that could contain fog, water and other effects assets which makes it save to assume that sh2pc.exe file contains all the effects.

Thanks a ton for looking into this. It was confusing me for the longest time so I'm glad we have final confirmation that only two .tbn2 files are used externally then. At least we can put this mystery to bed, now.

Bigmanjapan commented 5 years ago

Instead of softlocking RPCS3 renders red cross dummy image when textures are not found.

Absence of fog2.tex file: https://youtu.be/Y8steoBiCq0 Absence of gesui01.tex file: https://youtu.be/u-0cxZeuRUI

Polymega commented 5 years ago

gesui01.tbn2 is located in ps.map

This probably means all non-number map files (i.e. ap.map, hp.map, etc) would have these special texture data in them.

Here is the prison water restored to proper transparency.

sh2pc 2019-02-11 19-28-58

For this one, I set the white point to 128 instead of 255:

image

The PS2 (and probably Xbox?) version have a visual glitch for the labryinth water. Even when James' flashlight is off it behaves like it's still on in regards to enemies under water. So this is something the PC version does right!

https://youtu.be/4nk8XaRIuqY

Polymega commented 5 years ago

@elishacloud

I was able to find where these special .tbn2 files are housed. I adjusted both the Prison and Labyrinth water to good success so those edits will be reflected in a new .map file. However, I cannot do the same for the Alternate Hotel water. While I can change it texture-wise it's still not enough to restore its visuals as they should be. Adjusting addresses are required for these areas.

While there are nuanced differences in the water "intensity" per area in the Alternate Hotel, we're going to use universal values whenever possible that look good across the board, so to speak, so we don't have to also use Room IDs to change them per room.

I'll include the Room IDs below, but they should not be needed when scripting this out.

Play testing will need to be done, but I believe these can be set at the launch of game and left alone after.

SOME ROOM IDs ARE REQUIRED. Sorry Elisha, I forgot some of the addresses below we're changing for the Alternate Hotel water also affect the prison and labyrinth water areas. Room IDs will need to be used per value changes below.


Set on game launch/no room ID check needed:

This affects:


Set on game launch/no room ID check needed:

This affects:


Set on game launch/no room ID check needed:

This affects:


When Room ID:

Set:


When Room ID:

Set:


Suggested fix name: HotelWaterFix = 1 // Restores lighting values for the hotel's water

Polymega commented 5 years ago

@Bigmanjapan Can the boundary for this camera angle be adjusted to prevent the fog from disappearing when oriented in a particular way? This is right upon exiting the apartments: https://youtu.be/LeHhhIoKzrU

If I were to guess, I'd say this would be cc11.cam

Bigmanjapan commented 5 years ago

@Polymega The issue doesn't stem from the particular angle's camera being too far from the fence. It seems to be the same issue that happens with the disappearing chainsaw wooden log upon James going too far.

A semi solution could be changing that camera angle preset which fixes the fog issue. This archive contains preset 1 and preset 4 (the default is 3). Try them, maybe they will do. The most notacible difference is that transition from this camera angle to the next one is more rough.

cc11_presets.zip

Polymega commented 5 years ago

The most notacible difference is that transition from this camera angle to the next one is more rough.

Yeah, I see what you're saying. That rough camera shift is probably more of a concern than the fog disappearing. It may be best to not change the preset here then.

One thing I did notice is that preset 3 (default) sits the highest above is rotated the most parallel to James (which makes the fence look the lowest on the screen):

untitled-1

Perhaps there's a certain vertical threshold from James that triggers near-fog in front of the camera to not render.

Polymega commented 5 years ago

@FrozenFish24 May I ask for your help with another geometry adjustment? This would be for er01.map (the beginning bathroom).

When playing in widescreen we now see a much closer look at the bottom of the toilets when the beginning cutscene plays out... and it doesn't look quite right:

image

My suspicions were confirmed the other week when I watched a video (maybe a streamer? I can't remember) play the game in widescreen and commented how there was still camera clipping issues when they noticed that part of the toilet; they mistakenly thought that bad geometry was a camera clip issue.

However, that can be addressed!

image image

The UV placements remain untouched. The amount of vertices/polygons remain untouched. The only things that have changed are vertex placements for the geometry.

There are two separate, adjusted geometry groups for this file:

image

The main group is the toilets, and the other group are plumbing rings that are not grouped with the rest for some odd reason. (When adjusting the toilets I had to make the plumbing pipes taller to compensate the change, hence their adjustments as well.)

May I ask you to replace the toilets and their plumbing?

Here are the OBJs: toilets+REFERENCEWALL.zip plumbingRings+REFERENCEWALL.zip

The reference wall is the wall that's behind the toilets/plumbing for sizing/placement reference.

Thank you very much for your consideration with this!

FrozenFish24 commented 5 years ago

Here you go @Polymega :toilet:

er01.zip er01

Polymega commented 5 years ago

What a beautiful, clean job you did swapping out... dirty, nasty toilets. Thank you, FrozenFish24!

Polymega commented 5 years ago

@FrozenFish24 Can we get a little creative with optical illusions? In ps37.map (Strange Area 2/Prison water hallway) the level abruptly ends right past the jail bars on both ends of the map, something that's easily noticeable:

sh2pc 2019-02-21 20-15-50

We can't change the fog parameters to fade this out as there are no fixed cameras in this area to only apply adjusted fog values when looking through the jail bars.

We also can't duplicate the geometry to extend out the hallway because this area uses dynamic water. (As we don't know how to readily extend out water effects.)

But we can create the illusion of the hallway continuing onward by placing some geometry inside this area--slightly smaller than the hallway itself--and adding a black fade alpha to a texture file and apply it on the new geometry:

image untitled-3

Which gives us this result:

untitled-4

Files

Here is an OBJ of the new 'black fade' geometry (green group) and the ceiling (white group) for size/placement reference:

OBJ: prisonRoomBlackFade+CEILINGREFERENCE.zip Edited texture file: ps37.map_tex_002.zip

image

Thank you!

Polymega commented 5 years ago

Phew... this one was an ass-kicker but I love trying to make the most out of UV real estate. Another geometry adjustment if you'd be up for the task, @FrozenFish24 . When playing in widescreen, and without an adjusted .cam file to hide this window, you see a solid white piece of geometry covering the hole of the window you just climbed through:

sh2pc 2019-02-25 23-36-37

Oringally, we moved the camera to hide this. But what if we revert this camera change, remove that white piece of geometry, and add part of Woodside back?

sh2pc 2019-02-25 20-32-24 capture01 sh2pc 2019-02-25 20-29-38 capture002

(Yes! I even matched the camera angle/focal lengths and lighting to ensure this would work/look good!)

Not only would this look nicer, but it's also user/player friendly: If they can see the window with outside geometry in it, they'll know/remember this is the window they climbed through (if they ever have to go back in case they forgot something).

If this is something I could ask your help with, @FrozenFish24 , here is what's changed:

  1. The geometry covering the window must be removed/moved out of the way:

image

  1. Here is the new OBJ geometry along with the bed for size/placement reference: ap64_NewWall_WithBedReference.zip

image

  1. Here is the modified texture file. The UVs for the new geometry are already placed where they need to go; the geometry just needs to be linked to this texture file: ap64.map_tex_012.zip

001

Thank you always for your consideration on this and the prison post above. I'd love to also know your thoughts if "opening up" the window here would help with user experience for first-timers.

A heads-up: Currently the lighting transition in this area was previously bugged. If you download the latest version of the SH2 Enhancements module this room/area will have proper, restored lighting transition values.

FrozenFish24 commented 5 years ago

@Polymega These two edits may take a little while as geometry using transparent textures is stored differently in the map files and my tools do not currently handle this, so will require additional reversing. I'll be busy for the near future but I'll try and get these done for you as soon as I can.

Really nice work on these edits by the way :+1:

Polymega commented 5 years ago

Hi @FrozenFish24 , If I may make another request for the list: This is would be for ma85.map.

Using a widescreen camera we can see an empty void on the other side of the wall in the bottom left corner:

sh2pc 2019-03-10 20-38-24

This would add sidewalk and street geometry for the area:

image

The attached OBJ has the sidewalk + street geometry along with a grass plane for size/placement reference: ma85_streetAndSidewalk.zip

image

And this following texture image has been updated to support the new UVs/textures. This texture file and the new geometry do not use any alphas: ma85.map_tex_010.zip

ma85 map_tex_010a

Thanks for your consideration with this!

FrozenFish24 commented 5 years ago

@Polymega Annoyingly, the geometry that uses this texture is also stored in the transparent section for whatever reason. I've still not had a chance to look into further reversing yet, but I should be able to find some time soon.

Polymega commented 5 years ago

No worries, friend. I just happened to discover another void there and thought it good to exercise the 3D muscles once more. Really appreciate your work and contributions with everything.

Polymega commented 5 years ago

Hi @FrozenFish24 ,

If I may ask, have you had an opportunity to dig into the .map files more?

FrozenFish24 commented 5 years ago

Hey @Polymega I've not had a whole lot of free time lately so I haven't made much direct progress on this front. But I have been incrementally documenting the format when I can. Most recently I found the bounding boxes used for frustum culling parts of the map, which may be useful at some point.

I'll hopefully be able to get something useful going for you soon. Thanks for your patience :+1:

Polymega commented 5 years ago

No worries FrozenFish24! Take the time you need and, really, this is worth saying again: Thanks for everything you're doing here. You've helped fixed bugs we were completely stumped on which then allowed us to improve many other environments, along with your Direct3D research to fix other avenues. You rock!

Polymega commented 5 years ago

Hi @FrozenFish24,

May I ask of you to swap out some UV placements for the Dog Ending room? Nothing has changed geometry-wise, just the UV positions for the computer wall with the four monitors has been adjusted: dog_ending_four_monitors_UVs_adjusted.zip

Edit: Sorry, forgot to mention the map name is qp05.map

Thank you for your consideration

image

UVs

Polymega commented 4 years ago

@FrozenFish24

Thank you so much for everything. We have a few more fixes/adjustments we plan to do before this next release. May I also ask for geometry adjustments to some .map files? I know geometry/textures that are linked to transparent images isn't cracked yet, but I believe the following below aren't tied to any transparent textures (I might be wrong):


:black_square_button: Remove duplicate prison bars for ps85.map

In regards to this post.

A fan of our project noticed the prison bars have a glitchy effect as the cutscene plays of you finding Maria in the prison cell. I looked into it and it turns out Team Silent accidentally duplicated the vertical prison bars, so there's two instances of the geometry which causes the odd rendering effect (this affects all versions of the game): https://www.youtube.com/watch?v=BRL90l2_uiQ

Can the duplicate geometry of the vertical prison bars be removed for ps85.map?


:black_square_button: Fix bad edge looping for piece of geometry in forest trail

This is one that's only an issue when played in widescreen. The edge loop/edge flow for a piece of the forest trail hill is broken for ca09.map, which results in a stray vertex that isn't connected to any other vertices:

sh2pc 2019-03-23 01-43-45 sh2pc 2019-03-23 01-37-46

Deleting edges below the offending poly and then connecting that stray vertex to its corresponding neighbor vertex should fix this rendering issue:

Untitled-1


:ballot_box_with_check: Adjust UVs for DOG ending monitors

See the post directly above this one for new UV placements. I have a fun idea/plan for this adjustment that will involve the Silent Hill community as a whole. :)


Thank you always :heart:

FrozenFish24 commented 4 years ago

Just letting you know I am working on this. Been hitting some road blocks with my scripts though so it might be a little while.

I've finally put them up on GitHub by the way, though they're very rough and not much use to anyone but me at the moment: https://github.com/FrozenFish24/SH2MapTools

Edit: Here's one of the problems I've run into in case you're interested. Certain maps use vertex colors for static lighting so I'm currently having to switch my scripts from generating Wavefront OBJ to COLLADA because the former doesn't support vertex colors.

This also means to modify maps like ps85 seamlessly we need to work out roughly where Team Silent placed their light sources, their intensity and somehow bake off that information to each vertex's color in addition to any edits.

vertex-colors

Polymega commented 4 years ago

Certain maps use vertex colors for static lighting

I'm sorry. I wasn't aware this was something Team Silent done and how this would add an extra wrinkle/headache to the mix.

Knowing this now, I would assume then, that, indoor areas with no specialized lighting don't have special vertex coloring. That's why adding geometry for places like the indoor Hospital and Apartment rooms was more straightforward.

Whereas the Maria prison cell is "naturally" lit (so vertex colors are used). The same would probably be true for Hotel Room 312, then (using vertex coloring).

Polymega commented 4 years ago

Hi FrozenFish, Have you had any leeway with the script and the vertex coloring? Is there anything I can do to help? I'm happy and willing to do whatever I can, so long as you can excuse my programming-impaired brain.

FrozenFish24 commented 4 years ago

Sorry this is taking a while @Polymega, been a bit busy these last few weeks. Here's the Dog Ending room with the UVs adjusted to tide you over: qp05.zip

I've implemented most of the changes I need to support vertex colors and I've got the edited geometry ready to export so I should have the others done for you in the next few days.

Polymega commented 4 years ago

No worries, friend. We're hoping to include up-scaled, properly-fitted main menu, save screens, and maps for this next update as well, so there's no imminent deadline for anything at the moment.

Thanks for the adjusted UVs for qp05. With that adjusted, would you mind casting your vote? :) https://twitter.com/WhereAllBegins/status/1202322711676116993

If I may recap the additional earlier requests, plus one for Hotel Room 312, to have everything recollected:


:black_square_button: Add "fade out" geometry to prison sewer room

In regards to this post.


:black_square_button: Add street geometry for outside Baldwin Mansion

In regards to this post.


:black_square_button: Add apartment geometry outside of Blue Creek window

In regards to this post.

We can then revert the camera position to default for this area to re-show the window. This'll also help visually guide new players for the game, to let them easily see that's the window they came from and that they can go back through it, if they need to.

Also, with the advent of vertex coloring, can all geometry outside the window/window sill have a vertex color of 255 (full brightness)? The idea would be to hopefully prevent James' flashlight from having any influence on this new wall (because his light will shine through the current room's wall due to the general limitation of the game engine).


:black_square_button: Replace low res 2D fence with 3D model

For Hotel Room 312 (rr91.map), can the flat geometry that makes up the low res 2D fence texture be removed and replaced with a 3D fence model instead?

Video example

Given the importance of the cutscene that plays out here--and how prominent this fence can be during the cutscene--it'd be ideal to have it look nicer. The heavy pixelation from the flat texture makes it a bit distracting, otherwise.

Attached is an OBJ of the 3D fence. I didn't include a "reference" piece for size/scaling as it's probably pretty intuitive how it should fit. The new 3D fence shares/uses the same texture file as the original 2D fence:

rr91_NEW_3D_FENCE.zip


:black_square_button: Final request

It's easier to verbally explain this one so I made a video for you and sent the link to your email. Thank you <3

FrozenFish24 commented 4 years ago

Cast my vote and checked out your email. Nice edits as usual, you're very talented!

I've still not RE'd the whole "geometry with transparent textures" thing sufficiently so several of these might take some time. Otherwise I'm on it!

In regards to the Blue Creek Window, I don't believe any areas where you can use your flashlight have vertex color-based static lighting. I imagine we could just exclude your wall like we do the TV Static/Heaven's Night Windows (though this may also exclude the window frame and shutters).

Polymega commented 4 years ago

I don't believe any areas where you can use your flashlight have vertex color-based static lighting

Ah, that makes perfect sense. I think I even hypothesized that previously but forgot (which is why it was possible to edit previous areas as you've already done).

I imagine we could just exclude your wall like we do the TV Static/Heaven's Night Windows (though this may also exclude the window frame and shutters).

True! Also, another hail Mary idea I had was to set the normal angle for the outside wall to an extreme angle to help make the wall bright.

But before worrying about any of that, I'm hoping the light source that's already plugged into this room by the game will brighten that outside wall for us automatically, so we don't even need to worry about it.

My only potential fear is, due to game engine limitations, James' light will shine through the wall onto the outside wall, making it look a little odd:

image

My hope is if the outside wall is full brightness, the flashlight's light can't influence that wall's brightness any further.

FrozenFish24 commented 4 years ago

Making progress on the transparent geometry front:

ps85

Polymega commented 4 years ago

That blood pool is the prettiest blood pool I've ever seen because it inspires progress and hope! 😍😍

Polymega commented 4 years ago

Hi @FrozenFish24 ,

Exciting times are ahead as we hope to release the next update sometime next month! (Hopefully no later than mid-to-late February.) Have you had any opportunities to experiment more with the .map files?

FrozenFish24 commented 4 years ago

@Polymega I'll admit I've been burnt out since my last post from staring at hex dumps and the obtuse layout these files have. But my enthusiasm has recently returned and I was planning to do some more work on it this week.

If I'm unable to get my tools working universally, as I'd like, I should at least be able to have your map files done by Feb :+1:

Polymega commented 4 years ago

I'm sorry about the burn out. And it's completely understandable. Virtually no detailed documentation on these formats just leaves you in the dark, and frustrated. And then you got folks like me being starry eyed, just to compound it.

Thank you for the update, and your patience with the whole situation. Seriously though, no worries about pushing the work off until an update after this one. I'm more concerned about you and your long term enjoyment working with the project.

But hey, I don't know how often you check your email, but I sent you something cool to start off your week. :)