Markemp / Cryengine-Converter

A c# program to convert Crytek files to Collada (XML) format
https://www.heffaypresents.com/GitHub/
GNU General Public License v2.0
209 stars 53 forks source link

MWO: Atlas extract failing leading to impossible import #17

Closed TheFoxyShortBus closed 4 years ago

TheFoxyShortBus commented 5 years ago

I know this tool is probably on its last legs, but wanted to share an issue I found.

When running the cfg-converter tool on certain mechs run into an error. This is currently based off the newest version of the of both tools. (downloaded 2 days ago from this post). For this example I'm using the atlas.

foreach ($file in (get-childitem -recurse *.chr)) { cgf-converter $file -throw -objectdir "D:MWO Assets" }
Input file set to D:\MWO Assets\Objects\mechs\atlas\body\atlas.chr
Exceptions thrown to debugger
Data directory set to D:MWO Assets

********************************************************************************
There was an error rendering D:\MWO Assets\Objects\mechs\atlas\body\atlas.chr

Unable to read beyond the end of the stream.

   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadSingle()
   at CgfConverter.CryEngine_Core.ChunkCompiledPhysicalProxies_800.Read(BinaryReader b)
   at CgfConverter.CryEngine_Core.Model.Read_Chunks(BinaryReader reader)
   at CgfConverter.CryEngine_Core.Model.Load(String fileName)
   at CgfConverter.CryEngine_Core.Model.FromFile(String fileName)
   at CgfConverter.CryEngine..ctor(String fileName, String dataDir)
   at CgfConverter.Program.Main(String[] args)
********************************************************************************

Input file set to D:\MWO Assets\Objects\mechs\atlas\body\atlas_LOD1.chr
Exceptions thrown to debugger
Data directory set to D:MWO Assets 

Looking through the error, I think it comes back to these three lines. Because its rolling back into the ChunkCompiledPhysicalProxies_800.cs file, and its in the FillBuffer call after a ReadSingle and these are the only 3 in the file.

for (Int32 j = 0; j < PhysicalProxies[i].NumVertices; j++)
                {
                    PhysicalProxies[i].Vertices[j].x = b.ReadSingle();
                    PhysicalProxies[i].Vertices[j].y = b.ReadSingle();
                    PhysicalProxies[i].Vertices[j].z = b.ReadSingle();
                }

I'm not a C# Dev but reading through the docs it appears like its reading 4Bytes (aka Int32), and a "Unable to read beyond the end of the stream." error is thrown when you read past what is actually there, I'm not entirely sure if that is what it means in C#, but that is my guess.

It seems like another project seemed to have something similar go on. Not exactly the same issue, but might offer some help. https://github.com/Perfare/AssetStudio/issues/177

If I go to import the mech in blender, the blender console throws the following error. Probably because the above process didn't work, but I figured I'd throw it in there for completeness.

found bundled python: C:\Program Files\Blender Foundation\Blender\2.79\python
Import Mech
D:\MWO Assets\Objects\mechs\atlas\atlas.cdf
I/O warning : failed to load external entity "file:///D:/MWO%20Assets/Objects/mechs/atlas/body/atlas.dae"
Couldn't open file
Schema validation error: Critical error: ERROR_COULD_NOT_OPEN_FILE Additional: D:\MWO Assets\Objects\mechs\atlas\body\atlas.dae
COLLADAFW::Root::loadDocument() returned false on 1st pass
Error: Errors found during parsing COLLADA document (see console for details)
Error importing armature at: D:\MWO Assets\Objects\mechs\atlas\body\atlas.dae
RuntimeError: class IMPORT_SCENE_OT_mech, function execute: incompatible return value , str(, Function.result expected a set, not a bool)

location: <unknown location>:-1

location: <unknown location>:-1

The file atlas.dae doesn't exist, most likely because of the converter failing. Let me know if you need more info/help I'll gladly help you out.

Markemp commented 5 years ago

I just ran a quick test against my last extraction of the MWO files (in Sept), and it seemed to work. The -objectdir argument does seem a bit off when you call it in powershell though. It should be "D:\MWO Assets\" (include the quotes, as you have a space in the directory).

Can you run it just on the .chr file? cgf-converter.exe atlas.chr -objectdir "d:\mwo assets\"?

TheFoxyShortBus commented 5 years ago
cgf-converter.exe atlas.chr -objectdir "D:\MWO Assets\"
Input file set to .\atlas.chr
Data directory set to D:\MWO Assets"

********************************************************************************
There was an error rendering D:\MWO Assets\Objects\mechs\atlas\body\atlas.chr

Unable to read beyond the end of the stream.

   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadSingle()
   at CgfConverter.CryEngine_Core.ChunkCompiledPhysicalProxies_800.Read(BinaryReader b)
   at CgfConverter.CryEngine_Core.Model.Read_Chunks(BinaryReader reader)
   at CgfConverter.CryEngine_Core.Model.Load(String fileName)
   at CgfConverter.CryEngine_Core.Model.FromFile(String fileName)
   at CgfConverter.CryEngine..ctor(String fileName, String dataDir)
   at CgfConverter.Program.Main(String[] args)
********************************************************************************

Could it potentially be an issue with the space in the folder structure?

Markemp commented 5 years ago

Hmm... which version are you using? Latest release can be found here: https://github.com/Markemp/Cryengine-Converter/releases

TheFoxyShortBus commented 5 years ago

I am using v1.0.2, downloaded directly from your webpage (which points back to here) and directly through github releases. Both seem to run into this issue. I've steam verified all the files as well. The atlas.pak file looks like it was update 10/4/2018 so I'm not sure if something changed. It does the same thing on a few other mechs as well.

It's also throwing these on a couple pieces of the atlas. Not sure if they are related or not.

Input file set to D:\MWOAssets\Objects\mechs\atlas\body\as7_right_torso_uac5_bh1.cga
Data directory set to D:\MWOAssets
Conflict in chunk definition
13D0+D4
AAB8+D4
Conflict in chunk definition
14A4+E8
AB8C+E8
Conflict in chunk definition
158C+E8
AC74+E8
Markemp commented 5 years ago

The Conflict in chunk definition shouldn't affect the output, so those should still render fine. But let me see if I can figure out what's up with the Atlas chr file, since that is the armature.

Markemp commented 5 years ago

I just published a new release (v1.0.3) that I built in September. It worked against the current Atlas.chr file, so hopefully it will solve the issues you are seeing. Can you test it out and let me know if it works?

TheFoxyShortBus commented 5 years ago

So. That partially solved it, it seems. The script completes with out that error anymore. But when importing it now only has the atlas head. mwoimport

Also the timberwolf completes and imports with out issues, and the catapult now converts correctly, but only imports the skeleton. Same as the atlas, except it doesn't even have a cockpit.

Markemp commented 5 years ago

Hah! You identified the 3 mechs where Blender is having issues. I've dug around in the Blender source code quite a bit for those mechs, and it's having a hard time importing the full skeleton for some reason. I need to do some more digging in Blender to see if I can figure out what's going on, but until then... it's their bug, not mine. ;)

I'll probably dig in hard after the semester ends. It's been a problem for a while, and bugging me immensely.

TheFoxyShortBus commented 5 years ago

Of course, two of my favorite mechs don't work (atlas and catapult), the timberwolf seemed to work as far as I can tell. That would indeed be my luck. I'm assuming there aren't any known work-arounds (except to manually piece together the mech from all the pieces)?

Let me know what I can do to help.

catapult timberwolf

OopAck commented 5 years ago

i would like to get the Catapult back too.

Markemp commented 4 years ago

This issue is now fixed! Blender 2.80 was released this week, and fixes some Collada armature importing issues. In addition, Cryengine Importer has been updated to support 2.80.