Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

WRC 7 .P3D models

Featured Replies

  • Author
  • Localization

huckleberrypie, posted Sun Nov 11, 2018 3:15 am (40276)


I attempted to use Ninja Ripper on the game in vain, but it turns out that aluigi wrote a script for WRC 7's PKG file formats and that using it reveals a surprisingly good amount of content, all conveniently labelled.

That being said, the .P3D and .PTX files use RIFF as a container, but I figured there's more to it than just that. Maybe some of you 3D experts could figure out how to break this down so that we could port these cars to some other game easily.

Here are sample files I extracted using the BMS scripts mentioned above:
https://www73.zippyshare.com/v/vcUnAAjj/file.html
https://www73.zippyshare.com/v/AauPpLjC/file.html

EDIT: I opened the P3D and PTX files using Riffpad and the nodes seem neatly laid out and labelled (vertex positions, vertex normals, tangents, vertex uvs, indices...). Then again I'm not an expert with deciphering them floats and vert positions so I'll leave those to whoever can understand them:
Image
  • Author
  • Localization

h3x3r, posted Wed Nov 14, 2018 11:55 pm (40380)


As I expect. Puzzle. Just few parts are on correct position no wheels. 1 LOD inside which make mess.
Image

All floats.
Struct from string vpos
Code:
uint vpos;
uint VTBSize;
VertexCount=VTBSize/12;
struct VERTICES {
for (i=0;istruct Vertex {
        float VTX;
        float VTY;
        float VTZ;
        Printf("%s %f %f %f\n", s0, VTX*50, VTY*50, VTZ*50);
        }vt;
}vertices;

uint vnor;
uint VNBSize;
VertexCount=VNBSize/8;
struct NORMALS {
for (i=0;istruct VNormals {
        hfloat VNX;
        hfloat VNY;
        hfloat VNZ;
        hfloat VNW;
        Printf("%s %f %f %f\n", s1, VNX, VNY, VNZ);
        }vtn;
}normals;

uint vtan;
uint VTGBSize;
FSkip(VTGBSize);

uint vuvs;
uint UVBSize;
VertexCount=UVBSize/4;
struct UV {
for (i=0;istruct UVs {
        hfloat VTU;
        hfloat VTV;
        Printf("%s %f %f\n", s2, VTU*2000, -VTV*2000 1); not sure if position is really correct
        }uv;
}unitvector;

uint indx;
uint FBSize;
FaceCount=FBSize/2;
struct FACES {
for (i=0;istruct Face {
        ushort FX;
        ushort FY;
        ushort FZ;
        Printf("%s %u/%u/%u %u/%u/%u %u/%u/%u\n", s3, FX 1,FX 1,FX 1, FY 1,FY 1,FY 1, FZ 1,FZ 1,FZ 1);
        }face;
}faces;
  • Author
  • Localization

Szkaradek123, posted Thu Nov 15, 2018 3:03 pm (40395)


To build a model, a skeleton is necessary. Each part of the car is associated with a specific bone. It's not difficult to see that the structure of the riff file is similar to the parent-child pattern.

Build a skeleton and then you can attach the wheels to the matching bone.
  • Author
  • Localization

huckleberrypie, posted Fri Nov 23, 2018 11:08 am (40651)


Szkaradek123 wrote:
To build a model, a skeleton is necessary. Each part of the car is associated with a specific bone. It's not difficult to see that the structure of the riff file is similar to the parent-child pattern.

Build a skeleton and then you can attach the wheels to the matching bone.

I presume this one has the UVs intact, right? Also, is it possible to get the skeleton data from the model itself or do I have to look elsewhere?
  • Author
  • Localization

Szkaradek123, posted Fri Nov 23, 2018 3:54 pm (40664)


As for the details of how to build a skeleton:

The "NoHe" element contains information about the bone name and its local transformation (matrix 4x4) relative to its parent.
And so for the "Piston_FR" bone the parent is "D_Main".
For the bone "D_Main" the parent is "Root". And so on.

The Mesh element has the "NoHe" element transformation and can be composed of more than one "Geom" type element.
"Mesh" and "Geom" have the name of their "NoHe".

Here is an example of using a recursive function to load a tree of bones (python).

Code:

def recurse(parent,g,n):
   bone=None
   tag=g.word(4)
   len=g.i(1)[0]
   n =4
   tm=g.tell()
   if tag in ['RIFF','LIST']:
      node=Node()
      node.data=parent.data.copy()
      parent.children.append(node)
      chunk=g.word(4)
      node.chunk=chunk   
      node.off=g.tell()   
      write(txt,[tag,':',len,chunk,tm],n)
      while(True):
         pos=recurse(node,g,n)
         if pos==tm len:break
   else:
      write(txt,[tag,len,tm],n)
      if tag=='NoHe':   
         a=g.H(1)[0]
         b=g.word(g.i(1)[0])[-25:]
         c=g.H(1)[0]
         d=g.f(16)
         e=g.B(12)   
         matrix=Matrix4x4(d)
         write(txt,[a,b,c,d,e],n)
         #parent.matrix=parent.data['matrix'].copy()
         #write(txt,parent.matrix[0],n)
         #write(txt,parent.matrix[1],n)
         #write(txt,parent.matrix[2],n)
         #write(txt,parent.matrix[3],n)
         #parent.data['matrix']=matrix.invert()
         bone=Bone()
         bone.name=b
         skeleton.boneList.append(bone)
         bone.matrix=matrix#.invert()#.transpose()
         if parent.data['name']:bone.parentName=parent.data['name']
         parent.data['name']=b
      if tag=='Mesh':
         model=Model()
         modelList.append(model)
         model.boneName=parent.data['name']
         parent.data['model']=model
         #model.matrix=parent.matrix
      if tag=='Geom':
         mesh=Mesh()
         #mesh.matrix=parent.matrix
         mesh.info=None
         #if parent.model:
         parent.data['model'].meshList.append(mesh)
      if tag=='SuGe':
         info=g.H(1) g.i(2) g.H(1)
         mesh=parent.data['model'].meshList[-1]
         mesh.info=info
         write(txt,info,n 4)
      if tag=='vpos':
         mesh=parent.data['model'].meshList[-1]
         vertCount=mesh.info[1]
         for m in range(vertCount):
            mesh.vertPosList.append(g.f(3))
      if tag=='vuvs':
         mesh=parent.data['model'].meshList[-1]
         vertCount=mesh.info[1]
         for m in range(vertCount):
            mesh.vertUVList.append(g.short(2))
      if tag=='vcol':
         mesh=parent.data['model'].meshList[-1]
         vertCount=mesh.info[1]
         for m in range(vertCount):            
            mesh.vertColList.append(g.B(4))
            #print mesh.vertColList[-1]
      if tag=='indx':
         mesh=parent.data['model'].meshList[-1]
         #print mesh.info
         faceCount=mesh.info[2]
         for m in range(faceCount):
            mesh.faceList.append(g.H(3))
         #mesh.draw()
         #model=parent.data['model']
         #mesh.object.setMatrix(parent.data['matrix'])
         
      
   g.seek(tm len)
   return g.tell()
   
def setBoneMatrix(object,skeletonObject,boneName):
   bones=skeletonObject.getData().bones
   if boneName in bones.keys():
      matrix=bones[boneName].matrix['ARMATURESPACE']
      object.setMatrix(matrix)   

def p3dParser(filename,g):
   global modelList,skeleton
   skeleton=Skeleton()
   #skeleton.ARMATURESPACE=True
   #skeleton.SORT=True
   skeleton.BONESPACE=True
   modelList=[]
   n=0
   root=Node()
   recurse(root,g,n)


Updated:2018-11-26

Blender importer for p3d files.

You need:
http://download.blender.org/release/Ble ... indows.exe
and
https://www.python.org/ftp/python/2.6.6 ... -2.6.6.msi

Unpack archive, doubleclick on file "Blender249.blend" , press alt p in Blender Text Window and
1
- import car "*.p3d"
2.
- select skeleton in Blender 3D view
3.
- import wheel "*.p3d"

http://www.mediafire.com/file/1s4fr6uuj ... 1-24].7z
  • Author
  • Localization

huckleberrypie, posted Sat Dec 01, 2018 7:37 am (40879)


How's the UVW maps on this though?
  • Author
  • Localization

Szkaradek123, posted Sat Dec 01, 2018 2:02 pm (40888)


I do not understand.
For me meshes have uv mapping. And for you don't ?
  • Author
  • Localization

huckleberrypie, posted Sun Dec 02, 2018 2:27 am (40923)


Szkaradek123 wrote:
I do not understand.
For me meshes have uv mapping. And for you don't ?

Yeah, it does check out fine. I just had to make sure that I chose the right export options for converting them to Wavefront OBJ, as it would end up being a spaghetti-esque mess otherwise.

Image

I had to manually rename the objects too, but that may have to be merged and renamed in case I convert this to let's say GTA San Andreas or some other racing game.
  • Author
  • Localization

huckleberrypie, posted Fri Jan 04, 2019 1:20 am (41907)


Also, the script doesn't seem to take LOD models into account. I know there are (obviously) LODs used throughout the game, and I'd like to know as there are some games which don't seem to like higher-poly cars and such.
  • Author
  • Localization

huckleberrypie, posted Sat Apr 13, 2019 2:10 am (46864)


Sorry for the bump, but I'd like to know if the script could be amended to parse LOD models as well as the main mesh.
  • Author
  • Localization

huckleberrypie, posted Tue Apr 16, 2019 9:07 am (46997)


Anyone?
  • Author
  • Localization

Ha3aP, posted Sun Sep 29, 2019 1:44 pm (51123)


WRC8 it's medot work?
Help pls!

update:
Work, but how extract texture?
  • Author
  • Localization

Mrbig155, posted Mon Feb 03, 2020 2:32 pm (53703)


I'm having troubles exporting to obj file format from WRC8. I've extracted pkg packs to p3d files, but I can convert p3d files to a proper file format to use in 3ds max like obj.
Anyone can help me?
Thanks in advance.
@huckleberrypie I saw your screenshot of the Yaris from 3ds max in a previous post, how have you imported?
  • Author
  • Localization

huckleberrypie, posted Tue Feb 04, 2020 12:45 am (53724)


Mrbig155 wrote:
I'm having troubles exporting to obj file format from WRC8. I've extracted pkg packs to p3d files, but I can convert p3d files to a proper file format to use in 3ds max like obj.
Anyone can help me?
Thanks in advance.
@huckleberrypie I saw your screenshot of the Yaris from 3ds max in a previous post, how have you imported?

I used the Blender 2.45 script after extracting them archives.
  • Author
  • Localization

Mrbig155, posted Tue Feb 04, 2020 8:45 am (53736)


I've tried also with blender but it seems there's a problem with phyton.
Possibly a version mismatch problem?
I've installed latest blender version phyton 2.6.6.
Thanks
  • Author
  • Localization

the_keane, posted Tue Nov 29, 2022 10:14 am (74392)


I keep getting this error when importing the models from Generations, it works with no problem with WRC10.. any idea why this happens please?

Thank you!
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.