Author Topic: 3D Crono Cross model extraction?  (Read 12368 times)

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #60 on: November 01, 2007, 11:03:24 pm »
Just a thought. Anyone know of a PS2 emulator written in DirectX or OpenGL? I assume a PS2 emulator would play PS1 games, and possibly provide us with another avenue of ripping the models in-game using one of the ripping utilities we've tried previously on PS1 emus without success.

yartrebo

  • Iokan (+1)
  • *
  • Posts: 2
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #61 on: November 02, 2007, 02:30:11 pm »
I was able to successfully rip Chrono Cross models (along with models from almost any PS1 game) some years ago. The key is to record the texture information, the projected polygons, AND the projection.

You get the projection by keeping close tabs on the project opcode in the PS1's vector processing unit (naturally requiring hacking an emulator).

It appears that you already know how to get the projected polygons. It's from the PS1's graphics processing unit.

The texture information can be dumped from the PS1's vram. The palette information is in there too.

I implemented it by adding dumping code (fprintf(...)) to adriPSX in those three spots to dump the raw information, then I wrote a program to use the projection information to to a reverse projection (take the projected 2-D polygon and find out the original 3-D polygon) and outputs the model in my own 3D format.

The model will be in whatever shape it was when you took the snapshot. This can be fixed by hand in a modelling program or, with some skeletal animation systems, such as the one I wrote for the game that used the ripped 3d models, it just doesn't matter.

The code is buggy and it outputs if a my own own rather limited format (triangles only, fixed point notation, not expandable at all), so I doubt it will be of use, but I don't mind giving guidance and I might very well write some better code should I find the motivation to do so.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #62 on: November 02, 2007, 08:29:37 pm »
 :lee: YARTREBO!! THANK YOU FOR SHOWING UP!!  :lee:

Yes, the Compendium has been aware of your work and one of our ultimate goals was to replicate your success with model ripping, so your appearance is a major boon to the Chrono Community.

So far we've only had luck with textures, and that was accomplished through the heavy-handed means of ripping straight from the CD image. I was hoping programs like 3D Ripper DX would capture the projected polygons, but alas, we have had no such luck. At best, the programs we've tried out just give us 2D data from VRAM as far as I know.

So really, we are still in the very beginning stages of the model capturing process, and you're unquestionably lightyears ahead of us in this area.

Now some questions for you, if you don't mind:

1.) Is the dumping code (fprint(...)) written in C/C++? Could it be inserted into any emulator, you think, or is there something about AdriPSX that makes such hacking easier? I assume we'd need the emulator source code, then we'd have to compile the code after making the necessary additions? I'm totally clueless when it comes to coding, but many members of the Community would be able to work with any documentation on the process you could provide.

2.) How much knowledge have you acquired regarding the native model formats stored on the Chrono Cross CDs? We have some file dumps from the game iso that we suspect contain models, but we're not sure yet. At least I'm not. I could provide samples if you're interested in taking a look at them.

Any knowledge or utilities you can share with us would be ABSOLUTELY appreciated, yartrebo.

EDIT: For everyone interested, I'm linking to the most complete list of PSX emulators I've found to date. PCSX has open source code available as Luminaire and jono have pointed out already I think, and AdriPSX source should be available elsewhere.

http://www.aldostools.com/psxemus.html
« Last Edit: November 03, 2007, 02:57:35 pm by FaustWolf »

yartrebo

  • Iokan (+1)
  • *
  • Posts: 2
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #63 on: November 04, 2007, 01:33:25 pm »
 - Is the dumping code (fprint(...)) written in C/C++?
It is in C. The language you use is dictated by the language of the emulator, which is C or C++ in most cases.

 - Could it be inserted into any emulator, you think, or is there something about AdriPSX that makes such hacking easier?
I was able to compile AdriPSX for my computer. I wasn't able to get other emulators to compile, or they were closed source. Nothing intrinsically easier about that emulator, and the source code is actually very messy. I have also managed to get dumps from PCSX, so that emulator will work also.

 - I assume we'd need the emulator source code, then we'd have to compile the code after making the necessary additions?
That is correct. If the emulator uses plugins, then you need the code for the main emulator as well as the GPU plugin.

 - How much knowledge have you acquired regarding the native model formats stored on the Chrono Cross CDs?
I have no knowledge of the format.

As far as any other information, I would recommend reading up on the PS1 architecture, particularly the vector processing unit and the GPU. There are special operations for projection and drawing polygons. That both of these operations are hardware accelerated is what makes my process feasible. Find those parts in the emulator software, and start poking around (dumping information, running it through a debugger, etc).

If you're particularly ambitious, you can try tracing the game to find where it gets the models from on the disc and how it interprets them. This would be far harder than what I did, but I have little experience in assembly programming and an experienced person should be able to succeed.

Good luck, and if you want any more information, feel free to ask.

I plan to post some source code once I can find it (I did this many years ago) and clean it up.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #64 on: November 04, 2007, 01:55:34 pm »
Thanks Yartrebo!  If we could just get the fprint function you used and the lines it needs to be on in the PCSX and/or AdriPSX source code, that would be awesome.

I imagine we could simply cut & paste whatever code you could provide into the emulator source code and we'd be good to go as far as dumping is concerned.
« Last Edit: November 04, 2007, 02:03:05 pm by FaustWolf »

halkun

  • Architect of Kajar
  • Earthbound (+15)
  • *
  • Posts: 50
  • Ayumi Hamasaki Fanboy
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #65 on: November 08, 2007, 02:37:42 am »
You guys are kind of barking up the wrong tree.

I'm guessing you are trying to capture the 3d data using that program that captures OpenGL and makes then into 3D scenes.

The problem is that when the PSX GPU gets the triangle data, (Both in emulators and in the real thing), the GTE has already taken care of the polygon rotation and z-sorting, so all the GPU does is draw the triangle on the flat framebuffer. This is why your models are all coming out flat. All the OpenGL plugins do is accelerate the flat 2D drawing on the framebuffer as the 3D math was taken care of internally.

You best bet is actually getting the raw poly data from the model in the CD. It's a lot less painless.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #66 on: November 08, 2007, 02:52:35 am »
Yeah, the OpenGL and DirectX 9.0 rippers have been useless precisely for that reason. Though yartrebo has had a fair amount of success by getting the AdriPSX emulator GPU to dump the data it's working with via inserting an fprint function into the sourcecode. Then he converted the GPU's output back into the original 3D model through reverse projection, it seems. Only problem is that it only allows capturing one pose at a time, so it doesn't seem to capture animation data.


halkun

  • Architect of Kajar
  • Earthbound (+15)
  • *
  • Posts: 50
  • Ayumi Hamasaki Fanboy
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #67 on: November 08, 2007, 04:16:01 am »
Your best bet is to get the pieces from the CD and place them in a proper hierarchy. Bone/joint angle information is going to be lost as it's precalculated before the GTE projection. You are only going to have vertex movements (morphs). The data you are getting will be good for maybe a 3D print, but wildly inefficient for anything else.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #68 on: November 08, 2007, 03:14:42 pm »
Hmmm...I suppose yartrebo's method would be great for capturing battlefield models, though. No animation associated with those, right? Just a static 3D environment.

halkun

  • Architect of Kajar
  • Earthbound (+15)
  • *
  • Posts: 50
  • Ayumi Hamasaki Fanboy
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #69 on: November 08, 2007, 09:49:50 pm »
Those are probably the easiest to find too ^_^

Cyberman

  • Architect of Kajar
  • Earthbound (+15)
  • *
  • Posts: 44
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #70 on: November 09, 2007, 01:00:03 am »
The source code to PCSX is still around. Go and abuse it? :D

Actually it would be interesting to attack the GTE and pick off the information passed to that and that passed on to the GPU.  I've always wanted to do 'deep' playing with PCSX (by that I mean emulate the GTE and GPU pairing together).

Anyhow I digress. PCSX is available although it would have a fairly sizable learning curve to modify.

Cyb

Akari

  • Iokan (+1)
  • *
  • Posts: 11
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #71 on: November 09, 2007, 10:03:17 am »
The source code to PCSX is still around. Go and abuse it? :D

Actually it would be interesting to attack the GTE and pick off the information passed to that and that passed on to the GPU.  I've always wanted to do 'deep' playing with PCSX (by that I mean emulate the GTE and GPU pairing together).

Anyhow I digress. PCSX is available although it would have a fairly sizable learning curve to modify.

Cyb

There is good debugger wrote by Agemo. I use it for all my reversing. It is modified PCSX.
http://www.enixfans.com/html/agemo/

Cyberman

  • Architect of Kajar
  • Earthbound (+15)
  • *
  • Posts: 44
    • View Profile
Re: 3D Crono Cross model extraction?
« Reply #72 on: November 09, 2007, 06:36:43 pm »
Would be great if the site wasn't "service" unavailable for all the links :)

I'll try later I guess. I can't find the debugger version Pixel made of PCSX I made a nice UI for that.

Cyb