[request] kao the kangaroo .bin .msh files

Post questions about game models here, or help out others!
Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

[request] kao the kangaroo .bin .msh files

Post by Bogus » Thu Aug 23, 2012 4:05 pm

hello all
how to import models from kao the kangaroo?
please
i tried find vertex information but don't know where they are
link to a demo:
http://download.exdat.com/file/kao_demo ... 12933.html
you need to click download and enter the code
and script for quickbms to pak file

Code: Select all

get pEOCDR asize
math pEOCDR -= 12
goto pEOCDR

get CDR_NUM long
get CDR_PTR long
idstring "T8FM"   ## assumed magic

goto CDR_PTR

for i = 1 to CDR_NUM

  getdstring R_NAME 80
  get R_POS long
  get R_SIZE long

  log R_NAME R_POS R_SIZE

next i

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

[request] kao the kangaroo .bin .msh files

Post by Bogus » Mon Sep 03, 2012 11:48 am

this let me although someone will write where they are vertices
script alone write
please

FurryFan
mega-veteran
mega-veteran
Posts: 190
Joined: Sat Jan 09, 2010 9:37 pm
Has thanked: 8 times
Been thanked: 59 times

Re: [request] kao the kangaroo .bin .msh files

Post by FurryFan » Fri Sep 07, 2012 12:12 am

Bogus wrote:this let me although someone will write where they are vertices
script alone write
please
The format is a little strange for the vertexes, what I think is the case is that there is a face index, interspersed with other information at the beginning of the file, followed by the vertexes BUT the vertexes use some types of frames (for animations), so it might be something like every say 40th vertex is a real vertex. Something like that. Like me look more into this. But thank you for the extraction script, which is helping alot.
I accept ALL requests. Let me know your requests.

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus » Fri Sep 07, 2012 6:56 am

this not well

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin files

Post by Bogus » Fri Jan 10, 2014 1:52 pm

to facilitate I give here link to this models
http://www.sendspace.com/file/bfbbxf

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin files

Post by Bogus » Fri Jan 17, 2014 2:34 pm

if anyone me help?
please

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

Re: [request] kao the kangaroo .bin .msh files

Post by shakotay2 » Sat Jan 18, 2014 10:35 am

why don't you use your own creative power?
try

Code: Select all

   print numVerts,'vertices at ', hex(file.tell())
   for i in xrange(numVerts):      
      verts.append(struct.unpack('fff', file.read(3*4)))
      file.read(4)
      file.read(64)
on angel output.bin - it's not the solution but it's a progress.

Also then why don't you upload your python script? (it's yours, isn't it?)
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."

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus » Mon Jul 02, 2018 6:54 pm

ok here is result
I had to print output to a file because not was can be seen was cut

744 vertices at 0x5644L

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus » Mon Jul 02, 2018 6:56 pm

edit:
New link to kao.pak file from demo version.

https://www.sendspace.com/file/4f9kvq

Script for quickbms in first post.

I write a script for noesis, only I do not know how to skip unknown values with a faces at the beginning of the file, with vertices are null bytes.

Code: Select all

from inc_noesis import *
import noesis
import rapi

def registerNoesisTypes():
    handle = noesis.register("Kao the Kangaroo", ".bin")
    noesis.setHandlerTypeCheck(handle, noepyCheckType)
    noesis.setHandlerLoadModel(handle, noepyLoadModel)
    return 1

def noepyCheckType(data):
    bs = NoeBitStream(data)
    Header = bs.readBytes(4)
    if Header != b'T83d':
        return 0
    return 1

def noepyLoadModel(data, mdlList):
    noesis.logPopup()
    ctx = rapi.rpgCreateContext()
    bs = NoeBitStream(data)
    bs.seek(0x0C, NOESEEK_ABS)
    nummeshes = bs.readInt()
    print("number of meshes", nummeshes)
    numfaces = bs.readInt()
    print("number of faces", numfaces)
    numanims = bs.readInt()
    print("number of animations", numanims)
    bs.seek(0x4C, NOESEEK_ABS)

    for i in range (0, nummeshes):
        numverts = bs.readInt()
        print("number of vertices", numverts)
        unknown = bs.readInt()
        meshname= (bs.readBytes(32).decode("ASCII").rstrip("\0"))
        print(meshname)
        unknown2 = bs.readInt()

    rapi.rpgClearBufferBinds()
    return 1

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

Re: [request] kao the kangaroo .bin .msh files

Post by shakotay2 » Mon Jul 02, 2018 11:10 pm

well, Bogus, you don't give up, I really like that. :)

For your Noesis script, dunno whether the vertex counts you get in the for loop are correct (often it's 3 only).
In general I'd say it doesn't make much sense to care for meshes here as long as you don't have the correct counts.

From the output.bin it seem they have different FVF sizes (angel, FVF size=80, iirc).
For the eskimo and the snowman it seems to be 16. As soon as you found the correct FVF size you can identify the vertex block length and divide it by the FVF size to get the vertex count (for that block).

The problem is the FIs (face indices). It's triangle strips (with bytes to skip) but dunno whether I got them correctly.

edit: well, seems I confused myself with tristrips, because the culling showed a decent mesh. Of course, it's standard triangles [roll] , and the snowman looks much better then.

The "Eskimo" looks rather weird. For the snowman it seems I'm on the right track (toggled face culling in Noesis).
eskimo-snowman.outout-bin.jpg
btw: no, you can't get this with hex2obj directly, I had to manipulate the FIs block in the output.bin files
You do not have the required permissions to view the files attached to this post.
Last edited by shakotay2 on Tue Jul 03, 2018 9:39 pm, edited 1 time in total.
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."

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus » Tue Jul 03, 2018 12:14 am

What is FVF?
This look wrong, you can use kao_tools.exe made by Flower35 Radek krzyskow.
http://www.mediafire.com/file/cimodczub ... _tools.exe
or denis editor, also made by Flower35
http://www.mediafire.com/file/834zhti26 ... Wizard.zip
With this tools models looks better.
How to implement for loop for vertices?
I have skip null bytes with NOESEEK_REL?
What values are between faces, vertex normals probably no?

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

Re: [request] kao the kangaroo .bin .msh files

Post by shakotay2 » Tue Jul 03, 2018 7:28 am

Bogus wrote:What is FVF?
flexible vertex format
This look wrong,
nope, the eskimo is just uncomplete, the snowman is ok, more or less :D
With this tools models looks better.
yeah, and Flower35 has spend much time on creating them.
My approach was just a, well, not 15 min, but 90 min job.
How to implement for loop for vertices?
to be displayed as a mesh? This is simple, Noesis uses a buffer for such. There's a myriad of py samples where you can see how to do it.
I have skip null bytes with NOESEEK_REL?
yep
What values are between faces, vertex normals probably no?
dunno. You don't need them (skip)
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."

Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus » Tue Jul 03, 2018 4:05 pm

I not have idea how should look script.
Faces are between unknown values, if the faces were next to each other, would be easier.

User avatar
Flower35
ultra-n00b
Posts: 6
Joined: Mon Sep 08, 2014 7:34 pm
Location: Polska
Been thanked: 9 times

Re: [request] kao the kangaroo .bin .msh files

Post by Flower35 » Thu Jul 05, 2018 11:03 am

Hi there! :)

"denis Wizard" can display any "Kao the Kangaroo" model with complete list of keyframes. This game uses vertices group animations.

I still haven't completed model or worldmap documentation, but I could post some C++ syntax functions for reading data from files.

If you want to talk more, please visit Kao's Discord server:
https://discord.gg/B33jjUu

Currently I am working on displaying skeletal animations from "Kao the Kangroo: Round 2".

Best regards!
You do not have the required permissions to view the files attached to this post.

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

Re: [request] kao the kangaroo .bin .msh files

Post by shakotay2 » Thu Jul 05, 2018 5:33 pm

Bogus wrote:I not have idea how should look script.
Faces are between unknown values, if the faces were next to each other, would be easier.
I really don't like python, but here you go (script is for the Kao snowman, and ONLY the snowman):

Code: Select all

from inc_noesis import *
import noesis
import rapi

def registerNoesisTypes():
    handle = noesis.register("Kao-snowman", ".bin")
    noesis.setHandlerTypeCheck(handle, noepyCheckType)
    noesis.setHandlerLoadModel(handle, noepyLoadModel)
    return 1

def noepyCheckType(data):
    bs = NoeBitStream(data)
    idstring = bs.readUInt()
    if idstring != 0x64333854:
        print("not a Kao file!")
        return 0
    return 1

def noepyLoadModel(data, mdlList):    
    ctx = rapi.rpgCreateContext()
    bs = NoeBitStream(data)
    #rapi.rpgClearBufferBinds()
    bs.seek(0xD0, NOESEEK_ABS)
    size = 0x1970 - 0xD0
    idxbuf_tmp = bs.readBytes(size)

    numFaces = size // 16
    print("numFaces", numFaces)
    idxBuf = []
    for i in range(numFaces):
        idx = idxbuf_tmp[i*16] + idxbuf_tmp[i*16 + 1]*256
        idxBuf.append(idx)
        idx = idxbuf_tmp[i*16 + 4] + idxbuf_tmp[i*16 + 5]*256
        idxBuf.append(idx)
        idx = idxbuf_tmp[i*16+ 8] + idxbuf_tmp[i*16 + 9]*256
        idxBuf.append(idx)

    #print(idxBuf)

    bs.seek(0x1970, NOESEEK_ABS)
    vertsCount = 170
    VertBuf = bs.readBytes(vertsCount * 64)
    b = struct.pack('H' * len(idxBuf), *idxBuf)

    rapi.rpgBindPositionBufferOfs(VertBuf, noesis.RPGEODATA_FLOAT, 16, 0)
    rapi.rpgCommitTriangles(b, noesis.RPGEODATA_USHORT, numFaces*3, noesis.RPGEO_TRIANGLE, 1)

    mdl = rapi.rpgConstructModel()
    mdlList.append(mdl)

    return 1
It should give you the idea for other meshes. (You might improve it to automatically read the vertexCount.)
As you can see the snowman looks a little bit weird. It's up to you to improve this, I'm off for now.
Kao-snowman.jpg
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."

Post Reply