Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Blades of Time

Post questions about game models here, or help out others!
destrator
beginner
Posts: 28
Joined: Tue Aug 30, 2011 4:25 am
Has thanked: 3 times
Been thanked: 5 times

Re: Blades of Time

Post by destrator »

I unpacked the compressed data block from the container B4B7D9C4. But I can't understand kind of this data types. First, as I understand it is a header and a few tables. And then ... an array of structures:
struct Vertex
{
DWORD PosA; // == 31103131h
WORD PosB; // == B5F5h
WORD PosC; // == 3B8Fh
WORD PosD; // == B33Bh
WORD PosE; // == 3C00h
DWORD PosF; // == 80C731C6h
WORD PosG; // == 3A98h
WORD PosH; // == 34CCh
DWORD PosI; // == FF9A4213h
DWORD PosJ; // == FF6410B7h
};
wtf? This is not the position, is not the normal and is not texture coordinates. This is something incomprehensible. What are they smoking? : )
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Blades of Time

Post by howfie »

If they are smoking something, you need to figure it out so you can smoke it too. You can smoke lots of shit, cigs, weed, grass, heroin, floats, half floats, signed ints, normalized signed ints, etc. Looks like maybe half floats since 3c00 is 1. Vertx data often contains bone and weight info and sometimes even more.
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Blades of Time

Post by finale00 »

Wow you can look at two bytes and go "half-float 1" I can't do fp conversion =(

I e-mailed 010 editor guys about adding half-float to their inspector and they said they'll add it in their "next release" lol whenever that might be. I then told them their competitors already have that functionality in their inspector and they didn't give a shit lol

Were the odd chunks decompressed manually?
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Blades of Time

Post by howfie »

nah, actually i forget.... i memorize stuff like 3F80 is 1.0 in float and so on but i forget what 1.0 is in half float... 3F00, 3C00 something or other lol. i wrote the above knowing i might be wrong but close. it's just memorizing after looking at this stuff for weeks on end. you know what i mean lol.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Blades of Time

Post by howfie »

speaking of which, looking at destrator's struct code and use of WORD and DWORD, it looks like he is a pure C/C++ windows programmer like myself. in that case, use the following to load those half floats:

Code: Select all

real32 float_16_to_32(uint16 value)
{
 // sign/exponent/mantissa
 const uint16 s = (value & 0x8000);
 const uint16 e = (value & 0x7C00) >> 10;
 const uint16 m = (value & 0x03FF);

 // ok
 const real32 sgn = (s ? -1.0f : 1.0f);
 if(e == 0) return sgn*(m == 0 ? 0.0f : std::pow(2.0f, -14.0f)*((real32)m/1024.0f));
 if(e < 32) return sgn*std::pow(2.0f, (real32)e - 15.0f)*(1.0f + ((real32)m/1024.0f));

 // not ok!
 if(m == 0) return std::numeric_limits<real32>::quiet_NaN();
 return std::numeric_limits<real32>::quiet_NaN();
}
destrator
beginner
Posts: 28
Joined: Tue Aug 30, 2011 4:25 am
Has thanked: 3 times
Been thanked: 5 times

Re: Blades of Time

Post by destrator »

howfie
Thanks.

I use this algorithm for half-floats:

Code: Select all

typedef union FP32
{
    DWORD u;
    float f;
    struct
    {
        DWORD Mantissa : 23;
        DWORD Exponent : 8;
        DWORD Sign : 1;
    };
} FP32;

typedef union FP16
{
    WORD u;
    struct
    {
        WORD Mantissa : 10;
        WORD Exponent : 5;
        WORD Sign : 1;
    };
} FP16;

static FP32 half_to_float(FP16 h)
{
    FP32 o = { 0 };

    // From ISPC ref code
    if (h.Exponent == 0 && h.Mantissa == 0) // (Signed) zero
        o.Sign = h.Sign;
    else
    {
        if (h.Exponent == 0) // Denormal (will convert to normalized)
        {
            // Adjust mantissa so it's normalized (and keep track of exp adjust)
            int e = -1;
            DWORD m = h.Mantissa;
            do
            {
                e++;
                m <<= 1;
            } while ((m & 0x400) == 0);

            o.Mantissa = (m & 0x3ff) << 13;
            o.Exponent = 127 - 15 - e;
            o.Sign = h.Sign;
        }
        else if (h.Exponent == 0x1f) // Inf/NaN
        {
            // NOTE: It's safe to treat both with the same code path by just truncating
            // lower Mantissa bits in NaNs (this is valid).
            o.Mantissa = h.Mantissa << 13;
            o.Exponent = 255;
            o.Sign = h.Sign;
        }
        else // Normalized number
        {
            o.Mantissa = h.Mantissa << 13;
            o.Exponent = 127 - 15 + h.Exponent; 
            o.Sign = h.Sign;
        }
    }

    return o;
}
And I have question about vertex format of skinned meshes. Vertex has the following format:

Code: Select all

struct VECTOR4S8
{
	char x;
	char y;
	char z;
	char w;
};

struct Vertex
{
    VECTOR4S8 Unknown0;
    FP16 PosX; // Position
    FP16 PosY; //
    FP16 PosZ; //
    FP16 Unknown1;
    VECTOR4S8 Unknown2;
    FP16 TexU; // texture coords 
    FP16 TexV; //
    VECTOR4S8 Unknown3;
    VECTOR4S8 Unknown4;
};
Has anyone figured out what means members of the structure: Unknown0-Unknown4? It may be packed normals, binormals, tangents, vertex weights or indices or anything other.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Blades of Time

Post by howfie »

To figure out weights, you should print out a hex dump for each vertex like so (this is from my rise of nightmares output, it's the first vertex for each model that uses the 0x4 0x1800 0xffc3 vertex format):

Code: Select all

3f7c2974:bf3ecdb9:bda297fd:ff000000:00000000:ef44:7ffe:aad1:28fe:39e7:3406 - 0x4 0x1800 0xffc3
00000000:3f3c4fbb:3e881da1:ff000000:00000000:7fb6:f1fe:9f11:b5fe:29c3:355e - 0x4 0x1800 0xffc3
3ecba6a5:417e26fb:3f2859b9:d7120f06:18020f1b:b889:f0fe:f07a:46fe:38f2:373a - 0x4 0x1800 0xffc3
00000000:41777d42:3f47768b:eb0a0a00:08070900:7fb3:0bfe:7ff3:b3fe:3806:3bf4 - 0x4 0x1800 0xffc3
bd1b98e0:4121cae9:3f8a6744:99660000:00010000:c6af:ddfe:1a7e:cc00:393d:385d - 0x4 0x1800 0xffc3
bd1b98e0:4121cae9:3f8a6744:99660000:00010000:c6af:ddfe:1a7e:cc00:393d:385d - 0x4 0x1800 0xffc3
40285398:4155265d:3d0bdd03:ff000000:00000000:f5ae:8684:8581:00fe:214e:3603 - 0x4 0x1800 0xffc3
41038bf9:41658845:bf498bb6:ff000000:06000000:8fe9:3bfe:5344:1800:3a28:2b91 - 0x4 0x1800 0xffc3
bd1b98e0:4121cae9:3f8a6744:99660000:00010000:c6af:ddfe:1a7e:cc00:393d:385d - 0x4 0x1800 0xffc3
41038bf9:41658845:bf498bb6:ff000000:06000000:8fe9:3bfe:5344:1800:3a28:2b91 - 0x4 0x1800 0xffc3
00000000:41777d42:3f47768b:eb0a0a00:08070900:7fb3:0bfe:7ff3:b3fe:3806:3bf4 - 0x4 0x1800 0xffc3
3e518aa7:4181a31b:3f2c3902:b6341500:00040200:792a:ddfe:f79b:a000:3b5d:28cf - 0x4 0x1800 0xffc3
bf383c7a:4181d00d:bdbc36b9:ff000000:06000000:3ba9:e1fe:8d0f:b900:3320:3579 - 0x4 0x1800 0xffc3
The dead giveaway for weights is you'll see something like (look for the FF and some zeros and a bunch of bytes that sum to 0xFF):

Code: Select all

ff000000:06000000
b6341500:00040200
0xb6 + 0x34 + 0x15 = 0xFF
ff -> 06 = 1.0 weight and 06 = bone or weight map index

Sometimes you'll see weights as half-floats. If they are, usually they are between 0 and 1 so look for anything 0x2??? and 0x3???. Bone indices are almost always bytes. If you post a hex dump of some vertices, we can take a look at it.
Szkaradek123
mega-veteran
mega-veteran
Posts: 292
Joined: Wed May 05, 2010 8:21 pm
Location: Poland Głogów
Has thanked: 21 times
Been thanked: 742 times

Re: Blades of Time

Post by Szkaradek123 »

Blenderv249 grp model importer:(for Xblades too)
-geometry
-uv
http://www.mediafire.com/?mqo8lq6bwhoo18w
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: Blades of Time

Post by zaramot »

It's cool, thank you very much Szkaradek123! You rock! :)
Making model-import scripts, PM
Darko
double-veteran
double-veteran
Posts: 723
Joined: Mon Jul 13, 2009 6:16 pm
Has thanked: 72 times
Been thanked: 138 times

Re: Blades of Time

Post by Darko »

Szkaradek123 wrote:Blenderv249 grp model importer:(for Xblades too)
-geometry
-uv
http://www.mediafire.com/?mqo8lq6bwhoo18w
Thanks, just one thing: is there a way to extract textures??
Image
mincartoon
ultra-n00b
Posts: 1
Joined: Wed May 30, 2012 4:37 pm

Re: Blades of Time

Post by mincartoon »

I wanna make some Skyrim mods with the Ayumi model.

Have no clue how to use offzip or hex editors...

Can anyone help me? I am a 3DSMAX user btw...
User avatar
Pesmontis
beginner
Posts: 33
Joined: Sun Jun 20, 2010 5:10 pm
Location: The Netherlands
Been thanked: 9 times
Contact:

Re: Blades of Time

Post by Pesmontis »

To get the textures, you can use offzip like this:
- copy offzip to the /res/texpack directory;
- create a new directory called "gameres";
- run offzip like this:

offzip.exe -a bot.gameres.dxp.bin gameres 0x10

- find the files called "0005ccd8.dat", "004fc078.dat", and "000cfd00.dat", and open them in a hex editor;

- put a DXT1 header (1024x1024, no MIPMAPS) on top of 0005ccd8.dat, and save it as "body_diffuse.dds";
- put a DXT5 header (1024x1024, no MIPMAPS) on top of 004fc078.dat, and save it as "hair_diffuse.dds";
- put a DXT5 header (2048x2048, no MIPMAPS) on top of 000cfd00.dat, and save it as "body_bump.dds".
User avatar
Pesmontis
beginner
Posts: 33
Joined: Sun Jun 20, 2010 5:10 pm
Location: The Netherlands
Been thanked: 9 times
Contact:

Re: Blades of Time

Post by Pesmontis »

With the Blender script the exported models still need a lot of work to display them correctly, especially the eyes.
Once given the correct material, the eyes appear very beautifully modeled.

The attachment shows examples of Ayumi, her dragon form, and Michelle.

The Blender script also doesn't export the model's skeleton, but for other games a different skeleton has to be applied anyway.
For example in Sacred 2 with a Seraphim skeleton:
Image
You do not have the required permissions to view the files attached to this post.
User avatar
Andrakann
ultra-veteran
ultra-veteran
Posts: 392
Joined: Wed Jul 06, 2011 8:47 am
Location: Russia
Has thanked: 974 times
Been thanked: 192 times
Contact:

Re: Blades of Time

Post by Andrakann »

Szkaradek123 wrote:Blenderv249 grp model importer:(for Xblades too)
Hi!
Thank you for script :)
Btw, can you update it to work with WarThunder grp's also?
It's tries to load them, do some listing of internal meshes, but loads nothing.
I posted some detailed info and samples in WT topic.
Post Reply