Giter Site home page Giter Site logo

JADE: Vertex layout about xoreos HOT 14 CLOSED

xoreos avatar xoreos commented on May 9, 2024
JADE: Vertex layout

from xoreos.

Comments (14)

DrMcCoy avatar DrMcCoy commented on May 9, 2024

Oh, D3DCOLOR and SHORT4N, these are apparently the mysterious 4 byte and 8 byte fields I saw. :)

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 9, 2024

Okay, I moved this information into our wiki here: https://wiki.xoreos.org/index.php?title=Jade_Empire/Research#Vertex_layout :)

I can also give you an account for the wiki, if you want to add more stuff yourself.

Can you find out in what order these fields are? There should be one fixed order, even if not all might be present everywhere.

from xoreos.

logzero avatar logzero commented on May 9, 2024

Yeah, I'll have a look a bit later today.

from xoreos.

logzero avatar logzero commented on May 9, 2024

There will be some delays.

Have got master built and running, but getting:
ERROR: No such archive file "chitin.key"!

I vaguely remember this issue, but no idea what the fix was...

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 9, 2024

Errm, that's bad; that really shouldn't happen... :/

The file is there? The file permissions are okay?
If you could trace that issue, that would be great. Because that's kinda a catastrophic issue right there...

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 9, 2024

Hmm, or do you have the file and/or directory symlinked? Or a subpath of that?

from xoreos.

logzero avatar logzero commented on May 9, 2024

Here is what I've got so far...

The block:

ctx.mdl->skip(8); // Unknown
uint32 offNormals = ctx.mdl->readUint32LE();
ctx.mdl->skip(4); // Unknown
uint32 offUV[4];
offUV[0] = ctx.mdl->readUint32LE();
offUV[1] = ctx.mdl->readUint32LE();
offUV[2] = ctx.mdl->readUint32LE();
offUV[3] = ctx.mdl->readUint32LE();
ctx.mdl->skip(20); // Unknown

is very probably:

ctx.mdl->skip(4); // Unknown
uint32 offAttribs[12] = ctx.mdl->readUint32LE(12);

The vertex attribute offsets offAttribs[12] look like this (as seen in players.mod):

0, 12, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0
0, 12, ~0, 16, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0
0, 12, ~0, 20, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 16

Which suggests the following vertex layouts:

16 = 12 + 4 + 0 + 0
24 = 12 + 4 + 0 + 8
28 = 12 + 4 + 4 + 8
40 = 12 + 4 + 0 + 0 + 24
52 = 12 + 4 + 4 + 8 + 24

The first 12 bytes are the position.
Then we have two times 4 bytes that are unknown, color?
Those are followed by 8 bytes texcoords.
The 24 bytes are probably 3 tangent space vecs. They are not in the offsets array, probably not supported by mdl file format as such.

The second 4 byte block is often 0 0 0 0

The "tangent space" block doesn't look like normalized vecs though, not sure what is going on there:
values 0-3 look ok
values 4-7 are often all zero???
values 8-11 are often close to zero

I think it will require a closer look at the shaders, to see what they are doing with those attributes.

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 9, 2024

Hmm, very interesting, thanks! :)

from xoreos.

logzero avatar logzero commented on May 9, 2024

The second attribute (at offset 12) is not a color
http://i.imgur.com/iBGGwbW.jpg

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 9, 2024

Huh, okay. Well, I have no clue what it could be, at this point.

Thanks looking into this, though :)

from xoreos.

logzero avatar logzero commented on May 9, 2024

I hope it is ok, if I keep spamming this issue :)

Assuming two 16bit values (ushort) we get this:
http://i.imgur.com/TQzYDmy.jpg
http://i.imgur.com/R3AmvAC.jpg
http://i.imgur.com/C0zX4oG.jpg
http://i.imgur.com/e9wrarD.jpg

And with a 32 bit value (uint):
http://i.imgur.com/GKMVu1z.jpg
http://i.imgur.com/Xnj5tYU.jpg
http://i.imgur.com/tkNBBIa.jpg

Looks like some kind of shading parameter (luminance factor / baked lighting)?

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 9, 2024

I hope it is ok, if I keep spamming this issue :)

Very much so, thanks! While I'm currently focusing on something else, this is extremely useful for the future. :)

Looks like some kind of shading parameter

Hmm, possible, yes.

from xoreos.

logzero avatar logzero commented on May 9, 2024

The "last attribute" at offset 16 has often the value (4 bytes decimal): 0 0 128 63
Or 1.0 if interpreted as a float. The value is always <= 1.0 from what I've seen so far.

from xoreos.

logzero avatar logzero commented on May 9, 2024

Here is how it looks like:
http://i.imgur.com/ecSFcAI.jpg
http://i.imgur.com/6bAYn3f.jpg

Looks like another shading / material parameter.

from xoreos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.