Author Topic: Model Importer Version 2  (Read 4386 times)

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Model Importer Version 2
« on: August 03, 2016, 12:39:08 pm »
Some of the early discussion can be found here if you are interested:https://www.chronocompendium.com/Forums/index.php?topic=6788.0

The new importer is based on Luminaire's old work, however, it now focuses on importing animations. The script is stilling using blender 2.49 APIs, so whoever use it need to get that version. I'm planning to port it on new blender, but for now it only works in 2.4x.

How to use?

1. Get a blender 2.49b from here: http://download.blender.org/release/

2. Download import_ccmodel2.py

3. Put the script in blender's script folder (on windows, it should be in .blender\scripts under your blender installation directory).

4. Get the model rips from here. Extract them in a folder.

5. Edit import_ccmodel2.py:

   ** Find line 2740, edit the directory to match where you extract the models, there should be a "Battle Models" folder, that is your destination. On windows you should replace use \\ instead of \
   ** Find line 2745, the value can be either 'battle_model', 'room_model', 'room_anim' or 'tech_anim', the paths to the models and animations are defined in several tables(chars, rchars, ranim, techs). I will explain later.
   ** Line 2746 is the index to the battle model or tech animation. For example, if you want to import Serge's model with standard and attack animations, change the value to 0. If you want to import Serge's Luminaire animation, you need to change line 2745 to 'tech_anim', then change line 2746 to 180.

6. When you are done editing the script, run it from the menu: file-->Import-->Chrono Cross Model V2, and wait for blender to finish.

7. Find and reopen the output file in blender. For battle models, the .blend files should be saved in your "Battle Models" folder, for tech animations, the files are in "Battle Models\techanim". It is important to "force" blender to refresh by reopen the file.
  Now you can preview the animations by pressing the right arrow key on your keyboard.



Character Table format:

i -- Index, it has no use but making it easy to find things
m -- model file path. It is relative to your "Battle Models" folder, the script will add the file extension ".mdl" for you.
w -- weapon model path. Check "Battle Models\weapons" to find the files. Again, the script will add ".mdl" for you so leave it alone. If you don't fill this value, "dummy" will be used, it is for those with no visible weapons.
d -- Can be 0 or 1. If it is 1, the character will wield two weapons. For now, only glenn2 has this.
a -- Alternate texture suffix. For example, by default Serge.mdl will use Serge.png for its texture, but if you add 'a':'2' to the table, the script will use Serge2.png instead. This is used when you want to edit the texture manually but don't want to overwrite the original one, for example, Harle use HaleA.png instead, because of the transparent pants.
p -- prefix to the model object to be created. Useful when you want to import two models into the same .blend file.

Tech Animation Table format:

i -- same as above
c -- character index, see above, basically, it is the i value from the character table.
w -- weapon, if you want to override the model's weapon. For example, Viper does not hold his weapon when using Flag Bearer tech.
t -- tech animation path, check "Battle Models\techanim". Those are usually ripped from battle field drps. This time the script will not add file extensions for you.
p -- same as above
d -- same as above
am -- Import the model instead. Usually this is used to load a model inside a tech drp, for example, Starky's robot. If am is set, t can be a fake path just to save the output file.




How to fix the meshes?

Well, the importer will leaves unused vertices. They are not visible but if you want your models to be clean, you can delete them manually.

It is pretty easy to do:
1. Switch to edit mode
2. Right click or open the Select menu, click Non-Triangles/Quads (hot key: ctrl+alt+shift+5).
3. Press delete key, then click vertex
« Last Edit: September 24, 2016, 03:27:57 am by utunnels »

ZeaLitY

  • Entity
  • End of Timer (+10000)
  • *
  • Posts: 10795
  • Spring Breeze Dancin'
    • View Profile
    • My Compendium Staff Profile
Re: Model Importer Version 2
« Reply #1 on: August 03, 2016, 08:04:45 pm »
Aha, beautiful.

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2127
  • 7th Elemental Innate, and vtuber
    • View Profile
Re: Model Importer Version 2
« Reply #2 on: August 03, 2016, 11:23:26 pm »
Reminds me... I need to get around to making that CC model importer extension for OpenAssimp.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #3 on: August 06, 2016, 12:00:57 am »
https://drive.google.com/open?id=0B5GvuiubpnUZZkVpZHctTE5OUVk

I also ripped the room models(files are named using TOC index so I can merge the two discs and remove duplicates). But I don't have time to sort them out currently.
If we remove those duplicate files there are about 500 mdl files. There should be some junks (files with a mdl like header but are not mdl), also there are duplicate models with different textures (for example, those octo/squid creatures with different colors).
Also the same character may have different models. And there are scattered animation and mesh files to be found.

Anyway, make a backup on google drive just in case.
« Last Edit: August 10, 2016, 06:05:59 am by utunnels »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Model Importer Version 2
« Reply #4 on: August 06, 2016, 04:48:12 pm »
Wow, thanks utunnels!

From Blender, is there an easy way to export to common model formats like .OBJ or .MD5? I ask this for the benefit of others; I never did learn much about modeling programs, and yet it would still be great if someone could eventually convert these and submit them to The Model Resource one day.

alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Model Importer Version 2
« Reply #5 on: August 06, 2016, 09:13:27 pm »
Blender can export a lot of different formats, OBJ included. It's possible that some information may be dropped during the export, though. I can't test it myself because I've got the wrong version of Blender for utunnels' plugin.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #6 on: August 06, 2016, 09:46:45 pm »
Yeah, blender has a script that exports obj format. I only tried it briefly. The result seems OK, though the texture is not perfectly exported, and maybe not vertex normals. This may cause problems when displaying characters like Acacia Pvt or Greco who have double faced clothes.
I'm not good at modeling either, so maybe for now keep them in blend format is a safer option.

« Last Edit: August 06, 2016, 10:19:20 pm by utunnels »

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #7 on: August 07, 2016, 10:29:26 pm »
I noticed the young Karsh model in his reminiscence scene does not have a weapon.
That doesn't make sense since Glenn and Dario both have a training sword in their model.

Perhaps the game uses the axe model in Karsh's weapon pack to save some space?


Well I see, the reminiscence scene is in another room file. There are some extra junks in the regular room. I wonder if they just copied the data and only deleted junks when they ran out of space.
« Last Edit: August 08, 2016, 12:21:27 am by utunnels »

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #8 on: August 09, 2016, 05:57:41 am »
Still working on identifying the room models.

Found some interesting things.

1. The elevator chamber in Fort Dragonia is a 3D model. I wonder why some emulator video plugin is glitched here.
2. Many tiny objects are models, though I thought they could be easily done with a couple of sprites...I suspect some of them are done for sake of clipping difficulty. For example, the cage in Luccia's room.
3. Some tim files in rgfx package are lzss compressed.
4. The magical dreamers show is a 3D scene unlike the battle field, it is assembled by a couple of full models instead of usual meshes.
« Last Edit: August 09, 2016, 06:01:01 am by utunnels »

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #9 on: August 10, 2016, 06:26:52 am »
https://drive.google.com/open?id=0B5GvuiubpnUZQmF6Rklhcy1iZkk


These are the .blend files I have so far.
You should be able to load them in new blender.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #10 on: August 13, 2016, 11:08:09 am »
To answer Faust's question, I tried blender 2.77 today.
For some reason, it couldn't import the dae files exported by itself correctly.
 :picardno

Although, I tried the dae loader of three.js, the models were loaded without a problem after a few hacking of the dae file. The animations were still ignored.


So at least we can have something like this: http://falloutfan.com/fallout-3/


Also, thee.js has a blender plugin that exports blender objects in json format. It works perfectly, with all bones and animations.



« Last Edit: August 15, 2016, 12:44:54 am by utunnels »

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2127
  • 7th Elemental Innate, and vtuber
    • View Profile
Re: Model Importer Version 2
« Reply #11 on: August 14, 2016, 01:55:06 am »
Animations? So, as it is, 2.49 can import the rigs and animations?

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #12 on: August 14, 2016, 03:59:17 am »
Yes, more or less.

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2127
  • 7th Elemental Innate, and vtuber
    • View Profile
Re: Model Importer Version 2
« Reply #13 on: August 15, 2016, 07:01:01 am »
o_o iiiiiiinterestiiiiiiiing.........

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Model Importer Version 2
« Reply #14 on: August 26, 2016, 12:17:36 am »
Bug fix (link edited).

It seems blender changes face order sometimes, the old code to apply material index to a face was not safe. For some reason, so far only the green dragon has notable side effect.