READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

IDOLM@STER One For All .pmd

Post questions about game models here, or help out others!
MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

IDOLM@STER One For All .pmd

Post by MarieRose1301 » Mon Sep 02, 2019 6:08 pm

Hello, I'm trying to make a .pmd idolmaster ofa extension plugin, and so far have managed to get bone count and names, texture count and names and mesh count, however i can't seem to be able to make sense of vertex format. I think that vertex data for the first submesh, ACC_HEADShape starts at 0xF5D4 but I'm not sure how to parse it and where the vertex/face count for each submesh is stored, and there's one strange issue with the printf function for texture names not diplaying the first 4 characters in texture name. Could anyone help me out with this? I'm pretty new to Python and reverse engineering game data in general so I'm a bit lost here. Here's the sample model: https://www.dropbox.com/s/pqpm8bki9vzwy ... r.pmd?dl=0
And this is my code:

Code: Select all

from inc_noesis import *

import noesis
import rapi

def registerNoesisTypes():
   handle = noesis.register("The IDOLM@STER One For All Model", ".pmd")
   noesis.setHandlerTypeCheck(handle, noepyCheckType)
   noesis.setHandlerLoadModel(handle, noepyLoadModel)
   noesis.logPopup()
       #print
   return 1

NOEPY_HEADER = "PMD"

def noepyCheckType(data):

   bs = NoeBitStream(data)
   if len(data) < 3:
      return 0
   if bs.readBytes(3).decode("ASCII").rstrip("\0") != NOEPY_HEADER:
      return 0
   return 1       

def noepyLoadModel(data, mdlList):
   ctx = rapi.rpgCreateContext()
   bs = NoeBitStream(data)

   bs.seek(0x10, NOESEEK_ABS) #PTR - Bone block

   bs.seek(0x13, NOESEEK_REL)
   BoneCount = bs.read("i") #Bone count
   print(BoneCount)
   bs.seek(0x70C, NOESEEK_ABS) #Bones
   bs.seek(0xFC, NOESEEK_REL) #First bone data
   BoneNames = []
   for i in range(0, BoneCount[0]-1):
      BoneNames.append (bs.readBytes(32).decode("UTF-8").rstrip("\0"))
      bs.seek(0xFC, NOESEEK_REL) #Skip bone data
   print(BoneNames)
   
   bs.seek(0xF448, NOESEEK_ABS) #PME - Mesh block
   
   bs.seek(0x13, NOESEEK_REL)
   MeshCount = bs.read("i") #Mesh count
   print(MeshCount)
   MeshNames = []
   #for i in range(0, MeshCount[0]):
   bs.seek(0x49, NOESEEK_REL) #Seek to mesh name
   MeshNames.append (bs.readBytes(32).decode("UTF-8").rstrip("\0"))
   bs.seek(0x17, NOESEEK_REL)
   VCount=bs.read("i")
   print(VCount)
   bs.seek(0x125, NOESEEK_REL) #Seek to vertex data
   VertBuff = bs.readBytes(VCount[0] * 0x2C)
   rapi.rpgBindPositionBufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
   rapi.rpgCommitTriangles(None, noesis.RPGEODATA_USHORT, VCount[0], noesis.RPGEO_POINTS, 1)
      
   mdl = rapi.rpgConstructModel()
   mdlList.append(mdl)
   
   bs.seek(0x10C240, NOESEEK_ABS) #PTE - Texture block

   bs.seek(0x13, NOESEEK_REL) #Texture count
   TexCount = bs.read("i")
   print(TexCount)
   bs.seek(0xA9, NOESEEK_REL)
   TexNames = []
   for i in range(0, TexCount[0]):
      TexNames.append (bs.readBytes(40).decode("UTF-8").rstrip("\0")+".gtf")
      bs.seek(0x148, NOESEEK_REL)
   print(TexNames)
   
   rapi.rpgClearBufferBinds()   
   return 1

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Sat Sep 07, 2019 5:56 pm

Anyone? I have been able to identify the faces but still nothing on vertices

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

Re: IDOLM@STER One For All .pmd

Post by shakotay2 » Sat Sep 07, 2019 9:14 pm

MarieRose1301 wrote:
Sat Sep 07, 2019 5:56 pm
Anyone? I have been able to identify the faces but still nothing on vertices
the faces (face indices) generally don't really help.
Usually you start finding point clouds. That's the way how I do it.
Then you search for suiting face indices.

In this case I'm not sure about the format, HF or shorts:
.
-pmd.png
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."

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 490
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 22 times
Been thanked: 397 times

Re: IDOLM@STER One For All .pmd

Post by Bigchillghost » Sun Sep 08, 2019 4:17 am

Image
chr_body_all.png
Might need to take care of some extra faces.
You do not have the required permissions to view the files attached to this post.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Sun Sep 08, 2019 7:58 am

Bigchillghost wrote:
Sun Sep 08, 2019 4:17 am
Image
chr_body_all.png

Might need to take care of some extra faces.
Thank you so much, this is very helpful :D
However, I don't quite understand how to calculate vertex count. Do you mind explaining that part?

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 490
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 22 times
Been thanked: 397 times

Re: IDOLM@STER One For All .pmd

Post by Bigchillghost » Sun Sep 08, 2019 8:26 am

pmd.png
You do not have the required permissions to view the files attached to this post.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Sun Sep 08, 2019 10:59 am

Bigchillghost wrote:
Sun Sep 08, 2019 8:26 am
pmd.png
Thank you, almost got every mesh down, except of slender_dShape and ACCHEAD_Shape
Do I understand correctly that for example the slender_dShape mesh has 72 vertices and 143 poly indices, and that indices start at 0x105FB4 and vertex data at 0xF1110 ? Because for some reason I am unable to preview mesh, but vertex cloud works just fine
Here's one of working meshes on the other hand :D
slender_cShape1-min.png
You do not have the required permissions to view the files attached to this post.

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 490
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 22 times
Been thanked: 397 times

Re: IDOLM@STER One For All .pmd

Post by Bigchillghost » Sun Sep 08, 2019 11:41 am

MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
almost got every mesh down, except of slender_dShape and ACCHEAD_Shape
ACCHEAD_Shape:
ACC_HEADShape.png
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
Do I understand correctly that for example the slender_dShape mesh has 72 vertices and 143 poly indices, and that indices start at 0x105FB4 and vertex data at 0xF1110 ?
Yep.
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
Because for some reason I am unable to preview mesh, but vertex cloud works just fine
Coz the amount of vertex is below 256 and the format is using 8-bit integer to store the indices, which's out of AMR's expectation.
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
Here's one of working meshes on the other hand :D
slender_cShape1-min.png
Congratulations, you've already get the hang of that app. :)
You do not have the required permissions to view the files attached to this post.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Sun Sep 08, 2019 1:59 pm

Bigchillghost wrote:
Sun Sep 08, 2019 11:41 am
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
almost got every mesh down, except of slender_dShape and ACCHEAD_Shape
ACCHEAD_Shape:
ACC_HEADShape.png
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
Do I understand correctly that for example the slender_dShape mesh has 72 vertices and 143 poly indices, and that indices start at 0x105FB4 and vertex data at 0xF1110 ?
Yep.
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
Because for some reason I am unable to preview mesh, but vertex cloud works just fine
Coz the amount of vertex is below 256 and the format is using 8-bit integer to store the indices, which's out of AMR's expectation.
MarieRose1301 wrote:
Sun Sep 08, 2019 10:59 am
Here's one of working meshes on the other hand :D
slender_cShape1-min.png
Congratulations, you've already get the hang of that app. :)
Here's what I got working :D Thank you very much for your help, I hope I have enough info to start reading meshes in Noesis now :D
ranko.PNG
You do not have the required permissions to view the files attached to this post.

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Sun Sep 08, 2019 4:31 pm

Almost complete geometry, only misses slender_dShape from main body files and kurome_O_OBJ_O_SORTBIASm4__O_AU from head file
ranko_almost.PNG
You do not have the required permissions to view the files attached to this post.

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

Re: IDOLM@STER One For All .pmd

Post by shakotay2 » Mon Sep 09, 2019 7:49 pm

I've updated the Make_obj tool for creating all submeshes (tested with chr_body_rank_104_a_slender.pmd only!):
shakotay2 wrote:
Mon Sep 09, 2019 7:47 pm
(some superfluous vertices)
.
chr_body_rank_104_a_slender-pmd.png
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."

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Tue Sep 10, 2019 2:52 pm

shakotay2 wrote:
Mon Sep 09, 2019 7:49 pm
I've updated the Make_obj tool for creating all submeshes (tested with chr_body_rank_104_a_slender.pmd only!):
shakotay2 wrote:
Mon Sep 09, 2019 7:47 pm
(some superfluous vertices)
.
chr_body_rank_104_a_slender-pmd.png
I have just gotten to try the program, it actually does work on other models as well, but with the same issue as the AMR, it won't convert meshes with few faces like eyes for example. Do you think you could link me the source so I can study it? C is the only programming language I actually understand on more than surface/basic level

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 490
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 22 times
Been thanked: 397 times

Re: IDOLM@STER One For All .pmd

Post by Bigchillghost » Tue Sep 10, 2019 3:14 pm

MarieRose1301 wrote:
Tue Sep 10, 2019 2:52 pm
but with the same issue as the AMR, it won't convert meshes with few faces like eyes for example.
I don't understand. If you can load the rest of the meshes into noesis, why can't that one? It's just the same format but using unsigned char instead of short for the face indices storage.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Tue Sep 10, 2019 3:47 pm

Bigchillghost wrote:
Tue Sep 10, 2019 3:14 pm
MarieRose1301 wrote:
Tue Sep 10, 2019 2:52 pm
but with the same issue as the AMR, it won't convert meshes with few faces like eyes for example.
I don't understand. If you can load the rest of the meshes into noesis, why can't that one? It's just the same format but using unsigned char instead of short for the face indices storage.
I cannot load anything in noesis yet in fact as I haven't been able to code anything yet ^^"

MarieRose1301
veteran
Posts: 81
Joined: Sat Oct 11, 2014 10:29 pm
Has thanked: 12 times
Been thanked: 3 times

Re: IDOLM@STER One For All .pmd

Post by MarieRose1301 » Tue Sep 10, 2019 5:42 pm

I feel completely stupid right now but I have no idea how to read a number stored in 4 bytes...
dunno.PNG
You do not have the required permissions to view the files attached to this post.

Post Reply