Post questions about game models here, or help out others!
-
zaramot
- double-veteran

- Posts: 767
- Joined: Wed Jan 05, 2011 12:41 pm
- Has thanked: 39 times
- Been thanked: 818 times
Post
by zaramot » Wed Apr 24, 2013 3:55 pm
I'm trying to figure out .k2mp model format.
I have problem with face indices, maybe someone could help me with them?
Here's sample character file
http://www.mediafire.com/?8cew8426adpzbw8
And here's basic script for this file, it loads sword model. Thanks in advance.
fname = getOpenFileName \
caption:"Open .K2MP from Mesh folder" \
types:"Samurai Shodown Sen Mesh(*.K2MP)|*.K2MP" \
historyCategory:"Samurai Shodown SenObjectPresets"
f = fopen fname "rb"
clearlistener()
Face_array=#()
Vert_array=#()
UV_array=#()
fseek f 0x1A9A #seek_set
vertcount=readlong f
print vertcount
for x = 1 to vertcount/3 do(
vx=readfloat f
vy=readfloat f
vz=readfloat f
append Vert_array[vx,vy,vz]
)
unk1=readshort f
indices=readlong f
print indices
FaceDirection = 1
f1 = Readlong f +1
f2 = Readlong f +1
for i = 3 to indices-1 do (
f3 = Readlong f +1
FaceDirection *= 1
if (f3 != f1) AND (f3 != f2) then (
if FaceDirection > 0 then append Face_array [f1,f2,f3]
else append Face_array [f1,f3,f2]
)
f1 = f2
f2 = f3
)
fseek f 0x6B76 #seek_set
uvcount=readlong f
fseek f 0x6 #seek_cur
for x = 1 to uvcount do(
tu=readfloat f
tv=readfloat f
append UV_array[tu,tv,0]
)
msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
fclose f
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
-
Karpati
- ultra-veteran

- Posts: 375
- Joined: Thu Dec 07, 2006 11:25 pm
- Has thanked: 7 times
- Been thanked: 73 times
Post
by Karpati » Thu Apr 25, 2013 8:36 am
It is a container file, so it have dozens of meshes. It uses the DirectX Binary format internally: 'xof 0303bin 0032'
After the face counter, every face have the followings:
'Number of Vertices in the actual Face': 4 bytes Long
After this
'Number of Vertices in the actual Face' * 4 bytes Long Pointers
See the converted file..
You do not have the required permissions to view the files attached to this post.
-
zaramot
- double-veteran

- Posts: 767
- Joined: Wed Jan 05, 2011 12:41 pm
- Has thanked: 39 times
- Been thanked: 818 times
Post
by zaramot » Thu Apr 25, 2013 1:48 pm
Karpati, thanks you very much for help

Everything works perfect now, I know .k2mp it's container with a lot of models inside. Texture are straight .dds but also grouped in .k2mp file.
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
-
Karpati
- ultra-veteran

- Posts: 375
- Joined: Thu Dec 07, 2006 11:25 pm
- Has thanked: 7 times
- Been thanked: 73 times
Post
by Karpati » Thu Apr 25, 2013 2:35 pm
Did you position the subobjects manually in your 3d modeler program?
-
zaramot
- double-veteran

- Posts: 767
- Joined: Wed Jan 05, 2011 12:41 pm
- Has thanked: 39 times
- Been thanked: 818 times
Post
by zaramot » Fri Apr 26, 2013 8:18 am
Yes, I positioned them manually in 3ds max.
Making model-import scripts, PM
-
finale00
- M-M-M-Monster veteran

- Posts: 2382
- Joined: Sat Apr 09, 2011 1:22 am
- Has thanked: 170 times
- Been thanked: 300 times
Post
by finale00 » Sat Apr 27, 2013 1:02 am
If it's a direct3D file they probably have frame transforms or something.
-
BobDope
- ultra-n00b
- Posts: 4
- Joined: Thu Dec 22, 2011 10:56 am
Post
by BobDope » Wed May 01, 2013 7:55 am
As I am a complete noob, could someone post an updated script (like the first one, that imports a sword), that works on the entire character?
I would be very thankful.
If it (or another one) could be used to get the textures as well, that would be great.
Thank you for your efforts and sorry for the inconveniance.
-
Rimbros
- ultra-veteran

- Posts: 495
- Joined: Fri Jul 09, 2010 12:23 am
- Has thanked: 41 times
- Been thanked: 13 times
Post
by Rimbros » Wed May 01, 2013 5:04 pm
zaramot wrote:Karpati, thanks you very much for help

Everything works perfect now, I know .k2mp it's container with a lot of models inside. Texture are straight .dds but also grouped in .k2mp file.
I really love the Samurai Shodown game, give me lots of memorys, for me the best one its the Samurai Shodown II, afther this game the company fuck the game with RUSH SLASH MODES and back front movement in screen and lots of things to Lost the original game esence, i shure this its Genjuro, hope u can share the characters files i really like them

.
-
porimac
- VIP member

- Posts: 109
- Joined: Wed Sep 08, 2010 4:46 pm
- Location: Japan,Kanagawa
- Has thanked: 63 times
- Been thanked: 13 times
Post
by porimac » Sat Jan 04, 2014 5:58 pm
Karpati wrote:It is a container file, so it have dozens of meshes. It uses the DirectX Binary format internally: 'xof 0303bin 0032'
After the face counter, every face have the followings:
'Number of Vertices in the actual Face': 4 bytes Long
After this
'Number of Vertices in the actual Face' * 4 bytes Long Pointers
??? hmm its too difficult for my kinky brain
zaramot. would you be able to rewrite your script?
-
kjw2254
- ultra-n00b
- Posts: 5
- Joined: Fri Feb 04, 2011 4:31 pm
Post
by kjw2254 » Sat Jan 18, 2014 3:31 am
me too

-
porimac
- VIP member

- Posts: 109
- Joined: Wed Sep 08, 2010 4:46 pm
- Location: Japan,Kanagawa
- Has thanked: 63 times
- Been thanked: 13 times
Post
by porimac » Wed Feb 19, 2014 7:10 am
hey...at least...would you give me some hints on what to do?

-
zaramot
- double-veteran

- Posts: 767
- Joined: Wed Jan 05, 2011 12:41 pm
- Has thanked: 39 times
- Been thanked: 818 times
Post
by zaramot » Wed Feb 19, 2014 11:06 am
If you want those model very much, you could use this script to load each part manually
Code: Select all
fname = getOpenFileName \
caption:"Open .K2MP from Mesh folder" \
types:"Samurai Shodown Sen Mesh(*.K2MP)|*.K2MP" \
historyCategory:"Samurai Shodown SenObjectPresets"
f = fopen fname "rb"
fn ReadFixedString bstream fixedLen =
(
local str = ""
for i = 1 to fixedLen do
(
str += bit.intAsChar (ReadByte bstream #unsigned)
)
str
)
clearlistener()
Face_array=#()
Vert_array=#()
UV_array=#()
--find string "Mesh" remember offset and put it here
fseek f 0x19D4A #seek_set
fseek f 0xE #seek_cur
vertcount=readlong f
print vertcount
for x = 1 to vertcount/3 do(
vx=readfloat f
vy=readfloat f
vz=readfloat f
append Vert_array[vx,vz,vy]
)
unk1=readshort f
count=readlong f
faces=readlong f
print faces
for x = 1 to faces do (
fcount=readlong f
fa=readlong f + 1
fb=readlong f + 1
fc=readlong f + 1
append Face_array [fc,fb,fa]
)
id=readshort f
NameSecSize=readlong f
SecName=ReadFixedString f NameSecSize
fseek f 0xE #seek_cur
ncount=readlong f
print ncount
for x = 1 to ncount/3 do(
n1=readfloat f
n2=readfloat f
n3=readfloat f
)
unk1=readshort f
ncount=readlong f
nfaces=readlong f
print nfaces
for x = 1 to nfaces do (
nfcount=readlong f
na=readlong f + 1
nb=readlong f + 1
nc=readlong f + 1
)
unk2=readshort f
id=readshort f
NameSecSize=readlong f
SecName=ReadFixedString f NameSecSize
fseek f 0xE #seek_cur
uvcount=readlong f
print uvcount
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
for x = 1 to uvcount/2 do(
tu=readfloat f
tv=readfloat f*-1
append UV_array[tu,tv,0]
)
msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]
fclose f
I will not finish script for this game till distant future, models are very low-poly with low textures and format is bit annoying. Maybe you could import them with tools for DirectX Binary format?! I don't know
Making model-import scripts, PM
-
porimac
- VIP member

- Posts: 109
- Joined: Wed Sep 08, 2010 4:46 pm
- Location: Japan,Kanagawa
- Has thanked: 63 times
- Been thanked: 13 times
Post
by porimac » Wed Feb 19, 2014 10:26 pm
really thank you for the help!
textures(PL**TEX1P.K2MP/K2T) is the simple DXT dds formats.
-
Karpati
- ultra-veteran

- Posts: 375
- Joined: Thu Dec 07, 2006 11:25 pm
- Has thanked: 7 times
- Been thanked: 73 times
Post
by Karpati » Thu Feb 20, 2014 9:27 am
[/quote]
??? hmm its too difficult for my kinky brain[/quote]
The DirectX format stores the faces as N-sided polygons:
If 'Number of Vertices in the actual Face'=3 it is a triangle,
If 'Number of Vertices in the actual Face'=4 it is a quadrangle,
etc...
If 'Number of Vertices in the actual Face'=3 you must read 3 long (pointer to the vertex table)
If 'Number of Vertices in the actual Face'=4 you must read 4 long (pointer to the vertex table).
etc...
-
porimac
- VIP member

- Posts: 109
- Joined: Wed Sep 08, 2010 4:46 pm
- Location: Japan,Kanagawa
- Has thanked: 63 times
- Been thanked: 13 times
Post
by porimac » Thu Feb 20, 2014 9:38 pm
thanks, but...
> each part manually
? what 'part'...?
However, I understand that you have lost interest in this topic already.
Thank you so much...
