C3 Model

05/22/2013 22:38 urgabel#1
As I see there is some interest in this subject, I will post here the code I programmed some time ago. I'm still learning, but when I wrote this code I was more noob, so don't expect very good code. Anyway, maybe somebody could find interesting info inside.
If anybody wants further explanations, please do not hesitate to ask.
Oh, and I would love to join a team if you will work on this.

I studied C3 files, and found all composed by different types of parts:

I have found the following combination of parts:

C3 Files have the following structure:
16 bytes C3File = "MAXFILE C3 00001"
1 or more parts:
Variable bytes C3Part

Every C3Part have a defined structure depending on C3PartType.

To read a C3 file:
Read the C3File magic (16 bytes)
Read Every part

To read a C3Part:
Read C3PartType (4 bytes)
Read C3PartLength (UInt32). This lenght does not include the already read 8 bytes.
Read or skip this part.
Continue to next part, if any...

When I wrote code to handle this files, I was still in first stages of my programming learning, but I think you will find some useful info.
05/22/2013 23:49 pro4never#2
Appreciate this. I'll have to take a look through it later.

Just took a quick look at the code. Ooh lord this will be fun to convert lol... Hopefully my old model viewer will be easy enough to convert. XNA + runtime generated models is a pain. Someday I'll have to learn more about writing content pipeline crap so things actually work properly with it :P
05/23/2013 00:03 InfamousNoone#3
Someone actually interested in learning! Welcome aboard.
05/23/2013 01:40 Ultimation#4
Check [Only registered and activated users can see links. Click Here To Register...] for more information.
05/23/2013 20:23 urgabel#5
I was reviewing my own code and noticed Particle.cs was not done (almost empty). I cannot find my notes about Particle, but I did a small research and here is the result. It has been written in notepad++, so maybe there are some mistakes. At the moment, it only support the main PTCL format, not yet the PTCX or PTC3.

EDIT: Deciphered PTCX format. Now investigating PTC3 format. I will update this when done.


Particles PTCL parts are composed by:
-------------------------------
Name (text lenght + 4 bytes)
TextureName (text length + 4 bytes)
Row (4 bytes)
ParticlesCount (4 bytes)
FramesCount (4 bytes)
Frames (Variable size, as follow)
PTCL Frame:
---------------
count (4 bytes)
pos (count * 3 * 4 bytes)
age (count * 4 bytes)
size (count * 4 bytes)
matrix (4 * 4 * 4 bytes)


Particles PTCX parts are composed by:
-------------------------------
Name (text lenght + 4 bytes)
TextureName (text length + 4 bytes)
Row (4 bytes)
ParticlesCount (4 bytes)
FramesCount (4 bytes)
Frames (Variable size, as follow)
PTCX Frame:
---------------
count (4 bytes)
iB (count * 2 bytes)
pos (count * 3 * 4 bytes)
age (count * 4 bytes)
size (count * 4 bytes)
matrix (4 * 4 * 4 bytes)


Particles PTC3 parts are composed by:
-------------------------------
Name (text lenght + 4 bytes)
TextureName (text length + 4 bytes)
Row (4 bytes)
UndefinedYet (50 bytes)
ParticlesCount (4 bytes)
FramesCount (4 bytes)
Frames (Variable size, as follow)
PTC3 Frame (same as PTCX):
---------------
count (4 bytes)
iB (count * 2 bytes)
pos (count * 3 * 4 bytes)
age (count * 4 bytes)
size (count * 4 bytes)
matrix (4 * 4 * 4 bytes)


For UndefinedYet I can guess some of the value types:
1 short (2 bytes)
5 floats * 4 bytes = 20 bytes
1 unknown (0) * 4 bytes = 4 bytes
1 color (FFFFFFFF) * 4 bytes = 4 bytes
5 floats * 4 bytes = 20 bytes
05/26/2013 22:20 2slam#6
1 min please , what should that helpful for? could i create a garment with a c3 model? is that has a relation with designing? could i create a motion in my c3 or what ?
05/26/2013 22:50 CptSky#7
Quote:
Originally Posted by 2slam View Post
1 min please , what should that helpful for? could i create a garment with a c3 model? is that has a relation with designing? could i create a motion in my c3 or what ?
Well, with the C3 format. You can do a 3D model converter (to C3) and/or a plug-in for whatever 3D modeler app you use.
05/26/2013 23:38 2slam#8
Quote:
Originally Posted by CptSky View Post
Well, with the C3 format. You can do a 3D model converter (to C3) and/or a plug-in for whatever 3D modeler app you use.
u mean if so creating a model in 3ds as an example simply convert it to a C3 with its fully motion and so? or making TQ's unique plugin for such things? there is a program around here called biturn which convert C3 to 3ds and other models even though 3Dmax has a plugin to export the file a s a c3 but the problem is how to apply motion on files ( say i've created an armor in 3dmax while exporting it to C3 and applying it in game i get if i wear a sculpture or a monument seems that the character is upside down feels like it doesn't obey the motion files in C3/0003/xxx for C3 motion files in there ), hope i get some help here.
05/26/2013 23:42 pro4never#9
Quote:
Originally Posted by 2slam View Post
u mean if so creating a model in 3ds as an example simply convert it to a C3 with its fully motion and so? or making TQ's unique plugin for such things? there is a program around here called biturn which convert C3 to 3ds and other models even though 3Dmax has a plugin to export the file a s a c3 but the problem is how to apply motion on files ( say i've created an armor in 3dmax while exporting it to C3 and applying it in game i get if i wear a sculpture or a monument seems that the character is upside down feels like it doesn't obey the motion files in C3/0003/xxx for C3 motion files in there ), hope i get some help here.


If used properly this code allows for ANY sort of conversion.


Possible uses of this code.


-Custom plugin for any and all modeling programs (3dsmax, maya, blender, etc) with full support for conquer files including custom animations
-Model viewer to preview items, characters and spells from outside the client
-Custom client from scratch using conquer (and all tq) art assets.


Here's a very basic model viewer I whipped up using this code while at work. It's nothing fancy and I didn't bother adding texturing but it all works nicely.
05/27/2013 01:15 2slam#10
Quote:
Originally Posted by pro4never View Post
If used properly this code allows for ANY sort of conversion.


Possible uses of this code.


-Custom plugin for any and all modeling programs (3dsmax, maya, blender, etc) with full support for conquer files including custom animations
-Model viewer to preview items, characters and spells from outside the client
-Custom client from scratch using conquer (and all tq) art assets.


Here's a very basic model viewer I whipped up using this code while at work. It's nothing fancy and I didn't bother adding texturing but it all works nicely.
hell yea , my only problem in designing is that i cant extract a monster with a c3 motion files smth like dat in mount/821/821000.c3 is the original model while other c3es are for motion , if sm1 could create such a plugin then you gotta got a new game even more better graphic with more boxes and polygons.