Page 1 of 2

[request] kao the kangaroo .bin .msh files

Posted: Thu Aug 23, 2012 4:05 pm
by Bogus
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

[request] kao the kangaroo .bin .msh files

Posted: Mon Sep 03, 2012 11:48 am
by Bogus
this let me although someone will write where they are vertices
script alone write
please

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

Posted: Fri Sep 07, 2012 12:12 am
by FurryFan
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.

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

Posted: Fri Sep 07, 2012 6:56 am
by Bogus
this not well

Re: [request] kao the kangaroo .bin files

Posted: Fri Jan 10, 2014 1:52 pm
by Bogus
to facilitate I give here link to this models
http://www.sendspace.com/file/bfbbxf

Re: [request] kao the kangaroo .bin files

Posted: Fri Jan 17, 2014 2:34 pm
by Bogus
if anyone me help?
please

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

Posted: Sat Jan 18, 2014 10:35 am
by shakotay2
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?)

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

Posted: Mon Jul 02, 2018 6:54 pm
by Bogus
ok here is result
I had to print output to a file because not was can be seen was cut

744 vertices at 0x5644L

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

Posted: Mon Jul 02, 2018 6:56 pm
by Bogus
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

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

Posted: Mon Jul 02, 2018 11:10 pm
by shakotay2
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

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

Posted: Tue Jul 03, 2018 12:14 am
by Bogus
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?

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

Posted: Tue Jul 03, 2018 7:28 am
by shakotay2
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)

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

Posted: Tue Jul 03, 2018 4:05 pm
by Bogus
I not have idea how should look script.
Faces are between unknown values, if the faces were next to each other, would be easier.

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

Posted: Thu Jul 05, 2018 11:03 am
by Flower35
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!

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

Posted: Thu Jul 05, 2018 5:33 pm
by shakotay2
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