Join also our Discord channel! Click here.

StuntGP 3D/2D Files (.PC and .PMD)

Post questions about game models here, or help out others!
Post Reply
Matsilagi
beginner
Posts: 27
Joined: Sun Aug 31, 2014 5:39 am
Has thanked: 2 times
Been thanked: 2 times

StuntGP 3D/2D Files (.PC and .PMD)

Post by Matsilagi » Wed Aug 30, 2017 6:14 pm

So, a friend of mine started working on StuntGP files https://yethiel.wordpress.com/2017/04/2 ... ructure-1/ to try and make the vehicles and tracks work in another RC racing game, and so far he needs to figure out the 3D and 2D file formats of them.

Source files can be found here for experimenting: http://files.re-volt.io/sgp/game_assets.7z

Any help is welcome.

Matsilagi
beginner
Posts: 27
Joined: Sun Aug 31, 2014 5:39 am
Has thanked: 2 times
Been thanked: 2 times

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by Matsilagi » Thu Nov 23, 2017 11:15 pm

Bump.

Its been some time, pretty please?

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 3165
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 862 times
Been thanked: 1737 times

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by shakotay2 » Fri Nov 24, 2017 12:57 pm

Matsilagi wrote:Bump.

Its been some time,
yeah, it surely has. While it's easy to get some decent point cloud (277 vertices) the face indices are a mess. You have to find out how they have to be used.
car1_PMD.JPG
I tried out triangle strips with some lines commented out (#) seeming unlogical to me but they are part of the "system", resulting mesh is still a mess.
f 3 2 1
f 2 6 1
f 1 6 5
f 6 4 5
f 5 4 9
f 4 8 9
f 9 8 7
f 8 12 7
f 7 12 11
f 12 10 11
f 11 10 12
f 10 13 12
#f 12 13 11
f 11 13 14
f 13 9 14
f 14 9 15
f 9 11 15
#f 15 11 13
f 13 11 7
f 11 10 7
f 7 10 15
f 10 9 15
f 15 9 7
f 9 16 7
f 7 16 8
f 16 14 8
f 8 14 10
f 14 17 10
f 10 17 12
f 17 7 12
f 12 7 8
f 7 16 8
f 8 16 10
f 16 7 10
#f 10 7 17
f 17 7 16
f 7 18 16
f 16 18 20
f 18 1 20
f 20 1 19
f 1 3 19
f 19 3 21
f 3 2 21
f 21 2 22
f 2 12 22
f 22 12 1
f 12 2 1
f 1 2 23
f 2 1 23
f 23 1 12
f 1 22 12
f 12 22 24
f 22 27 24
f 24 27 26
f 27 25 26
f 26 25 12
f 25 30 12
f 12 30 29
f 30 28 29
f 29 28 14
f 28 25 14
f 14 25 26
f 25 31 26
f 26 31 33
f 31 32 33
#f 33 32 14
f 14 32 34
f 32 29 34
# line with 34 29 35 missing?
f 29 34 35
f 35 36 37
f 37 36 40
f 36 39 40
f 40 39 28
#f 39 38 28
f 28 38 43
f 38 42 43
#f 43 42 41
f 41 42 43
f 42 44 43
f 43 44 47
f 44 46 47
#f 47 46 45
f 45 46 49
f 46 48 49
f 49 48 51
f 48 45 51
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

Matsilagi
beginner
Posts: 27
Joined: Sun Aug 31, 2014 5:39 am
Has thanked: 2 times
Been thanked: 2 times

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by Matsilagi » Fri Nov 24, 2017 11:41 pm

shakotay2 wrote:
Matsilagi wrote:Bump.

Its been some time,
yeah, it surely has. While it's easy to get some decent point cloud (277 vertices) the face indices are a mess. You have to find out how they have to be used.
car1_PMD.JPG
I tried out triangle strips with some lines commented out (#) seeming unlogical to me but they are part of the "system", resulting mesh is still a mess.
f 3 2 1
f 2 6 1
f 1 6 5
f 6 4 5
f 5 4 9
f 4 8 9
f 9 8 7
f 8 12 7
f 7 12 11
f 12 10 11
f 11 10 12
f 10 13 12
#f 12 13 11
f 11 13 14
f 13 9 14
f 14 9 15
f 9 11 15
#f 15 11 13
f 13 11 7
f 11 10 7
f 7 10 15
f 10 9 15
f 15 9 7
f 9 16 7
f 7 16 8
f 16 14 8
f 8 14 10
f 14 17 10
f 10 17 12
f 17 7 12
f 12 7 8
f 7 16 8
f 8 16 10
f 16 7 10
#f 10 7 17
f 17 7 16
f 7 18 16
f 16 18 20
f 18 1 20
f 20 1 19
f 1 3 19
f 19 3 21
f 3 2 21
f 21 2 22
f 2 12 22
f 22 12 1
f 12 2 1
f 1 2 23
f 2 1 23
f 23 1 12
f 1 22 12
f 12 22 24
f 22 27 24
f 24 27 26
f 27 25 26
f 26 25 12
f 25 30 12
f 12 30 29
f 30 28 29
f 29 28 14
f 28 25 14
f 14 25 26
f 25 31 26
f 26 31 33
f 31 32 33
#f 33 32 14
f 14 32 34
f 32 29 34
# line with 34 29 35 missing?
f 29 34 35
f 35 36 37
f 37 36 40
f 36 39 40
f 40 39 28
#f 39 38 28
f 28 38 43
f 38 42 43
#f 43 42 41
f 41 42 43
f 42 44 43
f 43 44 47
f 44 46 47
#f 47 46 45
f 45 46 49
f 46 48 49
f 49 48 51
f 48 45 51
Hmm, for the faces i can recognize the car but indeed, the final result is still not optimal.

I'll look a bit inside the format to see if i find info that may help.

martin
ultra-n00b
Posts: 3
Joined: Wed Nov 14, 2018 5:42 pm
Location: Varying
Been thanked: 5 times

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by martin » Sun Nov 18, 2018 1:52 am

StuntGP yeah I remember those burned hours while playing the game back in the young times. In past I have successful attempt to figure out model format (hmm at least most significant parts of it), it just seems to me that nobody else tried it yet or succeed.
As I remember while vertex coordinates were easy to figure out, faces definitions not at first shoot. Later on it occurred that vertices and faces lists are a single chunks defined for all surfaces and levels of detail (dfferent bodies). Those lists and some others like polygons definitions list are sliced into smaller ones within ranges specified by surface definition structure. All the referring indexes are valid for these sub lists slices.

The faces are not defined in common triplets manner, but as polygons with varying amount of vertices used of course. Faces definition sublist, as I keep naming it, is accessed in polygon definition struct. To confuse things, faces list is not pointing vertex directly but further another listed structure (with UVs and some other infos) which is finally points them.

I have dig out some snippets, I can publish current result after a few tweaks. This is work in progress so there are some things left to figure out.
sgp_meshes.jpeg
You do not have the required permissions to view the files attached to this post.

martin
ultra-n00b
Posts: 3
Joined: Wed Nov 14, 2018 5:42 pm
Location: Varying
Been thanked: 5 times

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by martin » Thu Nov 22, 2018 10:43 pm

Hey folks I hope you like seeing some progress don't you? Basically I'm done with textures as well. About a good stuff I got them all 8) :
sgp_meshes_textured.jpeg
Things looked so simple back in the old days, ehh. Since I don't fell well with compression algorithms and there is some backyard invention RLE derivative being used (I guess due to patents in 00's) I had to play with the assembly code for whole day, but it was worth the effort (took less time than asking orig devs for source code). Moreover there are some small issues like determining texture transparency or rotation matrices - because of problems with conversion from left to right handed coordinate system, but those can be easily fixed when manually editing the models.
After a polishing touches, everything should be available within a days in one package in hope that it will be useful for everyone nailing on this problem.
You do not have the required permissions to view the files attached to this post.

martin
ultra-n00b
Posts: 3
Joined: Wed Nov 14, 2018 5:42 pm
Location: Varying
Been thanked: 5 times

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by martin » Fri Nov 23, 2018 11:12 pm

As I promised here are the results what I got so far, meantime I switched to other projects. For whatever reason I prefer to share it there rather than between other code repositories. Because forum is limited to 1 attachment per post I had created new reply, hope that's not a problem. Attached archive contains files worth brief description:
  • Binary template for sweetscape hex editor for PMD files.
  • Python 3 crude script for blender >= 2.76 for importing those PMD files. Just paste it into blender's scripting mode, change files paths and run. Script requires textures images, if any of required ones is missing exception is raised. If you don't want any textures this can be skipped by commenting out relevant code parts.
  • Binary executable in elf format for converting PC files into ordinary bitmap files.
  • C and x86 ASM sources of the converter, if you want to build it under windows (untested) mingw and The Netwide Assembler are required.
  • BASH shell scripts for batch image files conversion.
Utilities for wad extraction, which is file system format used by the game, are available for the long time. Well that’s all, there are just a few short steps left to make things work in other/modern game engines.
Note for gamers: there occurred to be some extras left not used in game, example: horn upgrades in catalogue pages, any player should recognize that it is absent in final product.
If there is anyone seriously interested in compression and is able to read asm then may take a look and post something about it. This is only 400 lines of code with many parts redundant, algorithm is not building any dictionary, only remembers the sub-array to repeat into output when relevant code number occurs.
You do not have the required permissions to view the files attached to this post.

Halamix2
ultra-n00b
Posts: 3
Joined: Sat Feb 22, 2020 11:45 pm
Has thanked: 1 time
Been thanked: 1 time

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by Halamix2 » Sat Feb 22, 2020 11:53 pm

I just started to experiment with Stunt GP files without knowing about previous knowledge on the topic, so I made .wad extractor from scratch (although there is one segment that I don't know what it does).
Source code here: [url]https://github.com/Halamix2/stunt_gp_formats[/url]

Your code for converting .pc files is working (I'm trying to understand .asm to remake it in something higher level), although if you change line 56 in image.c to "hdrinfo->colorsMask[3] = 0x8000;" then you also get 1bit alpha channel.

After that I might try to understand and describe in text .pmd files

EDIT: It turns out the 4 parts of the dec.asm are identical, after changing loc_420264 to loc_42017A and removing lines 413-439 and 121-387 it still works, so it's now far easier to understand as now it fits in about 150 lines

Halamix2
ultra-n00b
Posts: 3
Joined: Sat Feb 22, 2020 11:45 pm
Has thanked: 1 time
Been thanked: 1 time

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by Halamix2 » Wed Feb 26, 2020 8:06 pm

.pc converter is done, it's written in Python and support 1bit alpha channel.
Pros:
  • Easy to read
Cons:
  • only .png output
  • no 1:1 16 bit A1R5G5B5 output, only converted 32bpp RGBA
Download: https://github.com/Halamix2/stunt_gp_formats

crysis150
ultra-n00b
Posts: 4
Joined: Mon Sep 08, 2014 6:53 pm

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by crysis150 » Sun Mar 01, 2020 9:36 pm

how use .pc converter on windows ? on my python27 i have error:

C:\Users\mtabi>C:\python27\python.exe C:\Users\mtabi\OneDrive\Pulpit\STUNDGP\pc_unpack.py
Traceback (most recent call last):
File "C:\Users\mtabi\OneDrive\Pulpit\STUNDGP\pc_unpack.py", line 9, in <module>
from pathlib import Path
ImportError: No module named pathlib

Halamix2
ultra-n00b
Posts: 3
Joined: Sat Feb 22, 2020 11:45 pm
Has thanked: 1 time
Been thanked: 1 time

Re: StuntGP 3D/2D Files (.PC and .PMD)

Post by Halamix2 » Mon Mar 02, 2020 7:56 pm

The script was made for Python 3, version 2.7 support stopped three months ago, so I never bothered with compability/rewrite of that script

Post Reply