kion
Arukoitan
@kion_dgl
Posts: 193
|
Post by kion on Feb 27, 2019 14:13:49 GMT -5
To make things easier to manage, I might as well put this in its own thread, I made a new tool for Megaman Legends 1 that includes some bug fixes and new features.
Instructions: Click on the "Open Files" icon on the header. Navigate to the CDDATA/DAT directory on the Megaman Legends 1 game disk, select all of the files and click "open".
Changes: - Textures are not combined into a single texture, instead giving each pallet/image combination its own texture - Textures are now all fixed at 256x256 pixels in size - Significant improvements to the way bones are parsed and implemented - Added a settings menu, the download format (.glb, or .gltf) can be selected from the menu - Added a level of detail selection from the Settings menu - Added the option to view non-character models from the menu - Added the option to control animations with play, pause, stop, and playback speed can be adjusted
Issues - The way the game uses textures is when the game loads in a texture it has an image position in the framebuffer where the image is stored in GPU memory. When the model draws a polygon, it will define a page index, which is a 256x256 area inside the GPU. When i made my previous tools, I didn't know how to match models to their textures, so I ended up creating a lookup table where I linked a lot of the images manually. Now I have a slightly better idea of how these work, but there are still a few issues. Mostly with Data the Monkey, as he's the weirdest. His image and pallet are in completely different files, but aside from that the files that the game loads in for each stage should be pretty set. For any given stage you should have the TIM files from the loaded scenario file, the stage file, and a few standard files the game always has loaded. That being said texture matching on the pSX is still pretty ugly, but a "best attempt" to locate textures for models that don't have their textures manually linked in funcationality that could be beneficial.
- Textures are flipped in the horizontally. Since I'm not combining textures, I could try to figure out if there is a fix for this.
- Reported by Xinus: Some of the animations are missing frames. This has to do with the way the game stores animations. There are animation keyframes, and then there are animation tracks which define which keyframe to use at one time. Since the tracks in Megaman Legends 1 are mostly in order I tried to be lazy and simply read the key frames in order. This generally seems to work, but it could be better, so I'll try and see what aspects of my mml2 code can be ported over (for laziness).
- Hidden items. I managed to fix the way bones and polygons are implemented and parsed, which is something I should make a short video about, because it's pretty weird. The funny thing is that there are actually more models, such as Items the characters are holding stored inside the model. Right now the parsing of these is skipped completely. Parsing these is easy enough, the hard part is figuring out how to display them in a manner than doesn't look horrible, and figure out which mesh it is that needs to be exported.
- Collada .dae format has been dropped. Threejs has changed the way they store models (from geometry to buffer geometry), and I was using geometry previously in the .dae export and the collada format is too convoluted to try to continue to maintain. You can convert to other file format types by hopping around. Noesis supports .gltf import as of version 4.39, and I managed to import into blender using this plugin.
|
|
|
Post by uradamus on Mar 29, 2019 17:49:06 GMT -5
This is looking good. BTW, Blender 2.8 comes with a glb/gltf importer that's enabled out of the box now, haven't had a chance to play around with it yet, but I'll try some models out this evening.
I was messing around with the Stages version of this as well, to take a look at some of the level tiles. Overall I'm liking what I'm seeing so far. One little area that could definitely do with a bit of improvement though would be an option to hover over the Pallet and Image fields and allow directly scrolling through the selected options with just a flick of the mouse wheel. It is really tedious to open the drop down and choose a new option every single try. Which is made worse by the lack of highlighting and the fact that the list repositions itself after nearly every selection which combined makes it really hard to tell what the last choice was. I think it tends to be the bottom visible entry if it was far enough down the list to allow the scrolling to position it there, but it's definitely painful to navigate as is right now. But certainly better than nothing, so thanks for your efforts so far!
EDIT: Just discovered if you click on one of those file drop down fields to focus on them, you can then use the keyboard arrow keys to sequentially swap them out. One thing I am finding though is that it seems like there are a number of problems with the palette choices though. In some cases the right option seems completely missing, I find the right texture, but not a single palette is a proper match for it. This seems to be really common with the refactor chamber in the cutscene at the very start of the demo dungeon. I've made it a point to pull out some reference videos, basically compilations of the game cutscenes to compare and I know I'm getting the right textures, but none of the palettes are a match, so there is definitely something going wrong there.
|
|
|
Post by uradamus on Mar 29, 2019 21:32:04 GMT -5
Ok did some testing in both 2.79 and 2.8, both with the official and unofficial addons.
It seems that the exporter does a poor job of things when it comes to objects with more than one part. It basically just reuses the first mesh over and over again for each subsequent part of the model, but does give those copies the texture their actual mesh should have gotten. An example of this is the megaman player model, all the parts are using the chest shape, but some are using the body texture while others are using the face one. Similarly the Roll (Cutscene) models get two copies of the body mesh, but one has the body texture and the other one gets the face texture. I also tried importing a few of stage tiles, again, only the first meshes data got used for all parts, each getting their specified texture. I was trying out ST00_001 and it only brought in the first of 3 meshes, the one for the floor and little decorative obelisk thing, but the walls and the stairs meshes just got duplicates of the floor mesh with their textures applied to their copies of it.
I also think I know what's going wrong with the palette issue I saw above, I have a feeling it's likely due to the horizontally flipped textures or at least that's my gut feeling on it, don't really have anything to back that up.
|
|
kion
Arukoitan
@kion_dgl
Posts: 193
|
Post by kion on Mar 29, 2019 23:08:35 GMT -5
EDIT: Just discovered if you click on one of those file drop down fields to focus on them, you can then use the keyboard arrow keys to sequentially swap them out. One thing I am finding though is that it seems like there are a number of problems with the palette choices though. In some cases the right option seems completely missing, I find the right texture, but not a single palette is a proper match for it. This seems to be really common with the refactor chamber in the cutscene at the very start of the demo dungeon. I've made it a point to pull out some reference videos, basically compilations of the game cutscenes to compare and I know I'm getting the right textures, but none of the palettes are a match, so there is definitely something going wrong there. For this, it's an issue with trying to guess which pallets and textures the game has loaded in, so I attempt to loop through all of them. Though as you pointed out, even looping through all of them doesn't even manage to find the right pallet a lot of times. The easiest option would be to be able to dump the game's memory. If I were able to read the 2MB of CPU memory and 1MB of GPU memory i would have a specific state for what pallets and textures are loaded into the scene at any given time. Barring that I need to create a look up table for which textures need to be loaded in for which files. It seems that the exporter does a poor job of things when it comes to objects with more than one part. It basically just reuses the first mesh over and over again for each subsequent part of the model, but does give those copies the texture their actual mesh should have gotten. An example of this is the megaman player model, all the parts are using the chest shape, but some are using the body texture while others are using the face one. Similarly the Roll (Cutscene) models get two copies of the body mesh, but one has the body texture and the other one gets the face texture. I also tried importing a few of stage tiles, again, only the first meshes data got used for all parts, each getting their specified texture. I was trying out ST00_001 and it only brought in the first of 3 meshes, the one for the floor and little decorative obelisk thing, but the walls and the stairs meshes just got duplicates of the floor mesh with their textures applied to their copies of it. I've spent a few months trying to write models as .dae and models as .gltf. The conclusion I came up with is that the file format is too complicated to reasonably support. And given that all these people and organizations have been working on the standard and support is still terrible, I think my assessment might be somewhat accurate. So the approach I've decided on is to make a simple model format that doesn't support donkey balls and support that: Dash Model Format. So far I have a Threejs exporter/importer that works. And I'm working on imports for Noesis and Blender at the moment. If gltf ever get's their shit together and figures out how to support their needlessly-convoluted standard, then great. Either way, I'd like to have a format where when someone comes up to me and says, "hey kion, shit's broken", then I can actually look at the file and try to debug what's going on, rather than shrugging my shoulders and saying, "hopefully someone fixes that eventually". I also think I know what's going wrong with the palette issue I saw above, I have a feeling it's likely due to the horizontally flipped textures or at least that's my gut feeling on it, don't really have anything to back that up. As far as I can tell, this seems to be intentional. When exporting the characters and entities, a lot of the text was backwards. With the stages, it's the same all of the text is flipped. I tried to fix this by flipping the textures, but that generally broke everything. If you take the exported image and flip it horizontally, then the output matches the game. So I have a suspicion that the original programmers flipped the output Twilight Princess style for some reason.
|
|
|
Post by uradamus on Mar 30, 2019 2:47:18 GMT -5
Looking at things some more, it seems that the flipped textures are using the right UV space in pretty much every instance I can see, so I'm starting to think maybe the UVs are being read backwards maybe, causing the normals to be facing the wrong way perhaps. But if that were the case, it wouldn't make sense that the exported files have the normals facing the right way. Kinda frying my brain a bit trying to think through this problem, lol. EDIT: It is a shame that Khronos hasn't learned there lessons from their Collada debacle, by the sounds of it. I was hoping they would have got gltf right this time around. Oh well, guess expecting big committees to ever get anything right is far too much to ask, heh. Seems like doing your own thing would make a lot of sense with something like this. Will DMF support basic skeletons/animation? Oh, btw, did you ever get a chance to take a look at that project I linked to you a while back? kaitai.io/ I still haven't got around to doing anything serious with it, but it looks to have a ton of potential for aiding in the sort of undertakings you seem to take on so often around here, heh.
|
|