| Hello, and welcome to InfernalWorks. This forum is dedicated to the research and development of modifying Devil May Cry 3 and 4. We have an assortment of released mods, tutorials and other resources that should be useful if you are attempting to learn to mod this game. If you ever need any help, just ask our community. We would appreciate it if everyone could read and adhere to the Rules and Regulations upon registering. Thanks for your visit, and enjoy your stay. ![]() ~ Vertigo PS: THE SHOUTBOX IS NOT THE SEARCH BAR. MAKE SURE YOU'RE ENTERING YOUR SEARCHES INTO THE RIGHT FORM. |
| DMC4 Model Format; Reverse Engineering the DMC4 Model format. | |
|---|---|
| Tweet Topic Started: May 20 2013, 11:16 PM (7,758 Views) | |
| TheSharki | May 20 2013, 11:16 PM Post #1 |
|
Mad Programmer
|
This year in college I learned a lot about 3D rendering and video game engines, as I have not seen any remodelling mods I'm assuming noone managed to make a full model converter for DMC4. So that's what I'll be working as of now, a model importer/exporter that allows you to edit models in 3DS Max or Blender and insert them back into the game. Goal I will use the final knowledge to create a converter program. Converter program source code: Google code project Update 03 Figured out the triangle/face structure of the file, at least the greatest part of it. This together with the normal vectors extracted from the vertices gives the mesh with correct shadowing. ![]() DMC4's model file stores triangles in a what might seem a weird way at first, but it's created in that way to keep the file as small as possible. I'll try to explain is as good as I can, using an example. Take the following triangles: 0 1 2 3 2 1 2 3 4 The storage consists out of two parts: Basic structure The first line is stored as is, inside 16bit integers (or short): 0x0000 0x0100 0x0200 (Reason for this sequence of bits is Little Endian mode) Because the next line contains two vertex indices that we're already stored but in reverse it can be overlapped with the previous data. This results in the addition of one number to the previous sequence (0x0300), which results in: 0x0000 0x0100 0x0200 0x0300 The next sequence contains a similar effect, this can be overlapped again with the previous sequence but flipped compared to the previous one. This again yields the addition of one single number(0x0400): 0x0000 0x0100 0x0200 0x0300 0x0400 As we can see what normally would have taken 9 integers to store only takes 5 integers using this technique, this allows the model files to be significantly smaller then they would have been. There is an exception however. Handling exceptions What if the next line does not contain two vertex indices of the previous line, this gets handled as followed. Assume our previous example, the last line was [2 3 4]. What if the next line was [5 6 7]. The program signals this change in sequence by doubling the last integer of the previous step, for the example this yields: ... 0x0200 0x0300 0x0400 0x0400 Normally the next sequence could be added on to this and the compiler/exporter/interpreter would know what to do. But for safety (bit errors,...) this is not what happens, instead they double the first integer of the next sequence to signal the start. This yields the following sequence: ... 0x0200 0x0300 0x0400 0x0400 0x0500 0x0500 0x0600 0x0700 .... DISCLAIMER This is not the entire process of handling indices, as the transition between mesh surfaces/groups is not described. Nor does my program handle it (yet). Update 02 Spoiler: click to toggle Update 01 Spoiler: click to toggle Base Version Spoiler: click to toggle
Edited by TheSharki, May 23 2013, 01:54 PM.
|
![]() Steam: http://steamcommunity.com/id/the__sharki | |
![]() |
|
| LucasRaven | May 20 2013, 11:36 PM Post #2 |
![]()
VOIDIANS
|
You could've asked... Or looked around the forum. Anyway I'll probably marry you if you really make this happen. Here's Surveyor's code for the file structure, it should be enough: human.h Also check these out: http://s1.zetaboards.com/InfernalWorks/topic/4345214/1/ http://s1.zetaboards.com/InfernalWorks/topic/4222954/1/ Edited by LucasRaven, May 20 2013, 11:36 PM.
|
| You're reaping what you've sown! | |
![]() |
|
| TheSharki | May 21 2013, 07:53 AM Post #3 |
|
Mad Programmer
|
Thanks a lot for the information, this is going to help a lot. |
![]() Steam: http://steamcommunity.com/id/the__sharki | |
![]() |
|
| King.Ikki | May 21 2013, 12:57 PM Post #4 |
![]()
|
Yeah! Spidey on the way! And Lucas, I'll be marrying TheSharki too... So, polygamy? |
| ...People With The Same Exact Feathers Don't Exist... | |
![]() |
|
| LucasRaven | May 21 2013, 04:19 PM Post #5 |
![]()
VOIDIANS
|
Nuuu! Don't mess with mah bytch! ![]() [EDIT] Hey Sharki, I saw the update. When you figure the indices out I want you to tell me exactly how they work. I want to know how they're stored... Edited by LucasRaven, May 22 2013, 01:07 AM.
|
| You're reaping what you've sown! | |
![]() |
|
| TheSharki | May 22 2013, 08:27 AM Post #6 |
|
Mad Programmer
|
I found the place where they are stored. I almost figured out how they are stored, have hunch though shouldn't take too long. But apparently the triangles list is segmented for several mesh surfaces, which I still haven't figured out how the splitting of the list is handled. |
![]() Steam: http://steamcommunity.com/id/the__sharki | |
![]() |
|
| NieJestemzPolskiPL | May 22 2013, 09:24 AM Post #7 |
|
Hold your Colour
|
Good to know, and by the way nice progress. |
![]() |
|
| LucasRaven | May 22 2013, 10:43 AM Post #8 |
![]()
VOIDIANS
|
I know where they're stored too. Anyway, the objects are waaaay before that. Either before or after the bones.
|
| You're reaping what you've sown! | |
![]() |
|
| King.Ikki | May 22 2013, 12:54 PM Post #9 |
![]()
|
You guys are pros... Hoping to see this soon~ Yeah~ (So, no polygamys? It cant be helped then... Die, ya byatch! Die!) |
| ...People With The Same Exact Feathers Don't Exist... | |
![]() |
|
| TheSharki | May 22 2013, 07:31 PM Post #10 |
|
Mad Programmer
|
I'm putting my knowledge to use by creating a converter program. The program will be completely open-source. I made a project space on Google code. The added the link to the original post. [EDIT] Had to post this, took a first guess at how the triangles were stored.
Edited by TheSharki, May 23 2013, 11:39 AM.
|
![]() Steam: http://steamcommunity.com/id/the__sharki | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| Go to Next Page | |
| « Previous Topic · DMC 4 Works in Progress · Next Topic » |














7:06 PM Jul 11