Sparagas

User avatar

Posts: 29

Joined: Feb 17, 2014

Managed to crack something in game's 3D model files!

Post by Sparagas on Tue Sep 12, 2017 9:39 am

I managed to understand something about SH1 3D models!

I got frustrated that this game is so old, and still no one has ever cracked how to export 3D models from this old game, so I began my journey. I'm not a programmer, but after whole day of researching and playing with hex editor and game files I managed to get useful info about 3D models and it's structure in game files.

But first let's begin at beginning. I was looking at SH1 ModPack v1.2 witch has a lot of goodies, like HEX editor, extracted game files, and TIM viewers. So I decided to look through game textures and found one very particularity interesting. This one:

Image
(I swapped the palette to correct colors to see it better)

First it was very huge and detail texture (for PSX) and as I remember the game, it was only used in one location:

Image
(this is my own created pixel perfect map, if you didn't knew that)

Image

It was on a billboard only in this location
So I chose my texture. Now maybe I can find it's mesh model?
First I find it's file name in extracted game files:

Image
It is in BG folder (BackGround?), and it's name is THR5201F.TIM (.TIM is PSX common texture format, who didn't knew that)

Now what? In theory 3D mesh model should be connected with it's texture file, so let's try to find it in game file codes it's self. How? Enter the HEX editor! (provided in SH1 ModPack)

First I tried to open the texture file in HEX editor itself, but as expected didn't found anything useful.
When I opened the whole SH CD it self in Hex editor and searched for THR5201F and... I found it!

Image

And the best part is, that this name is used only once in the entire CD (That's why I chose the unique texture) and it's not in textures file it's self! So it's name GOT to be used in 3D model file.

So let's find it! But before we continue let's make a "commercial" brake and look more closely in BG folder:

Image

There are:
TIM files (textures of town and other areas)
IPD files (this is what I suspect are map 3D mesh models)
PLM files (looks like global files, that tells each IPD file where to go in the whole map)
and 2 weird BIN save files

And almost all files in this folder are coded like: APR, APU, BG, DR, DRU, MGR, RSR, RSU, SPR, SPU, THR etc. and some digits after that, like our THR5201F. (Note that this is not in decibels, but hexadecimals, that means digits go not from 0 till 9, but from 0 till 15 or F, but I hope you know that)

What does it all mean? If you look in textures you could easily find out that it's just coded for different maps, like
DR being Sewers and DRU Other-world version
RSR being Resort Area and RSU Other-world version
THR means Old town map

So if my theory is correct THR5201F name should be in one of THRxxxx.IPD files
So I searched all THRxxxx.IPD files in HEX editor and... Found it!

REVEAL SPOILER
Image

Image

This file is THRFAFF.IPD

So now we can say 100% that IPD files have maps 3D models. This is a fact. Period.
THRFAFF.IPD file is a 3D model that uses THR5201F.TIM texture.

Ok now what? Now we need to test the link between these two files.
What would happen if I replace THR5201F name with other textures name? Le'ts say APU05F

Image
(this one)

This is what happens:
Image

It worked! So the file name in IPD files are actual links to the texture files!
As you can see the game still tried to swap palettes, so the info to on what part of billboard to place what palette is somewhere else. It could be either in IPD or TIM file (yes, I know palette it self is on TIM file, but how the game knows what part to use on the billboard?)

Ok now what? Now we need to find out how big is model in THRFAFF.IPD file. Is it only billboard or bigger?
First I thought it will be 8x8 square area around billboard.

Image

I was too lazy to do my own wireframe image, so I borrowed one from internet and enchanted it.
I find out it when I did my pixel perfect map, that the whole maps are made from 8x8 tiles. And one square is one meter in outside world, and about 1/3 meter in inside maps.
(If you didn't knew what a wireframe is, it's when program doesn't draw textures, so you only see vertexes)
In wireframe it is easily to see the edges of the 8x8 tiles, because in PSX graphics they are wobbly and overlapping.
Also in fog-less mod you could see 8x8 tiles popping in and out:



Okey, let's get back to our main attraction. Is it really 8x8 tile?
Hey wait a minute, are these also textures?

Image

Yep!
THR0001F The most common texture used in the whole Old town map - ground texture
THR0002F residential houses and Walking sign
THR0003F more residential walls with doors and windows
THR0004F lot of signs

So in theory by swapping these words with the same APU05F word, should swap all textures used in THRFAFF.IPD file. Let's see it!

REVEAL SPOILER
ImageImage


It changed everything except trees and few signs in these 6 8x8 tiles:

Image
(This is zoomed in with white transparent squares representing 8x8 tiles)

We can finally change textures not globally, but locally. I mean we can change what textures uses that particular model, and not all models. We can change 3 houses texture color, and leave all others intact.
(we are still limited to using already existing textures through)

So we have two conclusions:
Global very common objects like trees and signs are stored somewhere else (maybe THR_GLB.PLM?)
And our IPD file contains 6 8x8 tiles of 3D objects. Or is it?
Whait what's this?

Image

These are not textures and there are 6 names + a SIGN... 6 names... and 6 tiles using textures in this model...
No way! Do you mean? let's find out! I swapped 6 names (except SIGN) with like:
REVEAL SPOILER
THR5201
THR5201
THR5201
THR5201
THR5201
THR5201

THR5206
THR5206
THR5206
THR5206
THR5206
THR5206

THR5207
THR5207
THR5207
THR5207
THR5207
THR5207

THR5206
THR5205
THR5204
THR5203
THR5201
THR5201


But result was almost always the same:

Image
Altered 8x8 tiles just disapeared, They were invisible, but the actual meshes were intact, because you could still walk on it, and bump in the houses walls and billboard. Also it effected only our 6 8x8 tiles and not trees and common signs.

Conclusion: these names ARE actually names of these 6 8x8 tiles, and if the link is broken, they will simply not render textures. Maybe they store information about palette usage?
And what about the SIGN name? Well remember in the beginning our texture THR5201F.TIM? In the top right corner is a street sign.

Image
(back part texture is stretched)

and it's location is in this particular square:

Image

But wait! it's not located in our 6 tiles zone!
Whats this?!?

Image

I just scrolled to the beginning on THRFAFF.IPD and saw ANOTHER set of model links!
How I have missed that? (the ones we examined were a little bit lower). And now we have 18. 18!
We have our same 6 tiles + a SIGN. When we got TREE02 (I wonder what this name links :roll: )
And we got names not seen before like THR0001.
THR0001 sounds very familiar like THR0001F.TIM witch is common Old town map ground texture...

Ok what would happen If I change these all names to like TREE02?

REVEAL SPOILER
Image
Trees! Trees! everywhere!

How about I change it to THR5201?

Image
Houses! Houses everywhere!

One more time with THR5206

Image
Billboards! Billboards everywhere!


Now seriously. When ever I swapped names to our 6 names + SING name, every our 6 8x8 and a sign location changed to that model. Also model at Sign location changed orientation. So some command in this file tells that particular model to rotate...
Also these changes were still visual. You could still walk through them and bump in invisible billboard and houses walls.
Finally we can change models (at least visually) to other models!

Now we have some familiar situation. Our 7 named models swapped models perfectly, but others disappeared.
So how much 8x8 tile disappeared? That's how much!

Image

So we now know that...
At least this particular IPD file is responsible for 5x5 tiles (well 19 tilles in this case, because others are behind houses and are empty)
Inside are unique 6 tiles and one extra location where textures are linked from inside
There are other common tiles where textures are linked from outside
These files SHOULD contain 3D meshes of these locations (at least unique ones)

We could make speculation that every other (or most of them) IPD files are also responsible for 5x5 tiles of 8x8 squares (or 40x40 squares (Fun fact: SH2 game map is also made of 40x40 square tiles - coincidence?))
That would make a lot of sense.

IPD digit names should also in theory correspond to they're geographical locations. Let's open corresponding IPD files. One before our THRFAFF.IPD and one after:

Image
They are THRFAFE.IPD and THRFB00.IPD

I just deleted the links to see what parts will be missing (you can do that by replacing it with zeroes in HEX editor). This is what I got - each file with deleted links made textures transparent in these regions.

Image

They are surprisingly not stacked in a row, but still are all near each other.
And we can safely say, that all IPD files are responsible with 5x5 tiles.
Also I haven't looked at all IPD files (because it is almost 500 of them!) But in the ones I looked, if they got links to textures it all got ...xxxxF at the end. Coincident? Maybe.

But let's back to our THRFAFF.IPD file. What about the 3D meshes it self? Can we pin point it?
Unfortunately, I am not a programmer, and "normal" English language ends in these files. There are only global links in the beginning of each file and local unique tiles who uses textures locally a little bit lower in each IPD file.

But before we end, let's play a little bit with our THRFAFF.IPD file. What would happen if we change the names (in the beginning) to not our 7 unique names, but global names like THR0001 (witch should be common ground model).
I deleted trees model, to not make mess, and left SIGN model, but changed everything else to THR0001

REVEAL SPOILER
THR0001:
Image
Streets! Streets! everywhere!

THR0037:
Image
Lamps! Lamps everywhere!

THR0002:
Image
Am... How do I cross this street?


The results are quite opposite:
If I change the name to a global, name and not unique from inside - it changes all models with it, but ONLY on global tiles, and not unique tiles. Billboard, and houses were invisible, but streets around it and sidewalk tiles changed.

So global common tiles respond to only global common names
And unique tiles respond only to unique names

What about if we use names not found in THRFAFF.IPD but lets say used in THRFB00.IPD? Lets try it:

global name THR0031:
Image
Garages! Garages everywhere!

unique name THR0605 makes everything invisible

With garages we can see that we have rotation inside the file, and it seems global names work, and unique don't.
But I'm tired of experimenting, and didn't tested other, so maybe this is only coincident or it only works, because they are close enough each other. I wouldn't know if it would work with object from other side of the map, like Church, Gas station or cached Harry's car. But I am confident that it shouldn't work with objects from other maps.

Well that's enough of experiments for me. This thing is too large for one person. What can we do as community?
Well we could document every IPD file in what location it is, and every global, and unique (at least global) names, and what models they are.
We don't need programming skills, we just need to swap or delete names in IPD files, and go in game to see what changed. There are almost 500 IPD files and who knows how mane object names...

Wait what's this?
Image

This is beginning of two IPD files, and they are the same size (others should be the same also)
I tried to swap them, but the region was empty and in game engine went slower and slower... It seems it tried to find the file to load it, but could, and locked it self

And wait, that's this??
Image

This is region between two "English" links, and I'm not a programmer, but it looks like coordinates. Maybe this is 3D mesh information?! I tried it - I replaced this region with zeroes, and... I was able to walk through walls and trees in this region! I still was able to walk on ground, and strangely, there were parts with invisible walls, where I couldn't get pass.
So I deleted or altered 3D meshes! So this is maybe one part of 3D objects info?

We could try to convert this in HEX2OBJ app or simply try to do it manually, but this is beyond my skills.

Okey, now it is really it from me.
I found what IPD files are, how textures and models are linked and how to alter them. But we still don't know how to extract models, and what global PLM files are. Maybe they hold all common global objects for that map? Also how global models get they're textures?

I still think this info will be very useful in the future, so I shared it to you all, and this information should be public (I once was able to replace game textures with my own, but didn't documented it, and forgot it how I did it... :( ), so if you also make new discoveries please let everyone know it!

Together we can make Silent Hill not so silent any more :ninja:
 
 
 
 
 
 

Otherworld

Member

User avatar

I'm going to town either way ...

Posts: 6513

Joined: Oct 11, 2013

Location: Canada

Managed to crack something in game's 3D model files!

Post by Otherworld on Tue Sep 12, 2017 11:23 am

WOW !!!
Image
Image
 
 
 
 
 

Johnny_Doe

Member

Posts: 59

Joined: Oct 17, 2012

Managed to crack something in game's 3D model files!

Post by Johnny_Doe on Tue Sep 12, 2017 2:03 pm

:shock: I'm speechless. This looks like some rocket science to me but I like where it's going.
 
 
 
 
 
 

Sparagas

User avatar

Posts: 29

Joined: Feb 17, 2014

Managed to crack something in game's 3D model files!

Post by Sparagas on Thu Sep 14, 2017 10:08 am

I'm such an idiot.
I opened THR_GLB.PLM file in Hex editor, ant this is the first thing I saw:

Image

It's in the beginning of the file. How I couldn't saw that earlier!
We can see this file uses 4 textures:
THR0001F
THR0002F
THR0003F
THR0004F

And a bunch of models. And they all are common objects, like street lamps, roads, common signs etc.
So my theory is correct: PLM are global map files that store common objects of the map, and IPD are unique models for 5x5 tiles sized regions.

And for fun I switched THR_GLB.PLM textures to see the result:

Image

As you can see, every common object changed texture, like ground, trees and lamps, but not unique objects, like street sign, and buildings (can't see in fog). And it changed in the whole Old Silent Hill map, and not only in our researched region.

Also if you want to know what names are used for what, this is what I find out:
usually otherworld map use U letter, and normal world R letter:
THR - normal old town map
SPR - normal central town map
SPU - otherworld central town map
RSR - normal resort town map
RSU - otherworld resort town map
DR - sewers map?
DRU - otherworld sewers map?
APR - normal amusement park map?
APU - otherworld amusement park map?

Also BG_ITEM.PLM looks like is responsible for common pickup objects, like heath kit, ammo etc.

Image
Let's make SILENT HILL just PLAIN SCREAM
 
 
 
 
 

roocker666

Posts: 35

Joined: Aug 19, 2017

Managed to crack something in game's 3D model files!

Post by roocker666 on Sat Sep 16, 2017 9:11 pm

Great work!, I was doing the same with the char models, there are like five unused models but it was a pain in the ass. I tried to change one and was a complete mess. I am not an expert but I did well!, The FRG model is a frog(enemy), you can see it now, I posted a new Topic. My goal is to bring those monsters to life!

Keep going like that!
 
 
 
 
 
 

nur_ein_tier

SHC Admin

User avatar

Posts: 6783

Joined: Jan 18, 2006

Managed to crack something in game's 3D model files!

Post by nur_ein_tier on Sat Sep 16, 2017 9:40 pm

Cool! I will have to look at this more later, working now though. XD
ImageImageImage
 
 
 
 
 

Alessa'sRevenge

User avatar

Tears of darkness

Posts: 40

Joined: Oct 01, 2013

Managed to crack something in game's 3D model files!

Post by Alessa'sRevenge on Sun Sep 17, 2017 1:37 am

Very cool to see new progress being made. I haven't touched SH1 stuff in ages because of how painful it is to work with it, but I'm still holding out to see someone grab all the textures with the right palette. Please keep us updated! :)
 
 
 
 
 
 

PaulSilentin

Member

User avatar

Posts: 150

Joined: May 01, 2014

Managed to crack something in game's 3D model files!

Post by PaulSilentin on Tue Sep 19, 2017 7:20 pm

Very interesting! I have something to think about.
 
 
 


Return to Silent Hill1 Modding



Who is online

Users browsing this forum: No registered users and 1 guest