Diablo immortal models

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Diablo immortal models

Post by sanktanglia »

I'm working on writing an importer for diablo immortal files, using a template https://github.com/CucFlavius/Zee-010-Templates. I can render out the mesh, but im currently stuck on the texture coordinates. The vertex buffer has the following structure
VECTOR4H tangentAsQuat;
VECTOR2H uv;
but the uv values arent in the 0-1 as id expect, instead normally being between .3 and .5 and -.3 and -.5 Im assuming this has something to do with the tangent but the math behind it is a bit above my knowledge level. Im attaching some copies of models. I will also pay whoever helps solves this!

https://www.dropbox.com/s/2up7266hjpsb2 ... .Mesh?dl=0
https://www.dropbox.com/s/siqi6dr1vuqqv ... .Mesh?dl=0
https://www.dropbox.com/s/4y7xoi5hgt22m ... .Mesh?dl=0
*links fixed by aluigi*
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

Your links are broken.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Diablo immortal models

Post by aluigi »

I found his original topic on xentax and copied the correct links from there
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

Thanks for the fix. :)

Do you have more samples to look at? This game has like 7 or more different vertex formats. Include textures too if possible, as they have to match up with the UVs.
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

yeah let me add some more examples
https://www.dropbox.com/s/r3rjewejep37y7i/drop.zip?dl=0 has a bunch more models, ill work on grabbing and converting some textures as well
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

https://www.dropbox.com/s/wxho440m56p17 ... s.zip?dl=0 is some textures as well. The format covers the majority of the vertex types, and as far as I can tell, the P3F_N4B_T2F format has uv that are not transformed, im working on visualizing that now to confirm, but any of the vertex buffers with the tangentAsQuat are included have uvs i cant use and i dont know enough about the math to be able to derive them. thanks for looking into it!
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

https://www.dropbox.com/s/5eqe5yulubtom ... c.zip?dl=0 is textures for the leoric model too
https://www.dropbox.com/s/nmboojth9vvbc ... erial?dl=0 ive also added an example material for leoric. One thing to note in the material file the textures are guids but i have translated them into the textures i provided in the zip
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

Yeah, the mesh file doesn't seem to have any material data in it. The other thing missing is a skeleton, as the mesh has skin weights and bone indices.
If you have the boss_leoric skeleton, I wouldn't mind seeing it.

But, anyway, it appears H means half-float. This is a standard half-float stored as a WORD. There's nothing game-specific about it.
You can find code on Github to read half-floats or grab it here:

https://blog.fpmurphy.com/2008/12/half- ... at_14.html

Q4H_T2H has one UVset.
Q4H_T2H_T2H has two UVsets.

P3F_N4B_T2F Uvset are floats, but I don't see anything unusual about it. But, if the UVs seem to be offset or scaled, then I would suspect the missing information would be found the material file. This seems to contain some shader-specific data. There could be some special scaling or offset listed here at the shader level.
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

im familiar with half floats and how they work, my point was that for the Q4H_T2H vertex buffers, you cant use the uv values as provided. My belief is that they are transformed in some way by the quat that comes with the uv coordinates, but i havent been able to figure that out. Ive been reading up on tangent space and assume it has something to do with that. I brought up P3F_N4B_T2F to note that the uvs in that buffer format do not need transforming and come through fine(see https://imgur.com/a/arlj85A). Im currently diving into how the shaders work/which shaders are used for which model but theres 5+ gigs of different shaders when uncompressed, its not clear which ones are used. https://www.dropbox.com/s/ukrxm8p3oop9x ... leton?dl=0 is a link to the skeleton though im not planning on supporting animation, though the templates cover the majority of the animation files and data too
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

leoric uses Q4H_T2H. Its UVs come out ok.

uvmap and model:

https://i.imgur.com/bfz8Aj1.png
https://i.imgur.com/gmh6GQY.png
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

well damn im definitely the idiot then cuz I just followed the formats description of
uint16 / 32767.0f
Im doing my reading in typescript so ill work on adapting the link you shared in that language, much appreciated
matt1bord
Posts: 1
Joined: Tue Feb 01, 2022 11:15 am

Re: Diablo immortal models

Post by matt1bord »

This is useful information
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

Can confirm I was able to render out the leoric model once I swapped out my half float parsing, thanks again!
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

I have one more request if you're still around.
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

For anybody who's interested in Diablo Immortal data files, I found this tool:

Diablo Immortal Data Tool
https://github.com/CucFlavius/DIDT

It lets you download all the data files for the game. For me, it downloaded about 6GB of data, and the entire
process took about a hour or so. I had to compile DIDT with Visual Studio 2017. Older VS versions gave me errors.
Target framework was set to net5.0 (windows 10?), but I was able to compile it with net 4.8.

After download is complete, a lot of files are still unnamed, but DIDT has extra tools to rename the files.
There is also a third step. All the files have a ZZZ4 header, indicating they are LZ4 compressed. DIDT has
a tool to decompress all files.

Steps:
1. Download files.
2. Rename files.
3. Decompress files.

It dumps a lot of data, like 3d models, textures, sounds, movie clips, etc... I'm not sure if the entire process was complete, as there were quite a few unnamed files leftover from the process.
zaramot
Posts: 51
Joined: Mon Sep 01, 2014 7:19 pm

Re: Diablo immortal models

Post by zaramot »

Models are looking pretty straightforward. What have you used for textures? It's saying they are mip compressed, which I suppose not all what is wrong with them xD

Image
sanktanglia
Posts: 11
Joined: Fri Sep 15, 2017 4:30 am

Re: Diablo immortal models

Post by sanktanglia »

im currently using the template to write a custom tool that extracts out the texture data chunks and feeds them to pythons astc lib, works pretty good
zaramot
Posts: 51
Joined: Mon Sep 01, 2014 7:19 pm

Re: Diablo immortal models

Post by zaramot »

Nice! Could you explain more detailed the process? It will be useful for a lot of people, including me!
coredevel
Posts: 75
Joined: Tue May 30, 2017 1:10 am

Re: Diablo immortal models

Post by coredevel »

If you're familiar with .ktx files, they're just containers for compressed textures. You could write a script to output a valid .ktx header and dump the ASTC data into it. PVRTexTool can then be used to read it. PVRTexTool also reads raw .ASTC files, which might be easier to output.
Last edited by coredevel on Sat Oct 22, 2022 1:09 am, edited 1 time in total.