Cannot deserialize mesh file on Linux


#1

I have a project that was originally created using Xcode on Mac OS, and it loaded in some mesh files (which were manually converted to .mesh files from an original .fbx file. All good.

I cloned the same project on a Linux machine (Ubuntu 18.04, same version of NAP, i.e. 0.2.3) and this also compiles just fine. But when I try to run the application, I get runtime errors:

[info] loading mesh: 3d/vendome_facades_01.mesh
[fatal] error: unable to initialize application:
	Couldn't initialize object 'FacadeMesh01'
	Unable to load mesh 3d/vendome_facades_01.mesh for resource -1316258664
	Failed to load mesh from 3d/vendome_facades_01.mesh
	Can't deserialize binary; version of a type contained in the binary has changed

Do .mesh files need to be re-created for each platform? Is there something platform-specific in the binary files?


#2

Hi,

Yes. Mesh files are binary and converted into a format that is platform specific. It’s best to check in the same fbx file so it can be converted for your platform.

Conversion happens automatically as a post process step, if I’m not mistaken. Otherwise you can run the fbxconverter tool from command line.


#3

Ah YEAH that works great.

And good to confirm that the conversion is meant to happen automatically. I suspected that was the case but needed to confirm.

Does this mean that the MeshFromFile resources should reference the FBX file rather than the mesh file directly?


#4

hey @steveb,

you can’t directly link to fbx files because fbx files are containers for many meshes, materials and skeletons. Similar to unreal engine, maya or houdini (for example), fbx files are read and converted into a format that is compatible with the engine. For that reason you need to explicitly point to .mesh files in json.

What I generally do is check-in the fbx files and make sure that they are converted before linking them in. This works well cross-platform, since the same meshes are extracted and converted into .mesh files.

Cheers Coen!


#5

At what point is the conversion done, then? On regenerate or on build?


#6

On build, it’s a post build step.


#7

OK, seems to work only if the FBX files are found in the root of the data folder, which is good to know.

It’s also a little impractical if you have large meshes, because even if the FBX file hasn’t changed then the post build step still runs, which in our case takes a few minutes for every build.

It might make more sense for us to convert manually on each platform (and exclude the actual mesh files from the git repo).