NDS model + animation => COLLADA converter - Printable Version +- The VG Resource (https://www.vg-resource.com) +-- Forum: The Resources (https://www.vg-resource.com/forum-109.html) +--- Forum: The Models Resource (https://www.vg-resource.com/forum-111.html) +---- Forum: Project Organization (https://www.vg-resource.com/forum-119.html) +---- Thread: NDS model + animation => COLLADA converter (/thread-30547.html) |
NDS model + animation => COLLADA converter - scurest - 01-29-2017 Hi everyone. This is my first post. I've been working on a program to convert NDS models and animations to COLLADA. It outputs vertex colors, joint trees, and skeletal animations. I've been testing it with the games Kingdom Hearts: 358/2 Days and Ore wa Omae o Mamoru, where I've had pretty good success. I don't know how much interest there still is in ripping DS games, but I wanted to share it here. Hopefully if all the kinks are ironed out it can be used for submitting models apicula GitHub Page Latest Build, 64-bit, Windows I wrote a tutorial on how to use it here, but the short version is that you can follow Mystie's NDS Ripping Tutorial up to the end of step 4, then use apicula to convert the NSBMD files by running apicula.exe convert <PATH TO NSBMD FILES> -o <OUTPUT DIRECTORY> at the command line. You can also add any NSBCA files with the NSBMD files to add animations to the models. Examples Bugs The success rate for models is fairly good, but there are definitely still known bugs I'll be working to fix some of them for a while. If you find any, you can post about them here. If anyone is familiar with the Nitro SDK formats, you can also see the code on GitHub. If anyone can test importing the COLLADA files into commercial DCC programs like Maya or 3DS Max, that's be nice too! RE: NDS model + animation => COLLADA converter - Kold-Virus - 01-29-2017 So if I read this right, this works for most games that have NSMBD usage. Nice! RE: NDS model + animation => COLLADA converter - Hallow - 01-29-2017 Oh hell yeah, this is great, I've been wanting something like this for ages now. Thanks dude great work. RE: NDS model + animation => COLLADA converter - scurest - 01-29-2017 (01-29-2017, 06:47 PM)Rodo Furedorikku Wrote: So if I read this right, this works for most games that have NSMBD usage. Nice! That's the intention, right. NSBMD files for models and NSBCA files for skeletal animations. In practice, I don't know how many games this will work for. For example Avalon Code has model files that have the BMD0 stamp, but aren't the format that this can understand. apicula can also scan a ROM (or any kind of file really) and extract all the models and animations that it understands as long as they aren't compressed or encrypted or anything. The instructions for that are here. RE: NDS model + animation => COLLADA converter - Orwell - 02-17-2017 Thank you for the tool, i have still some NDS game models that i would like to obtain, both use nsbmd format, unfortunately those versions were not supported when i tried the last time with the most known tools. The games are Golden Sun: Dark Dawn and Love Plus+, i will test them soon. Otherwise i have to manually convert them or modify the nsbmd viewer, but i'm too lazy XD. RE: NDS model + animation => COLLADA converter - Inferry - 04-04-2017 You just made my day, thanks so much, I'm still getting some rouge vertices (Love Plus Models), but the fact that I don't have to made the rigging by hand is more than enough. Also, what's with the "_BLEND#_" bones? they are not part of the original rig. RE: NDS model + animation => COLLADA converter - scurest - 04-06-2017 I'm glad it's useful! About the __BLEND##___ bones (those are, for example, the really long bones on Roxas's model above that go outside his body)... I'm also not exactly sure! I can tell you what technical feature in the model file makes them necessary, but the purpose they served to the modeler is a mystery to me. They'll only appear is a model uses vertices that are influenced by multiple bones. Technical explanation follows: There isn't really an "original rig" for an NSBMD model. The model file contains an array of named object matrices, but they're not connected together in a skeleton or anything (and one object might occur in many places or not at all in the final skeleton). The file also contains rendering commands, which essentially multiply these object matrices together and store them to GPU variables (for example, it might multiply "Root" -> "Torso" -> "LUpperLeg" -> "LLowerLeg" -> "LFoot" together and put it in GPU slot #3). Then before a group of vertices is drawn, the right matrix will be set from the GPU variables (in the last example, before the tris for the left foot are drawn, the matrix from GPU slot #3 would be loaded). The skeleton is built by tracking which object matrices make up the matrix in a GPU variable and creating joints that will transform the vertices in the same way that running the rendering commands in the model file would. Simply speaking, every factor in a matrix product becomes a joint. There's also a separate array of unnamed matrices in the model file I called blend matrices because they're used by a weird rendering command that blends matrices together. Specifically, it puts the sum of terms that look like (scalar weight) * (matrix from GPU slot #XXX) * (blend matrix #YYY) into a GPU slot. So if XXX=3 in the example above, you're looking at a matrix like "Root" -> "Torso" -> "LUpperLeg" -> "LLowerLeg" -> "LFoot" -> (blend matrix #YYY) and we need a joint to represent that final factor, and that's where the "__BLENDYYY__" at the leaf comes from. Why there's a command for this (as opposed to just summing terms like (scalar weight) * (matrix from GPU slot #XXX)), I don't know. (This feature was kind of a pain btw. It was the last thing I needed to get Roxas to work though, which was something like my original goal ) RE: NDS model + animation => COLLADA converter - Inferry - 04-09-2017 Oh, that makes sense, sort of, it certainly is more complex than what I thought it would be, it makes me be more grateful to you, that's for sure. If I understand correctly, I may be able to edit the armature to remove those bones and pass the influence to others, at least looks like it can be done. I'll have to check if I can edit the animations to match the new armature thou. RE: NDS model + animation => COLLADA converter - scurest - 04-21-2017 I looked into this more and I finally figured out what those blend matrices are supposed to be used for! The good news is that if they are used for that (they're supposed to be inverse bind matrices), they can be eliminated from the skeleton after all, haha And if they're not, you'll at least get a big warning telling you that something weird is happening. But if it goes well, you should get a nice clean skeleton now. Example before/after I also fixed an unrelated bug that caused some verts to be parented to the wrong joints, which might have been the cause of your rogue vertices. Change are in the latest version. If this doesn't fix the problems with your model, Inferry, if you can upload the NSBMD file you're using somewhere, I'll take a look and see if I can get it working. RE: NDS model + animation => COLLADA converter - Inferry - 04-22-2017 Works wonderful, it even fixes some bone misplacements, I still have to play jigsaw with the models but that's because of the way they are stored(F Konami). I wonder, is it possible to extract animations only? the models I have are a bunch of different parts that the game puts together(like legos), but the animation files (or what I think are the animation files) don't seem to be matching the models at all, so it always trows an error no matter what I try. I can get animations from other games, but I also seem to be getting only the first animation when there's obviously more than one, so I don't know if I'm doing anything wrong. I'm kind of sleepy so that may be part of the problem. RE: NDS model + animation => COLLADA converter - LGB - 04-23-2017 Really cool men I just tryed RE: Deadly Silence models and it works perfect, at first I thought they didn't have an skeleton but it was invisible until i turned the x-ray option in blender. Now i wont have to rig them anymore Although didn't work with Iron Man 2 NSBMD's when i run it I got "Found 0 BMDs. Found 0 BCAs." even when i can see the model in Console tool RE: NDS model + animation => COLLADA converter - scurest - 04-23-2017 (04-22-2017, 11:54 PM)Inferry Wrote: I wonder, is it possible to extract animations only? the models I have are a bunch of different parts that the game puts together(like legos), but the animation files (or what I think are the animation files) don't seem to be matching the models at all, so it always trows an error no matter what I try. It seems... difficult An animation is basically just a big block of matrices. All the information about which joint to target with which matrix comes from the model files. I tried to extract models from Love Plus and only got some disembodied hands, which only seem to have the part of the skeleton that influences that hand (eg. the hand joint and then all of its ancestors). So if you have more pieces I can imagine how you could fit them together but unless some file has the full skeleton it will be hard to apply a NSBCA animation to it. Btw, the way you can know if a file is an animation file is provide it without any models to the view command (apicula v file_in_question) and you should see Found 0 models. Found <some positive number> animations.. If you see any errors here, apicula couldn't understand the file at all and wouldn't be able to apply to any model. (Maybe I should add an info command to make this kind of information more accessible....) (04-22-2017, 11:54 PM)Inferry Wrote: I can get animations from other games, but I also seem to be getting only the first animation when there's obviously more than one, so I don't know if I'm doing anything wrong. What program are you importing them with? Blender seems to do this—truncate to the first animation—to all COLLADA files (that's why I showed off the animation in Godot). I've been meaning to write up something about the limitations that Blender has. I was hoping other programs wouldn't have this issue though. (04-23-2017, 07:19 PM)LGB Wrote: Although didn't work with Iron Man 2 NSBMD's when i run it I got "Found 0 BMDs. Found 0 BCAs." even when i can see the model in Console tool Thanks for the report! I pushed some changes that should improve things (but it's still not perfect), including support for NSBTX files, which you'll need to provide on the command line along with the NSBMDs get the textures to work. RE: NDS model + animation => COLLADA converter - Inferry - 04-27-2017 (04-23-2017, 11:41 PM)scurest Wrote: It seems... difficultBugger, well for the way you put it, those files may not be the ones to use with those models. "You should see Found 0 models. Found <some positive number> animations." Found 0 models. Found 0 animations. So the files I thought where animation files, where not animations, or at least they had no animations in, so now I have to find where they actually are, with some luck they'll fit the models I have, if I happen to find them. (04-23-2017, 11:41 PM)scurest Wrote: What program are you importing them with? Blender seems to do this... I'm using Blender I imported the file into Unity and the animations(from some other game) are all there. So I tried to use FBXconverter(since it accepts dae) to turn it into a fbx file to see if I can bring that to blender, but it trows a "not enough parameters" error, there may be a node that lacks a definition, but the file is massive so I can't see if that's the case. I'll try to find a smaller model to import and see if it's a problem with only that file or a more general thing with the format, in the mean time I'll see if I can download max and maya (trials of course ) to see if they can import the dae properly. (04-23-2017, 11:41 PM)scurest Wrote: only got some disembodied hands... So if you have more pieces I can imagine how you could fit them together. That sounds about right, you may have the base hands for one of the girls, the armature is not that hard, you just merge them all, remove the duplicated bone and re-parent those who may need it, is not that much of a big deal really as blender does most of the work. Having the animations is just a nice bonus on top of it all, which is really great, thank you so much. RE: NDS model + animation => COLLADA converter - scurest - 04-29-2017 Oh, good idea about FBX converter ! I didn't know about that. The error it gives was due to a bug in my COLLADA code, which is fixed now. Tell me if you still have problems doing the conversion. The FBX files do preserve all the animations. Importing them into Blender gives even crazier bone placement than importing the .daes though! RE: NDS model + animation => COLLADA converter - Inferry - 05-20-2017 So the FBX does indeed break the armature, and sadly due to the way blender handles animations I couldn't find a way to pass them to the armature of the *.dae (the nice one) without screwing the animation itself. So I ended writing and learning a phyton script that separates each *.dae file into several ones, each containing one of the animations in the original file, I only have to import each file individually and merge the animations into one single library, some require editing due to the extra frame they come with but that's not my fault, that's how they were, to begin with. Anyway, here's the code for anyone interested, copy and paste it into a text file and change the extension to ".py", you'll need python2.7 for it to work Code: import sys I only tested it with three files, is not optimized and there is probably a better way to do this, but the thing works and is enough for me (although if you think it can be improved let me now to change what's needed). Use the command line and pass the file as an argument daesplitter.py <file> or make a bat with this ("c:\Python27\python.exe" daesplitter.py %1), and drag and drop the file onto the bat. And I was unable to make a test on Maya or 3Dmax due to the fact that 64 exclusive nowadays. |