Author Topic: Can someone help me custom-loading .P files?  (Read 5471 times)

nfitc1

  • *
  • Posts: 3008
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Can someone help me custom-loading .P files?
« on: 2009-07-08 17:03:33 »
I've managed to make a program similar to kimera that can at least open the .P files contained in an LGP archive without separating the LGP archive into separate files. I've tinkered with this for several hours and I'm finally happy with most of it. The only problem is that some of the meshes don't display correctly. I can get most of them working, like Cloud's, Barret's, Tifa's heads, but some of them, notably Hojo's head and Cloud's Ultima Weapon, have triangles going in wrong directions.

What I'm doing is indexing the vertexes then using those to generate the polygons with the colors as well. I'm ignoring normals, edges, and groups for now as I'm not sure what to do what them. I'm pretty sure the problem is with groups, but I don't know what to do with them. I'm also going to want to know what to do with textures, but one thing at a time.

Borde

  • *
  • Posts: 891
    • View Profile
Re: Can someone help me custom-loading .P files?
« Reply #1 on: 2009-07-08 17:09:52 »
Hello NFITC1.

Ufortunately you CAN'T ignore groups. The vertex indices (and some other data) are relative to the group base. That's why any multi-group meshes will look screwed. You can take a look at Kimera's source code if you feel confused (yeah, probably not the best advice...).

Good luck.

nfitc1

  • *
  • Posts: 3008
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Can someone help me custom-loading .P files?
« Reply #2 on: 2009-07-08 17:16:21 »
Hello NFITC1.

Ufortunately you CAN'T ignore groups. The vertex indices (and some other data) are relative to the group base. That's why any multi-group meshes will look screwed. You can take a look at Kimera's source code if you feel confused (yeah, probably not the best advice...).

Good luck.

Borde, awesome. I'll try that out.

BTW: Would you consider letting me re-write kimera in .NET that will use DirectX instead of OpenGL and work a little differently?

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Can someone help me custom-loading .P files?
« Reply #3 on: 2009-07-08 17:35:07 »
If you're going to rewrite it, for the love of god, don't do it in VB. (No offense Borde, I'm sure you had your reasons)

Then you may find that other programmers will be more willing to help and contribute to the code. Assuming you'll keep the source open, of course.

nfitc1

  • *
  • Posts: 3008
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Can someone help me custom-loading .P files?
« Reply #4 on: 2009-07-08 18:22:09 »
If you're going to rewrite it, for the love of god, don't do it in VB. (No offense Borde, I'm sure you had your reasons)

Then you may find that other programmers will be more willing to help and contribute to the code. Assuming you'll keep the source open, of course.

Heh. I didn't expect someone would be so violently opposed to it. Oh well, VC++ is only slightly more complicated than VB so I'll give that a go.


Borne, I just tried offsetting it by that group index and it made the ones that aren't working look good again....Ahhh, that Ultimate Weapon looks pretty sleek in hi-res and zoomed in. :) Well, as sleek as it can, anyway.
Thanks for the help.

Borde

  • *
  • Posts: 891
    • View Profile
Re: Can someone help me custom-loading .P files?
« Reply #5 on: 2009-07-08 18:58:03 »
Well Aali, you won't have to convince me about the absurdity of VB. Truth is Kimera was never suposed to get this big. I just started doing something small that would let me do minor editing (resizing and changing colors, basically). So I began writting it on VB6 because it's very easy to produce simple standard windows interfaces with it. Then I began adding things here and there and VB6 started to look seriously unfit for the job (reading battle animations was specially problematic). But it was already too big and rewritting it on C++ looked too time-consuming. Keep in mind that I was working on the NPC RP back then and remodeling was way funnier than programming, so I didn't want to waste all my time coding. And that summarizes how Kimera ended up being the way it is now...

Nice to see you got around those groups issues NFITC1. As for your plans about rewritting Kimera, go on, you can use it's code as you wish. I'd be glad if you stated it somewhere if you do so. I spent quiet a few hours writting it. Anyway, good luck.
« Last Edit: 2009-07-08 19:04:41 by Borde »

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Can someone help me custom-loading .P files?
« Reply #6 on: 2009-07-08 19:24:53 »
Now now, I wouldn't call myself "violently opposed" to VB :-P

It is great for tooling up simple GUI apps, but when you want to adapt a VB app to an existing system that wasn't written with VB in mind, you end up jumping through hoops just to get it to do what you want.

FF7 data files and formats were certainly not meant to be VB-friendly, they were supposed to be fast and memory efficient on the PSX.

nfitc1

  • *
  • Posts: 3008
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Can someone help me custom-loading .P files?
« Reply #7 on: 2009-07-08 19:29:06 »
But with .NET it's not that hard in VB. WM and PrC are written entirely in VB.NET. VB6, however. Yes, that's extremely limited and simply not up to the task of anything. It's got some good power now.

I'm now having trouble pointing to the beginning of each group. It works fine for most models in magic.lgp, but doesn't work in many of the char.lgp models. What's the deal with the "Hundreds" section that is between the Unknown sections and the actual group data? How large is it?

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Can someone help me custom-loading .P files?
« Reply #8 on: 2009-07-08 19:43:20 »
It's NumHundreds * 100 (guess why it's called a hundred!) :-P

If you know python you could have a look at my rsd importer for blender. It's very ugly (since I am not well versed in python, it is infact the only thing I have ever written in python) and only does triangles and their vertex colors but maybe you can extract some of the concepts I used.

nfitc1

  • *
  • Posts: 3008
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Can someone help me custom-loading .P files?
« Reply #9 on: 2009-07-08 20:17:48 »
Very nice. thanks Aali! Now all that's left is the textures and the hrcs (which is most of the work :) ).

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Can someone help me custom-loading .P files?
« Reply #10 on: 2009-07-08 20:30:24 »
Yes.. I am not hopeful about that project. I had never used python or blender before that. If anything comes out of it, it will be a hackjob at best.

Anyway, here's the file, maybe it will help in some way; http://backup.ninjaloot.se/share/import_rsd.py