The Forum is up for sale: XeNTaX Forum looking for new owner

Tian Xia 3 models

Post questions about game models here, or help out others!
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Tian Xia 3 models

Post by Durik256 »

i made lugin for Noesis
sample.mesh.png
link plugin
You do not have the required permissions to view the files attached to this post.
Last edited by Durik256 on Tue Jun 20, 2023 5:54 pm, edited 2 times in total.
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

Durik256 wrote: Sun Feb 20, 2022 8:47 pm start simple.

Code: Select all

def noepyCheckType(data):
	bs = NoeBitStream(data)
	file = bs.readUInt()

	if file == 0x42A14E65:
		return 1
	else:
		return 0
This part of code check my file (0x654EA142), dunno why it should be at inverse in the function [bruce]
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4231
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1139 times
Been thanked: 2222 times

Re: Tian Xia 3 models

Post by shakotay2 »

Little endian data definition: a value of 0x1234ABCD for example is CDAB3412 in the file(s). Don't ask me why, accept it. :D
(In big endian formats the value would be stored as 1234ABCD, surprise. High word (1234), then low word (ABCD) so humans can read it without headaches 8) .) If they know hex.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

shakotay2 wrote: Sun Feb 20, 2022 9:47 pm

Code: Select all

def noepyLoadModel(data, mdlList):    
    ctx = rapi.rpgCreateContext()
    bs = NoeBitStream(data)
    
    
    #rapi.rpgClearBufferBinds()
    bs.seek(0x20DC, NOESEEK_ABS)
    vertsCount = bs.readUInt()
    faceCount = bs.readUInt()
    bs.seek(0x44, NOESEEK_ABS)
    uvAddr = bs.readUInt()
    uvAddr += 12
    bs.seek(0xB4, NOESEEK_ABS)
    FIaddr = bs.readUInt()

    bs.seek(0x12C, NOESEEK_ABS)
    VertBuf = bs.readBytes(vertsCount * 12)
    bs.seek(uvAddr, NOESEEK_ABS)
    uv1Buf = bs.readBytes(vertsCount * 8)
    bs.seek(FIaddr, NOESEEK_ABS)
    idxBuf = bs.readBytes(faceCount * 12)
    
    
    rapi.rpgBindPositionBufferOfs(VertBuf, noesis.RPGEODATA_FLOAT, 12, 0)
    rapi.rpgBindUV1Buffer(uv1Buf, noesis.RPGEODATA_FLOAT, 12)
    rapi.rpgCommitTriangles(idxBuf, noesis.RPGEODATA_UINT, faceCount*3, noesis.RPGEO_TRIANGLE, 1)

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

    return 1
    
Still trying to understand what is bs.seek and the rpgCommitTriangles :constipated:
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4231
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1139 times
Been thanked: 2222 times

Re: Tian Xia 3 models

Post by shakotay2 »

Long way to go - google for python seek()

Noesis functions to be found in pluginshare.h (see pluginsource.zip)
void (*rpgCommitTriangles)(void *idxData, rpgeoDataType_e dataType, int numIdx, rpgeoPrimType_e primType, bool usePlotMap);

It's to understand the parameters only - keep in mind that .h is a C header file.
(Dunno whether there's a commented Noesis python functions parameter list, but the above should do.)
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Tian Xia 3 models

Post by Durik256 »

moonpaladin wrote: Sun Feb 20, 2022 10:16 pm Still trying to understand what is bs.seek and the rpgCommitTriangles :constipated:
"bs" - NoeBitStream()
"seek" - sets the position within the current stream.
(NOESEEK_REL-from current position and NOESEEK_ABS- from the beginning of the file)
"rpgCommitTriangles" collects faces from bytes (args=bytes for index buffer, dataType, numIdx, primType)

in files (00000726.dat) and (000000000000c4fe.dat) have swapped vertices with faces.
using the (iSize and vSize) it can be easily solved.
Last edited by Durik256 on Tue Jun 20, 2023 5:55 pm, edited 2 times in total.
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

Durik256 wrote: Mon Feb 21, 2022 2:30 am "seek" - sets the position within the current stream.
Yep! but is the position I have been using in the hex2obj is slighty different so need to know why I need to use different values there, gonna review your script.
Durik256 wrote: Mon Feb 21, 2022 2:30 am in files (00000726.dat) and (000000000000c4fe.dat) have swapped vertices with faces.
using the (iSize and vSize) it can be easily solved.
Yep I was worried for it too, but seems that for someone skilled doing scripts is a very easy xD, thanks for it, gonna learn the basis with this script, I know these models are basic because it have a very easy pattern. Again thanks and sorry for so many requests. [bruce]
Sharppy
mega-veteran
mega-veteran
Posts: 163
Joined: Thu Jun 07, 2018 8:09 am
Has thanked: 83 times
Been thanked: 66 times

Re: Tian Xia 3 models

Post by Sharppy »

There is a nice tutorial on how to make a noesis script describing this exact thing in my server. You must of left it.
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

Durik256 wrote: Mon Feb 21, 2022 2:30 am
Well there is much to learn

Code: Select all

def noepyCheckType(data):
    bs = NoeBitStream(data)
    if bs.readInt64() != 8391166444416618085:
        return 0
    return 1
At least are some values that I'm understanding like these one
eN¡Blist : 7473696C42A14E65 = 8391166444416618085

The other value that I'm not sure is :

Code: Select all

 bs.seek(16, NOESEEK_REL)
According about your descripction (current position) should be this?
Image

and how about the

Code: Select all

bs.seek(64, NOESEEK_REL)
and

Code: Select all

bs.seek(4)
So in order that the script load the other type of mesh , I need to change the noepyCheckType to it can load the other type of .dat file and change that iSize and vSize, is listed in the script but is not being used yet :blue:
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

Sharppy wrote: Mon Feb 21, 2022 4:17 am There is a nice tutorial on how to make a noesis script describing this exact thing in my server. You must of left it.
Good to know :), I was checking the chrrox tutorial :D
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

Well is really weird I'm getting around four different types of errors xD, and this meshes have same pattern, I tried to tweak the script a bit to it not thrown error but still getting errors, or is my noesis? I had this kind of "C error" time ago :salty:

https://www.mediafire.com/file/ofnw5r2b ... 2.zip/file
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Tian Xia 3 models

Post by Durik256 »

moonpaladin wrote: Mon Feb 21, 2022 3:18 am the position I have been using in the hex2obj is slighty different
position is the same. :ninja:
moonpaladin wrote: Mon Feb 21, 2022 3:18 am models are basic because it have a very easy pattern.[bruce]
not so simple. :]
moonpaladin wrote: Mon Feb 21, 2022 4:21 am At least are some values that I'm understanding like these one
eN¡Blist : 7473696C42A14E65 = 8391166444416618085
"def noepyCheckType(data):" and "def noepyLoadModel(data, mdlList):"
two different methods that noesis calls in turn.
the first one is to check the file the second one is to load the model.
in each of them a new thread is assigned "bs = NoeBitStream(data)".
so the position starts from the beginning of in every new stream.

in general, the header in the file is:(eNЎB)
but since there are inverted files i check the first 8 bytes(eNЎBlist) by reading the integer64 value.

use debug. eg: print(bs.getOffset()). will print the current position. :lol:
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Tian Xia 3 models

Post by Durik256 »

moonpaladin wrote: Mon Feb 21, 2022 5:26 am i tried to tweak the script a bit to it not thrown error
what did yout ried to tweak there? :lol:
I'm already annoyed by these "broken" files :D
(there may be extra null bytes in the same places. Because of this, checks have to be made.)

one of the problems solved:
At the end of the file, information is not only about faces and vertices, there may also be materials.
(indentation is now used using (iSize и vSize)
Image
(you need to immediately do a normal unpacker so that you don’t suffer with models later)
Last edited by Durik256 on Mon Feb 21, 2022 3:11 pm, edited 1 time in total.
moonpaladin
ultra-veteran
ultra-veteran
Posts: 398
Joined: Tue Mar 05, 2019 6:24 am
Has thanked: 286 times
Been thanked: 18 times

Re: Tian Xia 3 models

Post by moonpaladin »

Durik256 wrote: Mon Feb 21, 2022 9:47 am use debug. eg: print(bs.getOffset()). will print the current position. :lol:
This one is really helpfull! xD
Durik256 wrote: Mon Feb 21, 2022 9:47 am I'm already annoyed by these "broken" file
I get it, I don't want to see these .dat files again for a while :ninja:
Durik256 wrote: Mon Feb 21, 2022 9:47 am (indentation is now used using (iSize и vSize)
Thank you Durik! :blue:
User avatar
Durik256
ultra-veteran
ultra-veteran
Posts: 425
Joined: Wed Nov 21, 2018 7:26 pm
Has thanked: 45 times
Been thanked: 411 times

Re: Tian Xia 3 models

Post by Durik256 »

moonpaladin wrote: Mon Feb 21, 2022 3:18 am in files (00000726.dat) and (000000000000c4fe.dat) have swapped vertices with faces.
final :] , support swapped model.
(I did not bother, I just duplicated the reading of faces and vertices and swapped them.)
sample.mesh.png
Old plugin : fmt_TianXia3.py

Update plugin (open all model), (click up arrow)
Durik256 wrote: Sun Feb 20, 2022 8:47 pm fmt_TianXia3.py
You do not have the required permissions to view the files attached to this post.
Last edited by Durik256 on Tue Jun 20, 2023 6:03 pm, edited 3 times in total.
Post Reply