Jump to content

OoT 3D (3DS) - Model Format discussion


SanguinettiMods
 Share

Recommended Posts

It's possible, the textures are extracted with the model files as .png files. One thing to keep in mind though is that the texture transparency doesn't always work (the formats need more research) and also that the textures are stored in a far more modern way - there are multiple texture surfaces per texture file, much like (for example) Twilight Princess.

Link to comment
Share on other sites

I understand vertex skinning perfectly now! There are three possible values for "Unknown (2)" in the prms chunk:

 

Within any sepd in link.cmb:

 

-- PrmsChunk --
Unknown (1): 0x1, Unknown (2): 0x0
Index count: 0x1, Index offset: 0x18
Prm chunk offset: 0x1C
 
Index #0: 0x7
 
Within the first sepd in stalfos.cmb:
 
-- PrmsChunk --
Unknown (1): 0x1, Unknown (2): 0x1
Index count: 0x9, Index offset: 0x18
Prm chunk offset: 0x2C
 
Index #0: 0xE
Index #1: 0xC
Index #2: 0x2
Index #3: 0xF
Index #4: 0x8
Index #5: 0xA
Index #6: 0x5
Index #7: 0x4
Index #8: 0x6
 
Within the first sepd in babydodongo.cmb:
 
-- PrmsChunk --
Unknown (1): 0x1, Unknown (2): 0x2
Index count: 0x4, Index offset: 0x18
Prm chunk offset: 0x20
 
Index #0: 0x3
Index #1: 0x2
Index #2: 0x1
Index #3: 0x4
 
As you can see, Unknown (2) will be set to 0, 1, or 2.
 
0 means all vertices indexed inherit the properties of a single bone ID.
 
1 means on a per-vertex basis to look up which bone to use the properties of. When Unknown (2) is set to this, there will always be more than one "Index" value (bone ID).
 
The indices for drawing triangles will serve two purposes in this case. The first is still indexing which vertices to draw the triangle between. The second is they also serve as indices into "Unknown array 3" in the vatr chunk.
 
Unknown array 3 consists of single-byte values that look up which bone ID to use from the prms chunk.
 
For example, if the byte in Unknown array 3 was 03 in the Stalfos, for the prms chunk above that particular vertex (index value into Unknown array 3) would inherit the properties of bone ID 0xF.
 
means the same as 1, except the vertices DO NOT inherit the translations of their bones, they are only "mapped" to them. (Scaling and rotation only.)
 
So just be sure when reading sepd chunks that the third unknown array is now used. Also, I would like a new build that I can download if this works, possibly with bone selection and the ability to modify the rotation values of them so that it's possible to see that it's working properly.
 
Still no reading of the animations themselves, but we're so close now!
Link to comment
Share on other sites

As mentioned on the shoutbox, implementing this might take a while, as my knowledge of skeletal animation and skinning when it comes to modern OpenGL is extremely limited. I can think of some hacky workarounds that would probably bypass the whole point of using more recent OpenGL functionality, but might just work for the moment... we'll have to see.

 

Finally open-sourcing the whole thing would be a good idea, too, so that other people can ponder over and experiment with this. Think I'll do that soon-ish, probably next week...

Link to comment
Share on other sites

ive chatted with the group on #zelda channle and einstein95 doesnt trust me (understandable because the dude dosent know me) but it is ok for exracted content ive been told. if enyone has the files could you make a texture folder avalable.. i would make some sick stuff and you can call your self awesome...

Link to comment
Share on other sites

  • 3 weeks later...

N3DSCmbViewer latest (last?) binary and source: http://magicstone.de/dzd/random/3ds/N3DSCmbViewer-bin-src.rar

 

Not sure if I'll make it to the channel tonight to explain parts of the source if needed, but there's some stuff in the included Readme to get people started if they so desire. I'll make sure to drop in tomorrow or so, right now I've got an annoying headache, not sure if it'll go away soon. Reproducing that doc in the spoiler below, too:

 

 

REQUIREMENTS:

-------------

* Visual C# 2010 Express (or higher/better, I guess?)

* .NET Framework 4

* OpenTK 1.1

 

BUILDING:

---------

You'll need to remove the "Aglex" project from the solution, then add a reference to Aglex.dll to build this. Aglex is "Another

OpenGL Expansion Library", a lib I'm writing to make some OGL things easier on me, the source for which I don't want to release

yet. It's mainly just some camera, GLSL and texture stuff, plus the fancy text printer the HUD is using; just replace it if you

want to. Aglex aside, just fix whatever paths don't match up with your system (OpenTK etc).

 

FILE NOTES:

-----------

N3DSCmbViewer (C#):

\N3DSCmbViewer\Cmb\ModelHandler.cs - rendering

\N3DSCmbViewer\Csab\*.* - animation stubs, barely there

\N3DSCmbViewer\Shaders\*.* - shader stubs (for CmbVShader.shbin), also barely there

 

ETC1 (C++):

\ETC1\*.cpp - ETC1 texture decompression; don't touch rg_etc1.cpp, the glue code is in ETC1.cpp

 

OTHER NOTES:

------------

* All(?) texture types besides alpha-less ETC1 seem to have problems, don't convert correctly at all, are missing alpha, etc.

* ModelHandler.cs -> public void Render(...), the main rendering function, sucks; more details there

* MatsChunk.cs ignores "MaterialMore" b/c it can't read it correctly; dunno what's actually in those structs

* There a lot of "TODO"s scattered everywhere, so those might be a starting point if you want to improve this?

 

...you technically also need Visual C++ 2010 Express or better to compile the ETC1 DLL, I forgot to mention this.

  • Like 1
Link to comment
Share on other sites

Bump because these are relevant to the 3DS in general, and this ought to be the technical discussion thread for the 3DS:

 

https://github.com/bunnei/citra <- Real, working 3DS emulator. Only supports homebrew games. (For now?)

 

EDIT: This site makes nightly builds, apparently, so you don't have to compile it: http://www.emucr.com/2014/04/citra-git-20140425.html

 

http://pastebin.com/WueL0LnL <- File list for A Link Between Worlds.

  • Like 1
Link to comment
Share on other sites

  • 7 months later...

A word of warning, so to speak, from my tweets regarding this in advance: "Don't expect to ever get your hands on this, tho. Not b/c I don't wanna share, but b/c I dunno how far I'll even get w/ animation etc..."

 

It's a bit of curiosity winning over concerns of drama. It doesn't contain any (important) new discoveries, so it won't be interesting from a documentation standpoint, either. Really, don't expect anything to come out of this.

 

 

EiPpONK.png

 

  • Like 1
Link to comment
Share on other sites

Well, it really is just...

 

1) Twili's notes on skinning etc. from last page...

2) Some more parameters I figured out in the material data, namely texture min/mag filtering and wrap modes (which don't really show anywhere, and the latter don't work right with the Stalfos)...

3) Some general cleanup in the code.

 

It's nothing groundbreaking or previously unknown, aside from the material parameters.

Link to comment
Share on other sites

The last bits of coding I've done for the year. Only skinning modes 0 and 1 work so far, 2 is giving me trouble - either I'm doing something wrong (likely) or it's not just "don't inherit translation of bone"... Also, big performance hit. Will need to optimize and rewrite some stuff...

 

Whatever the case, I'll probably be back at this in early January - gonna enjoy the holidays with my family and not worry about projects and the like, at least for the next two or so weeks. Not saying I'll be completely gone, just that Visual Studio will likely stay closed during that time ;)

 

VSQqNGZ.png

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.