scurest / apicula

Convert Nintendo DS .nsbmd models
BSD Zero Clause License
160 stars 19 forks source link

Native Animation Decompression + NSBVA/NSBMA Support? #31

Open Schollidazed opened 3 years ago

Schollidazed commented 3 years ago

In Sonic Rush, some of the different animations are compressed into one NSBCA file. I use a daesplitter python script found in this VGResource thread. Will there be native support for separating these animations?

On almost the same topic, will it be possible to export NSBVA and NSBMA files sometime in the future? Sonic rush uses a ton of it, and for some cutscenes, they're compressed like joint animations. I'm pretty sure that MKDSCM has support for these file formats that you can look into.

scurest commented 3 years ago

Yeah, the .dae splitter is mentioned on the wiki too. I'm not planning to have apicula do that .dae splitting itself if that's what you mean.

I don't know anything about NSBVA/NSBMA. If you have docs about them that would be helpful. Whether it's possible to export them depends on what they are and if .dae/.gltf supports whatever they are.

Schollidazed commented 3 years ago

Yeah, dae and gltf might not support NSBVA or NSBMA natively, and I've looked everywhere, and there's no documentation on them like NSBMD has been.

I'm not that experienced with reverse engineering yet, I'm still learning. The best I can give is some ideas on how they might work from what I know from ripping models, and some ways that apicula could support it.

NSBVA: It's linked to the model file, and it changes the visibility of the mesh, hence Nitro Visual Animation. It operates on a binary sort of style, no half visibility as far as I know. There are 2 types of mesh that it could affect, either vertices or faces, I'm not sure, but it's most likely verticies. Psuedocode-ish: Each keyframe, Lists each vertex(or face), gives it a value of either 0/1 if vertex == 0, Not Visible if vertex == 1, Visible How Apicula could support it: Maybe it could detect changes with the keyframes, and export separate models for each of the keyframes on which they change, and list them as well.

NSBMA: It's linked to the material file, and changes the color value of the material. It most likely operates on RGB Values, and acts similar to adding a color value to a material in blender (EDIT: There might be an alpha value that also controls visibility. I'll have to look into that). From what I know, some models that require it are appear blank in MKDSCM until it's applied. So... maybe the material is set as the NSBMA File ? Psuedocode-ish: Each keyframe holds a RGB Value (we'll call it VariableRGB). NewMaterial = ImageTexture + VariableRGB How Apicula could support it: Much like the last one, maybe exporting the pngs with the keyframes needed could do the trick, along with printing the keyframes at which they change. If this doesn't work, then maybe printing the RGB Values that change, and when they change could work.

So yeah, I hope I could help out with this. If you need anything else for me to figure out/research, just let me know.

red031000 commented 3 years ago

+1 pokemon diamond/pearl/platinum has both NSBVA and NSBMA files, and it'd be useful to have one tool that can open all the types rather than having to rely on a mixture of MKDSCM and apicula, since MKDSCM can't play NSBTA files at all, but can play both NSBVA and NSBMA, so as of right now I am not aware of any tool on the internet that can play a full DS animation (given that it uses all possible files) apart from an emulator

scurest commented 3 years ago

Does someone have a .nsbmd and .nsbva they know go together?

Schollidazed commented 3 years ago

Yes! Sonic Rush/Rush Adventure has a ton of those. Here's a set for the player character(s) in Sonic Rush (There are separate animations compacted into the NSBVA, similar to a NSBCA.) Player.zip

SuperGameCube commented 3 years ago

Yeah, the .dae splitter is mentioned on the wiki too. I'm not planning to have apicula do that .dae splitting itself if that's what you mean.

I don't know anything about NSBVA/NSBMA. If you have docs about them that would be helpful. Whether it's possible to export them depends on what they are and if .dae/.gltf supports whatever they are.

NSBVA is Nitro System Binary Visibility Animation, and NSBMA is Nitro System Binary Material Animation for the record. NSBMA is used to change the color of the Goomboss character model in the Mission Mode of MKDS when he gets angrier, as an example of it's use. Personally haven't seen Visbility Animation in use anywhere yet, though.

scurest commented 3 years ago

Yeah, NSBMA also changes the color of that core thing in the robot in the gif in the Readme. It's setup like the NSBTA animations, where it looks like there are five things it can animate, but I'm not sure what they are yet. I'd probably have to find one playing in an emulator and see what commands it sends when it binds the material.

SuperGameCube commented 3 years ago

NSBMA animates various material settings, as it's name implies. I use it to animate the lightning strikes in GCN Bowser Castle for my MKDS ROM Hack. it can animate diffuse, alpha, ect.

scurest commented 3 years ago

If you can make NSBMAs, can you make me one that animates alpha 0 to 1, another that animates diffuse red to blue, etc?