Romhacking.net

Romhacking => Personal Projects => Topic started by: Reld on February 02, 2020, 10:28:30 pm

Title: Mega Man X2 & X3 Wireframe Model Editor
Post by: Reld on February 02, 2020, 10:28:30 pm
I'm working on a program for editing the wireframe models in Mega Man X2 and X3, inspired by falchion22's Mega Man Z2 (http://www.romhacking.net/forum/index.php?topic=29929.0) project and DarkSamus993's disassembly of the model data.
(https://i.imgur.com/VNumLqE.gif)
(https://i.imgur.com/NBx8i4n.png)
There's a downloadable version of my first attempt available here (https://drive.google.com/file/d/148ju7C08bKbo-Rjnw062GUSosecn1cQU/view?usp=drivesdk).

It looks nicer than it actually is, I think. It's not super user-friendly (clicking in the viewports does nothing, you have to use the controls on the right to edit everything), and it probably has some bugs (the perspective rotation doesn't behave quite like you'd expect because I don't know jack about 3D math), but it does work. This version can only edit the title screen "X" model from MMX2. It comes with files for the "Z" model seen above, and a model of a cube.

Right now I'm working on adding support for the rest of the models in both games.
(https://i.imgur.com/43jVtrG.png)
I've managed to get them importing alright for the most part, although the viewports are currently offset to place 149 on the Z axis near the center because that's where the center of the "X" model happened to be. That's a relatively easy fix. I've also run into a bit of a problem with the X3 models.

In X2 the models are all stored separately, with the vector data for the model first (which consists of a bunch of 16-bit pointers to the vertex data), followed immediately by the vertex data (X,Y,Z positions) for that model. In X3 the vector data for a bunch of the models is stored one right after the other, and then there's a big block of vertex data at the end that seems to be shared between them. This is throwing off my vertex count, but more importantly it means that editing one model might cause changes to another model if they happen to share vertex data.

I don't know for sure yet if any of the models actually do share data. I'm just guessing they do based on how the pointers jump around. It's possible the vertex data just happens to all be mixed up together, but none of it is actually shared between models.

I'm not sure why they did it this way. If some of the data actually is shared I would assume it was done to save space, but it looks to me like there's a bunch of empty space at the end anyway. I wonder if maybe I should try to split all of the models up and provide an IPS patch or something to apply before using the editor.
Title: Re: Mega Man X2 & X3 Wireframe Model Editor
Post by: Thanatos-Zero on February 04, 2020, 09:44:08 am
I wonder how detailed the Sigma Virus can be made, until it starts to slow down the game.
Title: Re: Mega Man X2 & X3 Wireframe Model Editor
Post by: kuja killer on February 05, 2020, 01:58:51 am
yea i remember there was sometimes slowdown in the sigma 3D head fight. But i think it was only when he spawns those random enemies, or during that "laser-eyes" attack. I dont remember.

It's probably just the laser that causes slowdown, since it keeps making explosions nonstop, but I don't really know.

But wow so cool. :) i was just playing around with your editor a little bit. So all those individual little "dots" is what controls each piece or position. Interesting. :)

I clicked "import from rom" and opened the mmx2 rom just cause i was curious, but yea nothing happened. But...it did for some reason save to the ROM, i never clicked "write to rom" or anything. I double-checked in emulator, and nothing was overwritten or corruped at the title screen luckily.
Title: Re: Mega Man X2 & X3 Wireframe Model Editor
Post by: Reld on February 05, 2020, 03:49:30 pm
I clicked "import from rom" and opened the mmx2 rom just cause i was curious, but yea nothing happened. But...it did for some reason save to the ROM, i never clicked "write to rom" or anything. I double-checked in emulator, and nothing was overwritten or corruped at the title screen luckily.

I'm an idiot. I accidentally set it up so the import part of the file menu activated both the importing from AND writing to the ROM. If you use the little button that shows an arrow pointing from a cartridge to a piece of paper it should work. I didn't notice because I always use the button.

Edit: I should also mention that importing from the ROM might not work if the title screen X model has already been altered. I had a misconception about how the game read the data when I set up the importing, and I forgot to fix it. Basically if the new model has fewer vertices than the original model the progam won't know where to look for the vector data. I've already fixed this on my end and it should work whenever I upload a new version.