libgdx / fbx-conv

Command line utility using the FBX SDK to convert FBX/Collada/Obj files to a custom text/binary format for static, keyframed and skinned meshes.
Apache License 2.0
448 stars 116 forks source link

Considerations when exporting to FBX for using in fbx-conv and how to get more debug information #67

Closed paulados closed 9 years ago

paulados commented 9 years ago

Hi,

First of all, congratulations for your work and the converter, I think it is great.

After that, I have to say that I am new to libgdx and, of course, using fbx-conv. In my first steps I have converted some sample models without any problems. However, just now I am trying to convert to g3dj/g3db a FBX model made with 3ds max (I did not make the model, the designer send it to me) and I am having an error and a pop up dialog window error just saying: "fbx-conv-win32.exe has encountered a problem and needs to close"

NOTE: Full output is at the end if the issue.

I have tell the designer the considerations for the fbx model that I have seen here (https://github.com/libgdx/libgdx/wiki/Importing-Blender-models-in-LibGDX), although this considerations are for blender. Considerations I have tell him when exporting to FBX are:

However, I get the above error, and none information about what the problem could be. So, as developer, how could I get more information about the problem for telling to the designer? I do not know if the problem is that he did not follow the considerations, a program problem, etc.

I also have seen in this issue (https://github.com/libgdx/fbx-conv/issues/38) that there is a file size consideration, so that the model should not exceed, but I have not found this size limit in the information. Is there a real size limit? In that case, which one?

On the other part, from this other issue (https://github.com/libgdx/fbx-conv/issues/39) I understand that it is not recommended to use any fbx extension, but only the default autodesk fbx converter without any "extra" for avoiding possible errors.

There is any other consideration to take into account? I think it would be interesting to join all this information, and, if possible, to add also restrictions for 3ds max and maya users for taking into account when exporting the fbx models.

On the other hand, I think it could be useful also to have more information about the errors so that I could tell the designer to reduce the number of vertices, or to avoid such an extension, or whatever, I do not know if it could be possible.

Thank you very much for your work and time.


Output when executing fbx-conv:

C:\fbx-conv>fbx-conv-win32.exe -v -f fbxtest.fbx test.g3dj INFO: FBX to G3Dx converter, version 0.01.0000 x32 (pre-release) STATUS: Loading source file PROGRESS: Import FBX 1.09% PROGRESS: Import FBX 2.18% PROGRESS: Import FBX 3.27% PROGRESS: Import FBX 4.36% PROGRESS: Import FBX 5.45% PROGRESS: Import FBX 6.54% Bip001 Spine1 PROGRESS: Import FBX 7.63% Bip001 Ponytail11 PROGRESS: Import FBX 8.71% Bip001 L UpperArm PROGRESS: Import FBX 9.80% Bip001 R Forearm PROGRESS: Import FBX 10.89% Bip001 L Toe0 PROGRESS: Import FBX 11.98% Material #0 PROGRESS: Import FBX 13.07% Material #5 PROGRESS: Import FBX 14.16% Boots PROGRESS: Import FBX 15.25% Map #6 PROGRESS: Import FBX 16.34% Map #5 PROGRESS: Import FBX 17.43% Take 001 PROGRESS: Import FBX 18.52% PROGRESS: Import FBX 19.61% left_eye_closed PROGRESS: Import FBX 20.70% PROGRESS: Import FBX 21.79% PROGRESS: Import FBX 22.88% PROGRESS: Import FBX 23.97% PROGRESS: Import FBX 25.05% PROGRESS: Import FBX 26.14% PROGRESS: Import FBX 27.23% PROGRESS: Import FBX 28.32% PROGRESS: Import FBX 29.41% PROGRESS: Import FBX 30.50% PROGRESS: Import FBX 31.59% PROGRESS: Import FBX 32.68% PROGRESS: Import FBX 33.77% PROGRESS: Import FBX 34.86% PROGRESS: Import FBX 35.95% PROGRESS: Import FBX 37.04% PROGRESS: Import FBX 38.13% PROGRESS: Import FBX 39.22% PROGRESS: Import FBX 40.31% PROGRESS: Import FBX 41.39% PROGRESS: Import FBX 42.48% PROGRESS: Import FBX 43.57% PROGRESS: Import FBX 44.66% PROGRESS: Import FBX 45.75% PROGRESS: Import FBX 46.84% PROGRESS: Import FBX 47.93% PROGRESS: Import FBX 49.02% PROGRESS: Import FBX 50.11% PROGRESS: Import FBX 51.20% PROGRESS: Import FBX 52.29% PROGRESS: Import FBX 53.38% PROGRESS: Import FBX 54.47% PROGRESS: Import FBX 55.56% PROGRESS: Import FBX 56.64% PROGRESS: Import FBX 57.73% PROGRESS: Import FBX 58.82% PROGRESS: Import FBX 59.91% PROGRESS: Import FBX 61.00% PROGRESS: Import FBX 62.09% PROGRESS: Import FBX 63.18% PROGRESS: Import FBX 64.27% PROGRESS: Import FBX 65.36% PROGRESS: Import FBX 66.45% PROGRESS: Import FBX 67.54% PROGRESS: Import FBX 68.63% PROGRESS: Import FBX 69.72% PROGRESS: Import FBX 70.81% PROGRESS: Import FBX 71.90% PROGRESS: Import FBX 72.98% PROGRESS: Import FBX 74.07% PROGRESS: Import FBX 75.16% R PROGRESS: Import FBX 76.25% T PROGRESS: Import FBX 77.34% S PROGRESS: Import FBX 78.43% R PROGRESS: Import FBX 79.52% T PROGRESS: Import FBX 80.61% S PROGRESS: Import FBX 81.70% R PROGRESS: Import FBX 82.79% T PROGRESS: Import FBX 83.88% S PROGRESS: Import FBX 84.97% R PROGRESS: Import FBX 86.06% T PROGRESS: Import FBX 87.15% S PROGRESS: Import FBX 88.24% R PROGRESS: Import FBX 89.32% T PROGRESS: Import FBX 90.41% S PROGRESS: Import FBX 91.50% R PROGRESS: Import FBX 92.59% PROGRESS: Import FBX 93.68% PROGRESS: Import FBX 94.77% PROGRESS: Import FBX 95.86% PROGRESS: Import FBX 96.95% PROGRESS: Import FBX 98.04% PROGRESS: Import FBX 99.13% open_mouth PROGRESS: Import FBX 100.00%

STATUS: [shape(Body)] Triangulating FbxMesh geometry INFO: [shape(Body)] polygons: 3200 (9600 indices), control points: 1626 STATUS: [shape(Hat)] Triangulating FbxMesh geometry INFO: [shape(Hat)] polygons: 766 (2298 indices), control points: 416 INFO: [shape(Left Eye)] polygons: 728 (2184 indices), control points: 366 INFO: [shape(right Eye)] polygons: 728 (2184 indices), control points: 366

xoppa commented 9 years ago

That should never happen. That error indicates that you either aren't using the latest version of fbx-conv or that something went wrong which isn't properly catched/logged. In the latter case you can find the cause by attaching the debugger and let it break on the exception e.g. If you provide a source file to reproduce the issue, we can have a look at it.

paulados commented 9 years ago

Dear Xoppa,

I found where the error is. I compile fbx-conv using fbx2014.2.1 and I run it in debug mode. Exception was in file Fbxconverter.h, in function addAnimation(Model const &model, FbxAnimStack \ const &animStack), in line 594: // Only add translation, scaling or rotation if ((!node->LclTranslation.IsValid() || propName != node->LclTranslation.GetName()) && (!node->LclScaling.IsValid() || propName != node->LclScaling.GetName()) && (!node->LclRotation.IsValid() || propName != node->LclRotation.GetName())) continue;

I discover that when propName is DeformPercent, there is an exception when accesing getName() in node->LclTranslation.GetName().

Temporally, I add the lines: if ( propName == "DeformPercent" ) { std::cout << "ALERT!!! propName: " << propName << " NOT VALID !!!" << std::endl; continue; }

Before the line that launches the exception. I really do not know the effect of skipping this node, but I just wanted to convert the 3d model and check if it was the problem. Perhaps it could be interesting to add some code like this to avoid this kind of crashes.

On the oher hand, I do not know what this propName DeformPercent does. Do you have any idea?

Apart from this error, after creating the g3db model using this modified fbx-conv, I showed it using libgdx and I realized that the textures where wrong attached. They are show in the inner part of the model, not in the outside part. I do not know how to solve it. I tried with and without the -f option, and result was the same.

Should it be a problem with fbx-conv or with the model creation?

Thanks in advance,

xoppa commented 9 years ago

Perhaps it could be interesting to add some code like this to avoid this kind of crashes.

Please, consider sending a pull request

On the oher hand, I do not know what this propName DeformPercent does. Do you have any idea?

No, not without being able to see the problem.

Should it be a problem with fbx-conv or with the model creation?

Fbx-conv does not modify the model data. That's probably an issue with the model, perhaps the vertex winding or normals is incorrect.

paulados commented 9 years ago

Hi again !!! First of all, sorry for not answering before. About the pull request, I do not know how to do it. If I can't do it I'll ask you for any option to the pull request.

xoppa commented 9 years ago

Fixed with #70