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
447 stars 117 forks source link

Crash when exporting fbx from Cinema 4D #83

Closed ZzetT closed 9 years ago

ZzetT commented 9 years ago

I created a simple cube in Cinema 4D, exported it to fbx and tried to convert it. However, the converter crashes.

I uploaded the fbx file here: http://pastebin.com/0paTdvQE

Could you please check why it crashes?

xoppa commented 9 years ago

Please include the crash report or fbx-conv output.

spaceemotion commented 9 years ago

I actually just got the same error as @ZzetT.

In my case the conversion from fbx to g3dj worked, but it spits out an error when trying to load the file inside libgdx (I was using the GUI, which does not allow copying the log output - hence the image):

libgdx stacktrace

Console output

I was using the following command to convert the file: ./fbx-conv-mac -v -m 32 -b 12 -w 4 cube.fbx libgdx.g3dj, the log output was as follows:

INFO:     FBX to G3Dx converter, version 0.01.0061 x64 , FBXSDK 2014.02
STATUS:   Loading source file
PROGRESS: Import FBX 14.29%
PROGRESS: Import FBX 28.57% CINEMA_4D_Editor
PROGRESS: Import FBX 42.86% Cube
PROGRESS: Import FBX 57.14% C4D Animation Take
PROGRESS: Import FBX 71.43% Layer0
PROGRESS: Import FBX 85.71%
PROGRESS: Import FBX 100.00%
WARNING:  [CINEMA_4D_Editor] Node uses RrSs mode, transformation might be incorrect
WARNING:  [Cube] Node uses RrSs mode, transformation might be incorrect
STATUS:   [shape(Cube)] Triangulating FbxMesh geometry
VERBOSE:  [shape(Cube)] polygons: 12 (36 indices), control points: 8
WARNING:  Mesh contains more indices (36) than the specified maximum (32)
WARNING:  [] No material found for polygon 0
WARNING:  [] No material found for polygon 1
WARNING:  [] No material found for polygon 2
WARNING:  [] No material found for polygon 3
WARNING:  [] No material found for polygon 4
WARNING:  [] No material found for polygon 5
WARNING:  [] No material found for polygon 6
WARNING:  [] No material found for polygon 7
WARNING:  [] No material found for polygon 8
WARNING:  [] No material found for polygon 9
WARNING:  [] No material found for polygon 10
WARNING:  [] No material found for polygon 11
WARNING:  [Cube] Skipping invalid mesh
WARNING:  [Cube] Skipping 1 parts without material, using placeholder material
STATUS:   Converting source file
STATUS:   Closing source file
VERBOSE:  Listing model information:
VERBOSE:  ID        :
VERBOSE:  Version   : Hi=0, Lo=1
VERBOSE:  Meshes    : 1 (0 vertices, 1 parts, 0 indices)
VERBOSE:  Nodes     : 2 root, 2 total, 1 parts
VERBOSE:  Materials : 1 (0 textures)
STATUS:   Exporting to G3DJ file: libgdx.g3dj
STATUS:   Closing exported file

Files used

My .fbx file export: Download The converted .g3dj file: Download

spaceemotion commented 9 years ago

Okay, fixed it!

When exporting an FBX from cinema one has to make sure to also include at least ONE material on the objects. Even though cinema defaults back to its gray box, libgdx does not. I fixed it by just adding a blank new material and now it works. Maybe give out a warning or something in cases this happens (during conversion)? _Edit:_ It actually did that; WARNING: [] No material found for polygon 0.

spaceemotion commented 9 years ago

Sorry for the three comments, but I don't know if this is related to this or not;

My test scene in cinema (to test the fbx format features) looks like this: A

It got a light with some colors, a few planes, polygons, materials and so forth.

The libGDX version looks like this: B

The textures are supposed to have an alpha channel, what did go wrong?

xoppa commented 9 years ago

Closing this, will reopen if the required information is provided.

@spaceemotion please dont hijack issues for your personal support requests. Use the forum or irc instead.