Join also our Discord channel! Click here.

Cryengine Converter tool (cgf-exporter)

General game file tools that are useful for more than one game
User avatar
Andrakann
ultra-veteran
ultra-veteran
Posts: 384
Joined: Wed Jul 06, 2011 8:47 am
Location: Russia
Has thanked: 731 times
Been thanked: 186 times
Contact:

Re: Cryengine Export tool (cgf-exporter)

Post by Andrakann » Tue Nov 24, 2015 6:45 am

Very useful Tool, thank you!

Tested with Armored Warfare (RU version) - works good! :)
Image
Successfully converted .cga, .cgf and .chr models.

Btw, I have some suggestions about AW-converting:
- option for skip LODs (all of them have part name starting with $),
- option for full path to textures in .mtl file, now it's looks like this:

Code: Select all

map_Kd \objects/vehicles/mbt/leopard2a6/textures/leopard2a6_hull_d.dds
(note \ and / mixing bug)
I renaming it to this:

Code: Select all

map_Kd ./textures/leopard2a6_hull_d.dds
works ok, but sometimes textures loads from outside folders, like this:

Code: Select all

map_Kd \objects/vehicles/textures_universal/universalprops/universal_props_shader/universal_props_shader_d.dds
or this:

Code: Select all

map_bump \textures/detail_bumpmaps/metal/metal_006_detail.dds
or from another model folder, like this one for Leopard 2 A6:

Code: Select all

map_Kd \Objects/vehicles/MBT/Leopard2A5/textures/leopard2a5_aps_destroyed_d.dds
So, it's better to detect full path to model in converting and use it for calculating base path to extracted game, i.e. for q:\!_AW\gamezero\objects\vehicles\mbt\leopard2a6\leopard2a6--leopard2a6.cga model "detected" base path is q:\!_AW\gamezero\
Then add this path to textures paths like this:

Code: Select all

map_Kd q:\!_AW\gamezero\textures\leopard2a6_hull_d.dds
Another issue for AW .mtl's is

Code: Select all

d 0.0000
for every material inside, so all of them have zero visibility by default - not sure it's game "feature" or convertion bug...

Tank hulls also have some shitty looking "armor proxies" attached, but with different materials:
Image
(I set transparency to 35 for them on this image for better look)
Would be very useful if you add option to detach (by material) and skip those "proxy" meshes.

Tank turret, suspensoins, tracks and gun parts loads in the center of scene - there's no any dummies or bones to attach them in places?

Found a bug in material, not sure it's game or tool part:

Code: Select all

newmtl APS
Kd 0.1636 0.1870 0.1573
Ks  0.4151 0.4151 0.4151
d 0.0000
illum 2
map_Kd \objects/vehicles/mbt/leopard2a6/textures/leopard2a6_aps_d.dds
map_Ks \objects/vehicles/mbt/leopard2a6/textures/leopard2a6_aps_s.dds
map_bump \objects/vehicles/mbt/leopard2a6/textures/leopard2a6_aps_d.ddsobjects/vehicles/mbt/leopard2a6/textures/leopard2a6_aps_ddn.dds
(Leopard2A6_Detachparts_Hull_mtl.mtl)
bump map have diffuse+bump path.

Also some materials contain double bump maps, normal and detail ones (second is for UV2 I think):

Code: Select all

newmtl interior
Kd 0.2195 0.2195 0.2195
Ks  0.2195 0.2195 0.2195
d 0.0000
illum 2
map_Kd \objects/vehicles/mh60_blackhawk/textures/mh60_interior.dds
map_Ks \objects/vehicles/mh60_blackhawk/textures/mh60_interior_spec.dds
map_bump \objects/vehicles/mh60_blackhawk/textures/mh60_interior_ddn.dds
map_bump \textures/detail_bumpmaps/metal/metal_006_detail.dds
(MH60_mtl.mtl)
second one trying to loads as default, so another option for skip is required.

And about options - can you made a .cfg file for changing them?
Because I use DblClick for conversion (set up cgf-converter.exe as default app for open .cga, .cgf, .chr files), so dancing with command line is not so good for me...

Samples (textures UnSplitted already):
MH-60 BlackHawk (15,4 Mb)
Leopard 2 A6 (190,9 Mb)

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Tue Nov 24, 2015 1:52 pm

Thank you for checking out the program, and especially for the detailed bug reports! I'll take a look at these after the holidays.

The .obj file exporter is a bit limited in that the .mtl format is pretty limited into what it can do. I'm converting the xml material files into that format, and they are much more complicated than the obj mtl format can support. I'm currently working on the COLLADA exporter portion, which will hopefully have a lot more options as far as material support.

Also, if you use the -objectdir argument when running the program, it should put the fully qualified path into the mtl file as well. That will allow it to use dds files outside of the structure the model is in (like the textures\ directory). You need to put the path to where the .pak files are located, so in my case it's:

cgf-converter.exe <file to convert> -objectdir "e:\blender projects\AW"

The / vs \ should be ok with most modern versions of windows, but I'll double check that. I'm pretty sure Blender didn't have any problems importing based on forward vs back slashes, but will definitely test that out.

For stuff loading at the center, there is probably an XML file that contains info on where they are supposed to be placed globally. This is how it works for MechWarrior Online, where the mechs come in dozens of separate pieces and the position info is located outside the .cga file. I made a powershell script that moves them in Blender.

Eventually I'll make a graphical front end for the program so that the entire tank can be done in one click, based on.. probably the .cdf file info. That usually says what pieces go where. But first I need to get through Thanksgiving and figure out how much Fallout 4 is going to screw over my free time... :(

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Fri Dec 04, 2015 4:55 am

Ok, figured out why the Opacity wasn't working properly, but not really sure of how to resolve it right now. Some Cryengine material files don't have that value, so I commented it out. I could add it back in, but if it doesn't exist then it'll crash when it runs into those cases. I just need to test for the condition first; if it exists use that value. If it doesn't, use 1.0.

That concludes today's episode of Bug Hunters!

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Sat Dec 05, 2015 2:57 am

I think I fixed the Opacity and Shininess bug. Anyone want to test against the Armored Warfare models to make sure it's working properly?

Going to also look at the $LOD models to see if I can skip those. It may be more trouble than it's worth if it screws up the indexing though.

Tested against the Blackhawk. Geometry looks good, but still needs work. Normals messed up.

Blender seemed to be able to read the .dds files here? I haven't converted them back to the old way, so not sure if Blender has been updated to handle the new .dds file formats or if I forgot I converted them. Anyway...

Image

User avatar
Andrakann
ultra-veteran
ultra-veteran
Posts: 384
Joined: Wed Jul 06, 2011 8:47 am
Location: Russia
Has thanked: 731 times
Been thanked: 186 times
Contact:

Re: Cryengine Export tool (cgf-exporter)

Post by Andrakann » Sat Dec 05, 2015 4:32 pm

Markemp wrote:I think I fixed the Opacity and Shininess bug. Anyone want to test against the Armored Warfare models to make sure it's working properly?
Testing 0.83 from first post - didn't convert anything :[
Markemp wrote:Normals messed up.

Blender seemed to be able to read the .dds files here? I haven't converted them back to the old way, so not sure if Blender has been updated to handle the new .dds file formats or if I forgot I converted them.
Normal maps DDS are in 3Dc format, not DXT1 or DXT5.
Last edited by Andrakann on Mon Dec 07, 2015 3:59 pm, edited 1 time in total.

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Sat Dec 05, 2015 5:14 pm

The mh60_mtl.mtl file (which is created by cgf-converter) seems to be working for me. The Opacity setting is giving the right values.

d is set to 1.0 now instead of 0. I still have to fix the double map_bump entries though. Not sure how I'm going to do that though, since I don't think .obj files can support multiple map_bump. Fortunately I'm working on the collada export now, although that will take a bit longer.

Code: Select all

# Material file output from cgf-converter.exe version 0.8
#
newmtl exterior
Kd 0.3112 0.3112 0.3112
Ks  0.1166 0.1166 0.1166
[b]d 1.0000[/b]
illum 2
map_Kd e:\blender projects\aw\objects/vehicles/mh60_blackhawk/textures/mh60_exterior.dds
map_Ks e:\blender projects\aw\objects/vehicles/mh60_blackhawk/textures/mh60_exterior_spec.dds
map_bump e:\blender projects\aw\objects/vehicles/mh60_blackhawk/textures/mh60_exterior_ddn.dds
map_bump e:\blender projects\aw\textures/detail_bumpmaps/metal/metal_006_detail.dds

newmtl interior
Kd 0.2195 0.2195 0.2195
Ks  0.2195 0.2195 0.2195
[b]d 1.0000[/b]
illum 2
map_Kd e:\blender projects\aw\objects/vehicles/mh60_blackhawk/textures/mh60_interior.dds
map_Ks e:\blender projects\aw\objects/vehicles/mh60_blackhawk/textures/mh60_interior_spec.dds
map_bump e:\blender projects\aw\objects/vehicles/mh60_blackhawk/textures/mh60_interior_ddn.dds
map_bump e:\blender projects\aw\textures/detail_bumpmaps/metal/metal_006_detail.dds

User avatar
Andrakann
ultra-veteran
ultra-veteran
Posts: 384
Joined: Wed Jul 06, 2011 8:47 am
Location: Russia
Has thanked: 731 times
Been thanked: 186 times
Contact:

Re: Cryengine Export tool (cgf-exporter)

Post by Andrakann » Sun Dec 06, 2015 9:27 am

Markemp wrote:The mh60_mtl.mtl file (which is created by cgf-converter) seems to be working for me.
New version didn't create anything for me, nor _mtl.mtl, nor .obj.
Old version does.

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Sun Dec 06, 2015 3:09 pm

Oh shit, forgot to mention it. I changed the arguments so you can specify the output format.

-obj: Creates an obj (and related mtl) file
-blend: Creates a Blender file (not yet implemented)
-collada|dae: Creates a Collada file (not yet implemented)
-fbx: Creates an FBX file (not yet implemented)

User avatar
Andrakann
ultra-veteran
ultra-veteran
Posts: 384
Joined: Wed Jul 06, 2011 8:47 am
Location: Russia
Has thanked: 731 times
Been thanked: 186 times
Contact:

Re: Cryengine Export tool (cgf-exporter)

Post by Andrakann » Mon Dec 07, 2015 4:24 pm

Markemp wrote:Oh shit, forgot to mention it.
Ok. Now it works :)
Markemp wrote:Anyone want to test against the Armored Warfare models to make sure it's working properly?
M1A1 Damaged model have a really wrong looking rear wheels:
Image
MH60 looks good, if I manually clean secondary bump map entries in _mtl.mtl:
Image

mgtmg
ultra-n00b
Posts: 2
Joined: Wed Feb 23, 2011 8:43 am
Has thanked: 2 times
Been thanked: 1 time

Re: Cryengine Export tool (cgf-exporter)

Post by mgtmg » Tue Dec 08, 2015 9:29 am

TIP:

The .bat file from the DDSUnsplit Utility can be modified to work w/ this Utility, *.dds.0' becomes *.cgf' and of course DDSUnsplit.exe becomes cgf-converter.exe.

Save the .bat to the location of cgf-converter.exe and away you go.

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Tue Dec 08, 2015 1:55 pm

mgtmg wrote:TIP:

The .bat file from the DDSUnsplit Utility can be modified to work w/ this Utility, *.dds.0' becomes *.cgf' and of course DDSUnsplit.exe becomes cgf-converter.exe.

Save the .bat to the location of cgf-converter.exe and away you go.
I'd love to be able to incorporate these features into the program. It annoys me that Blender can't handle the new dds format natively. :(

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Thu Dec 10, 2015 5:55 pm

I put out an updated version of the tool this morning, available in the original post in this thread at the dropbox link. Fixes a bug in reading some mtl files (if the shininess attribute didn't exist in the xml, it crashed) and for some chunk table reads (For some weird reason I had the chunk ID of the scene chunk set to 0xFF, when it doesn't have a chunk ID and I should have just used 0x00.)

freakshow
beginner
Posts: 36
Joined: Sun Jan 19, 2014 7:08 pm
Has thanked: 8 times
Been thanked: 2 times

Re: Cryengine Export tool (cgf-exporter)

Post by freakshow » Fri Dec 11, 2015 9:19 am

does this tool also unpack .pak files? or do i need other tools for that?

Markemp
veteran
Posts: 98
Joined: Tue Dec 24, 2013 2:42 am
Has thanked: 4 times
Been thanked: 43 times

Re: Cryengine Export tool (cgf-exporter)

Post by Markemp » Fri Dec 11, 2015 1:10 pm

freakshow wrote:does this tool also unpack .pak files? or do i need other tools for that?
You can use 7zip to unpack the .pak files. Probably winzip too, but not positive about that.

freakshow
beginner
Posts: 36
Joined: Sun Jan 19, 2014 7:08 pm
Has thanked: 8 times
Been thanked: 2 times

Re: Cryengine Export tool (cgf-exporter)

Post by freakshow » Fri Dec 11, 2015 2:28 pm

most are encrypted zip, such as this from the russian moba Panzar : https://mega.nz/#!nIIHlZLA!oa953W57WUmj ... btXhYOnzu0

Post Reply