LEGO® Star Wars™: The Skywalker Saga ( .model )

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
shinzef
Posts: 8
Joined: Thu Oct 07, 2021 12:59 am

LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by shinzef »

Does someone know how to convert or open these files to a usable format?
NTT engine

Samples:
https://drive.google.com/drive/folders/ ... sp=sharing
ddj
Posts: 4
Joined: Thu Apr 07, 2022 4:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by ddj »

wondering the same,
didnt get further then figuring out for a particular droid dx11.ghg file, then again I'm a noob :) :
000005b6 MESH Version 0xc9
000005ba Number of Parts: 0x00000030
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by spiritovod »

They have quite complex mesh system, but for static meshes ("model" files) it's more or less simple.

In general, every mesh file consists of header and SMNR containers - you can find count of them in a model file before the first container, for example, for tree_stump and maz_castle from provided sample it will be 4. Those containers can include other kind of containers and other info. For static meshes they would contain mostly mesh data (vertices + indices and such) in DXTV sub-containers. Right before every DXTV container there will be vertices count in big endian - pay attention that fields should be parsed in big endian, but data itself is little endian. Depending on SMNR type (I think it's a second field after container's header) it can consist of one or two DXTV subcontainer - tree_stump is the first one and maz_castle is the second. In the first case all data will be included in the first block (positions as half-float + normals + UV + other) and after that there is block with indices. In the second case first DXTV subcontainer contains only normals + UV + other and the second one contains positions as float and block with indices. I believe that types of included in DXTV data are serialized in its header, also the header has variable size. You can see the purpose of each SMNR container at the end of file - for example, for tree_stump the first one will be base model, second and third are LODs and the last one is "shadow" mesh (it's usually used for effects).

Here is visual representation of results for the things explained above:
for tree_stump: https://i.imgur.com/0DWDomn.png
for maz_castle: https://i.imgur.com/ARSXUY9.png

===========================================

Update:
Ok, here is a brief explanation about skeletal meshes ("ghg" files):
They work in around the same way as static meshes, but more complicated. They have single indices block for all submeshes. Also, at the end of all SMNR containers with DXTV subcontainers with mesh data there will be 78 bytes block with usage of geometry of this DXTV block. For example, in incinerator_stormtrooper file first DXTV contains both positions + other info and indices data. Right after indices there is field with start index for indices, indices count, start index for positions and positions count (actually it's stride value * count). If you're serializing them separately, start index for positions will be always zero, as in most cases current DXTV contains separate positions data (either float or half-float) - but if you'll take a look at SMNR containers hierarchy, you should notice the same index values, which are shared among submeshes, considering current SMNR container. I suppose it allows to create groups of submeshes and process them in connection with each other if needed.

Here is visual representation of results for the things explained above:
for incinerator_stormtrooper (1st DXTV block submesh): https://i.imgur.com/QfMYTzv.png
for incinerator_stormtrooper (3rd DXTV block submesh): https://i.imgur.com/bR0wUlz.png
for incinerator_stormtrooper (4th DXTV block submesh): https://i.imgur.com/okAKBJi.png

===========================================

Samples, used here: link
Last edited by spiritovod on Fri Apr 08, 2022 4:56 pm, edited 6 times in total.
ddj
Posts: 4
Joined: Thu Apr 07, 2022 4:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by ddj »

well that's helpfull :)

Managed to pull out verts for a dx11.ghg, not entirely sure how to figure out the indices blocks yet, but this feels like a victory :D
Image
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by spiritovod »

I've updated my previous post with more info about skeletal meshes ("ghg" files).
ddj
Posts: 4
Joined: Thu Apr 07, 2022 4:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by ddj »

ok, thanks a lot.

Not entirely sure if i grasp it all yet, but it will definatly help in doing so.
still searching for the marker that gives a clue about the different offsets between the verts as well (uv's vert colors, normals etc that lay in between)
it seems to differ from one file to another, comparing SMNR headers from different files will spread clarity on that i suppose.

Takes a tremendeous time figuring it out when you don't exactly know what you're doing but pretty satisfactory gettin something out of it

What tool is that by the way? Looks complicated enough to completely loose my headings .
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by spiritovod »

@ddj: It's Advanced Mesh Reaper (AXE). As for what data is contained in each DXTV, I'm pretty sure it's serialized in DXTV header, which contains list of properties and their values (looks very similar to overall structure of unversioned properties in UE4). Unlike other engines, here you can actually guess their values, considering block contents, if you'll invest enough time.
KL3W
Posts: 41
Joined: Sun Jan 02, 2022 1:19 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by KL3W »

So is there a script for .model files yet??? Or is it only manual work?
DKDave
Posts: 136
Joined: Mon Nov 23, 2020 6:01 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by DKDave »

I haven't looked at it a massive amount, but the face indices are referenced from a submesh table at the end of the block of vertex data. So just by doing some manual tinkering, I managed to get this for Kuill. It should be possible to script it, but there are a few annoying things in there.

The DXTV header does contain information on which vertex types are present - there are 3 bytes for each entry after the vertex types count value, but not sure about most of them. As spiritovod says, they can probably be worked out though with a bit of time spent analysing them. The 3 bytes seem to be as follows:

Vertex element type (0 = vertices, 5 = UVs, etc.)
Number type
Vertex element offset within vertex stride (so offset 0 is usually vertices)

Image
ddj
Posts: 4
Joined: Thu Apr 07, 2022 4:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by ddj »

interesting to try make sense of it all, but I might have better picked some easyer files :lol:

Not entirely sure how to use that submesh table works but it appears in multiple places,

There seems to be one at the end of DXTV blocks (if it has indices it's after them, if it only has vert info its at the end of the verts. 0x00000000 dividing em? )
and there seem to be separate SMNR's aswell that hold those kind of tables.

general grievious ghg has all those variants

As for the DXTV header i assume after the 0x000000A9 comes the amount of vertex components in this form 0x00000001, after that the types?

Code: Select all

0001 00 00 05 02 00000125 44585456 000000A9 00000001 00 06 00


not entirely sure what the 0x003C, but seems to always come after position half floats (terminator or extra unused vector4 ?)
gives these:

Code: Select all

899D 7936 43B1 003C 
129C 6536 50B1 003C
509F 6536 49B1 003C
099D 5536 54B1 003C



Edit...
these seem to be the types 2byte identifier +1 byte dunowhat for most DXTV's from general grievious that seem relevant

Code: Select all

vert_cnt DXTV              list_cnt verts    ???      ???      ???      ???      ???       ???      ???      ???
0000040A 44585456 000000A9 00000005 0006 00  0108 08  0209 0C                                       0907 10  0A08 14  00 00 00 00 00 00
00000125 44585456 000000A9 00000001 0006 00                                                                           00 00 00 00 00 00
00000125 44585456 000000A9 00000004          0108 00  0209 04                                       0907 08  0A08 0C  00 00 00 00 00 00
0000485E 44585456 000000A9 00000008 0006 00  0108 08  0209 0C  0308 10            0506 14  0704 1C  0907 2C  0A08 30  00 00 00 00 00 00
000017C4 44585456 000000A9 00000004 0006 00  0108 08                                                0907 0C  0A08 10  00 00 00 00 00 00
000032EC 44585456 000000A9 00000009 0006 00  0108 08  0209 0C  0308 10  0409 14  0506 18  0704 20   0907 30  0A08 34  00 00 00 00 00 00
000016FD 44585456 000000A9 00000006 0006 00  0108 08  0209 0C  0308 10           0506 14  0704 1C                     00 00 00 00 00 00
0000014E 44585456 000000A9 00000003 0006 00  0108 08  0209 0C                                                         00 00 00 00 00 00
00000054 44585456 000000A9 00000001 0006 00                                                                           00 00 00 00 00 00
00000054 44585456 000000A9 00000002          0108 00  0209 04                                                         00 00 00 00 00 00
000005D7 44585456 000000A9 00000002 0006 00  0108 08                                                                  00 00 00 00 00 00
00001A57 44585456 000000A9 00000007 0006 00  0108 08  0209 0C  0308 10  0409 14  0506 18  0704 20                     00 00 00 00 00 00
Sluicer
Posts: 1
Joined: Mon Apr 11, 2022 3:19 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by Sluicer »

I called the values after the DXTV (and its version (0xA9)) VertexDefinitions: This is what I found in the past:
At first there is the number of definitions (n). After that there are n times 3 byte: variable, type, offset.

Code: Select all

enum VariableEnum
    {
      position = 0,
      normal = 1,
      colorSet0 = 2,
      tangent = 3,
      colorSet1 = 4,
      uvSet01 = 5,
      unknown6 = 6,
      uvSet2 = 7,
      unknown8 = 8, // A
      blendIndices0 = 9, // B
      blendWeight0 = 10, // C
      unknown11 = 11, // D
      lightDirSet = 12, // E
      lightColSet = 13, // F
    }

Code: Select all

enum VariableTypeEnum
    {
      vec2float = 2, // --> 8 byte
      vec3float = 3, // --> 12 byte
      vec4float = 4, // --> 16 byte
      vec2half = 5, // --> 4 byte
      vec4half = 6, // --> 8 byte (2 byte are lost)
      vec4char = 7, // --> 4 byte
      vec4mini = 8, // --> 4 byte (4 floating point values)
      color4char = 9, // --> 4 byte
    }


So in the fist line of your example:

Code: Select all

0006 00  0108 08  0209 0C  0907 10  0A08 14

position (0x00) of type vec4half (0x06) at offset (0x00)
normal (0x01) of type vec4mini (0x08) at offset (0x08)
colorSet0 (0x02) of type color4char (0x09) at offset (0x0C)
blendIndices0 (0x09) of type vec4char (0x07) at offset (0x10)
blendWeight0 (0x0A) of type vec4mini (0x08) at offset (0x14)
KL3W
Posts: 41
Joined: Sun Jan 02, 2022 1:19 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by KL3W »

I wish there was a tool for this, because I thought I knew some stuff about this but clearly I don't understand a thing...
Karpati
Posts: 107
Joined: Wed Nov 12, 2014 1:46 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by Karpati »

shinzef wrote:Does someone know how to convert or open these files to a usable format?
NTT engine

Samples:
https://drive.google.com/drive/folders/ ... sp=sharing

I have uploaded the converted files in Wavefront .obj/mtl formats.
http://3doc.i3dconverter.com/converted/SW_Saga_model_to_obj.zip
Karpati
Posts: 107
Joined: Wed Nov 12, 2014 1:46 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by Karpati »

KL3W wrote:I wish there was a tool for this, because I thought I knew some stuff about this but clearly I don't understand a thing...

I have added the NTT Engine .model loader module to the 3D Object Converter v8.024.
(I did not released it yet.)

I have tested it on the
1159 .model files I did find in the game.dat and
1929 .model files I did find in the game1.dat archive files.

SW_Saga.jpg
KillzXGaming
Posts: 6
Joined: Fri Jan 20, 2017 10:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by KillzXGaming »

I made my own dump tool for those interested which outputs as .dae (only works on .model atm).

Should support vertex colors and multiple UV sets aswell.

Source is included so feel free to use that to make your own tools. Just drag/drop a .model onto the .exe to use it.

Image

Download here:

https://drive.google.com/file/d/1YxNQmOPerNHR8trAMLFsQijWilEqJYv-/view?usp=sharing

Tool requires net 5.0 or higher.
MilkPls
Posts: 1
Joined: Sat Apr 16, 2022 2:20 am

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by MilkPls »

KillzXGaming wrote:I made my own dump tool for those interested which outputs as .dae (only works on .model atm).

Should support vertex colors and multiple UV sets aswell.

Source is included so feel free to use that to make your own tools. Just drag/drop a .model onto the .exe to use it.

Image

Download here:

https://drive.google.com/file/d/1YxNQmOPerNHR8trAMLFsQijWilEqJYv-/view?usp=sharing

Tool requires net 5.0 or higher.

Hi, tried to use this tool with one of the falcon cutscene files but it just opened and flashed the command prompt for a second and didn't extract the mesh. Any idea on how I could fix this?
09williamsad
Posts: 16
Joined: Sun Dec 22, 2019 3:28 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by 09williamsad »

KillzXGaming wrote:I made my own dump tool for those interested which outputs as .dae (only works on .model atm).
Should support vertex colors and multiple UV sets aswell.
Source is included so feel free to use that to make your own tools. Just drag/drop a .model onto the .exe to use it.
Download here: https://drive.google.com/file/d/1YxNQmOPerNHR8trAMLFsQijWilEqJYv-/view?usp=sharing
Tool requires net 5.0 or higher.

The default console and desktop installers for .net 5.0 put hostpolicy.dll in a different place to what the program expects.
"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.16\hostpolicy.dll"

Code: Select all

The default installers for .net 5.0 put hostpolicy.dll in a different place to what the program expects.
ModelDumper.exe TANTIVEIV_X3SCALE_DX11.MODEL
Cannot use file stream for [C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.deps.json]: No such file or directory
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
Failed to run as a self-contained app.
  - The application was run as a self-contained app because 'C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.runtimeconfig.json' was not found.
  - If this should be a framework-dependent app, add the 'C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.runtimeconfig.json' file and specify the appropriate framework.

Copying the dll to that folder "C:\Program Files\dotnet\" gets past that error but another occurs.

Code: Select all

ModelDumper.exe TANTIVEIV_X3SCALE_DX11.MODEL
Cannot use file stream for [C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.deps.json]: No such file or directory
Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1
KillzXGaming
Posts: 6
Joined: Fri Jan 20, 2017 10:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by KillzXGaming »

09williamsad wrote:
KillzXGaming wrote:I made my own dump tool for those interested which outputs as .dae (only works on .model atm).
Should support vertex colors and multiple UV sets aswell.
Source is included so feel free to use that to make your own tools. Just drag/drop a .model onto the .exe to use it.
Download here: https://drive.google.com/file/d/1YxNQmOPerNHR8trAMLFsQijWilEqJYv-/view?usp=sharing
Tool requires net 5.0 or higher.

The default console and desktop installers for .net 5.0 put hostpolicy.dll in a different place to what the program expects.
"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.16\hostpolicy.dll"

Code: Select all

The default installers for .net 5.0 put hostpolicy.dll in a different place to what the program expects.
ModelDumper.exe TANTIVEIV_X3SCALE_DX11.MODEL
Cannot use file stream for [C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.deps.json]: No such file or directory
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
Failed to run as a self-contained app.
  - The application was run as a self-contained app because 'C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.runtimeconfig.json' was not found.
  - If this should be a framework-dependent app, add the 'C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.runtimeconfig.json' file and specify the appropriate framework.

Copying the dll to that folder "C:\Program Files\dotnet\" gets past that error but another occurs.

Code: Select all

ModelDumper.exe TANTIVEIV_X3SCALE_DX11.MODEL
Cannot use file stream for [C:\Users\Adam\Downloads\LegoStarwarsSkywalkerSagaModelDumper (1)\ModelDumper.deps.json]: No such file or directory
Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1


Does this work?

https://drive.google.com/file/d/1YOQnC0_5If32u3ssIDAur31k3qclerT7/view?usp=sharing

And net5.0

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-5.0.16-windows-x64-installer
09williamsad
Posts: 16
Joined: Sun Dec 22, 2019 3:28 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by 09williamsad »

KillzXGaming wrote:I made my own dump tool for those interested which outputs as .dae (only works on .model atm).
Does this work? https://drive.google.com/file/d/1YOQnC0_5If32u3ssIDAur31k3qclerT7/view?usp=sharing
And net5.0 https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-5.0.16-windows-x64-installer

That 2nd one worked.
I already have that runtime installed, repair has no effect on the dll location.
I am guessing that the dll install location changed at some point, and you have the dll from before it changed.
KillzXGaming
Posts: 6
Joined: Fri Jan 20, 2017 10:44 pm

Re: LEGO® Star Wars™: The Skywalker Saga ( .model )

Post by KillzXGaming »

Might've been the way it was built. I also now put it on github incase people need to post issues with it.

https://github.com/KillzXGaming/NTT-Mod ... r/releases