1
\$\begingroup\$

I've tried to convert a simple cube with libGDX FBX-Converter but the cube is't displaying in my game app.

The FBX file is created by blender 2.8

This is the g3dj file

{
    "version": [  0,   1], 
    "id": "", 
    "meshes": [
        {
            "attributes": ["POSITION", "NORMAL", "TEXCOORD0"], 
            "vertices": [
                -1.000000,  1.000000,  1.000000, -1.000000,  0.000000,  0.000000,  0.625000,  0.750000, 
                -1.000000, -1.000000, -1.000000, -1.000000,  0.000000,  0.000000,  0.375000,  1.000000, 
                -1.000000, -1.000000,  1.000000, -1.000000,  0.000000,  0.000000,  0.625000,  1.000000, 
                -1.000000,  1.000000, -1.000000, -1.000000,  0.000000,  0.000000,  0.375000,  0.750000, 
                 1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000,  0.625000,  0.500000, 
                -1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000,  0.375000,  0.750000, 
                -1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000,  0.625000,  0.750000, 
                 1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000,  0.375000,  0.500000, 
                 1.000000, -1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  0.625000,  0.250000, 
                 1.000000,  1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  0.375000,  0.500000, 
                 1.000000,  1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  0.625000,  0.500000, 
                 1.000000, -1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  0.375000,  0.250000, 
                -1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000,  0.625000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000,  0.375000,  0.250000, 
                 1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000,  0.625000,  0.250000, 
                -1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000,  0.375000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.375000,  0.250000, 
                -1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.125000,  0.250000, 
                -1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.125000,  0.500000, 
                 1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.375000,  0.500000, 
                -1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.875000,  0.500000, 
                -1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.875000,  0.250000, 
                 1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.625000,  0.500000, 
                 1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.625000,  0.250000
            ], 
            "parts": [
                {
                    "id": "Cube_part1", 
                    "type": "TRIANGLES", 
                    "indices": [
                          0,   1,   2,   1,   0,   3,   4,   5,   6,   5,   4,   7, 
                          8,   9,  10,   9,   8,  11,  12,  13,  14,  13,  12,  15, 
                         16,  17,  18,  16,  18,  19,  20,  21,  22,  22,  21,  23
                    ]
                }
            ]
        }
    ], 
    "materials": [
        {
            "id": "green", 
            "ambient": [ 0.050876,  0.050876,  0.050876], 
            "diffuse": [ 0.018407,  0.800000,  0.000000], 
            "emissive": [ 0.018407,  0.800000,  0.000000], 
            "opacity":  0.000000, 
            "specular": [ 0.018407,  0.800000,  0.000000], 
            "shininess":  25.000000
        }
    ], 
    "nodes": [
        {
            "id": "Cube", 
            "rotation": [-0.707107,  0.000000,  0.000000,  0.707107], 
            "scale": [ 10.000000,  10.000000,  10.000000], 
            "parts": [
                {
                    "meshpartid": "Cube_part1", 
                    "materialid": "green", 
                    "uvMapping": [[]]
                }
            ]
        }
    ], 
    "animations": []
}

This file doesn't display on my game app. On the other hand, if I make an FBX file with blender 2.76 and then convert it to g3dj file it displays successfully.

Any ideas on how to convert an FBX made by blender 2.8 into a g3db/g3dj file?

UPDATE:

The only difference between the working one vs the not working one is attribute TEXCOORD0

heres 2 g3dj files, the one made with blender 2.76, and the one made with blender 2.8

The g3dj file which converted an FBX file made with blender 2.76(the one that works):

{
    "version": [  0,   1], 
    "id": "", 
    "meshes": [
        {
            "attributes": ["POSITION", "NORMAL"], 
            "vertices": [
                -1.000000,  1.000000,  1.000000, -1.000000,  0.000000,  0.000000, 
                -1.000000,  1.000000, -1.000000, -1.000000,  0.000000,  0.000000, 
                -1.000000, -1.000000,  1.000000, -1.000000,  0.000000,  0.000000, 
                -1.000000, -1.000000, -1.000000, -1.000000,  0.000000,  0.000000, 
                 1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000, 
                 1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000, 
                -1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000, 
                -1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000, 
                 1.000000, -1.000000,  1.000000,  1.000000,  0.000000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  1.000000,  0.000000,  0.000000, 
                 1.000000,  1.000000,  1.000000,  1.000000,  0.000000,  0.000000, 
                 1.000000,  1.000000, -1.000000,  1.000000,  0.000000,  0.000000, 
                -1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000, 
                -1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000, 
                 1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                -1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                 1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                -1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                -1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  1.000000, 
                 1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  1.000000, 
                 1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  1.000000, 
                -1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  1.000000
            ], 
            "parts": [
                {
                    "id": "Cube.002_part1", 
                    "type": "TRIANGLES", 
                    "indices": [
                          0,   1,   2,   2,   1,   3,   4,   5,   6,   6,   5,   7, 
                          8,   9,  10,  10,   9,  11,  12,  13,  14,  14,  13,  15, 
                         16,  17,  18,  17,  19,  18,  20,  21,  22,  21,  20,  23
                    ]
                }
            ]
        }
    ], 
    "materials": [
        {
            "id": "Material.005", 
            "ambient": [ 0.000000,  0.000000,  0.000000], 
            "diffuse": [ 0.800000,  0.800000,  0.800000], 
            "emissive": [ 0.800000,  0.800000,  0.800000], 
            "opacity":  1.000000, 
            "specular": [ 1.000000,  1.000000,  1.000000], 
            "shininess":  9.607843
        }
    ], 
    "nodes": [
        {
            "id": "Cube", 
            "rotation": [-0.707107, -0.000000,  0.000000,  0.707107], 
            "scale": [ 1.000000,  1.000000,  0.158538], 
            "parts": [
                {
                    "meshpartid": "Cube.002_part1", 
                    "materialid": "Material.005"
                }
            ]
        }
    ], 
    "animations": []
}

And heres the g3dj file which converted an FBX file made with blender 2.8(the one that DO NOT work):

{
    "version": [  0,   1], 
    "id": "", 
    "meshes": [
        {
            "attributes": ["POSITION", "NORMAL", "TEXCOORD0"], 
            "vertices": [
                -1.000000,  1.000000,  1.000000, -1.000000,  0.000000,  0.000000,  0.625000,  0.750000, 
                -1.000000, -1.000000, -1.000000, -1.000000,  0.000000,  0.000000,  0.375000,  1.000000, 
                -1.000000, -1.000000,  1.000000, -1.000000,  0.000000,  0.000000,  0.625000,  1.000000, 
                -1.000000,  1.000000, -1.000000, -1.000000,  0.000000,  0.000000,  0.375000,  0.750000, 
                 1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000,  0.625000,  0.500000, 
                -1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000,  0.375000,  0.750000, 
                -1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000,  0.625000,  0.750000, 
                 1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000,  0.375000,  0.500000, 
                 1.000000, -1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  0.625000,  0.250000, 
                 1.000000,  1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  0.375000,  0.500000, 
                 1.000000,  1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  0.625000,  0.500000, 
                 1.000000, -1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  0.375000,  0.250000, 
                -1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000,  0.625000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000,  0.375000,  0.250000, 
                 1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000,  0.625000,  0.250000, 
                -1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000,  0.375000,  0.000000, 
                 1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.375000,  0.250000, 
                -1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.125000,  0.250000, 
                -1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.125000,  0.500000, 
                 1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000,  0.375000,  0.500000, 
                -1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.875000,  0.500000, 
                -1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.875000,  0.250000, 
                 1.000000,  1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.625000,  0.500000, 
                 1.000000, -1.000000,  1.000000,  0.000000,  0.000000,  1.000000,  0.625000,  0.250000
            ], 
            "parts": [
                {
                    "id": "Cube.001_part1", 
                    "type": "TRIANGLES", 
                    "indices": [
                          0,   1,   2,   1,   0,   3,   4,   5,   6,   5,   4,   7, 
                          8,   9,  10,   9,   8,  11,  12,  13,  14,  13,  12,  15, 
                         16,  17,  18,  16,  18,  19,  20,  21,  22,  22,  21,  23
                    ]
                }
            ]
        }
    ], 
    "materials": [
        {
            "id": "Material.002", 
            "ambient": [ 0.050876,  0.050876,  0.050876], 
            "diffuse": [ 0.800000,  0.800000,  0.800000], 
            "emissive": [ 0.800000,  0.800000,  0.800000], 
            "opacity":  0.000000, 
            "specular": [ 0.800000,  0.800000,  0.800000], 
            "shininess":  25.000000
        }
    ], 
    "nodes": [
        {
            "id": "Cube", 
            "rotation": [-0.707107, -0.000000,  0.000000,  0.707107], 
            "scale": [ 1.000000,  1.000000,  0.081716], 
            "parts": [
                {
                    "meshpartid": "Cube.001_part1", 
                    "materialid": "Material.002", 
                    "uvMapping": [[]]
                }
            ]
        }
    ], 
    "animations": []
}

So is there a way to omit this attribute in blender 2.8? or even better make libgdx take into account this attribute?

\$\endgroup\$
1
  • \$\begingroup\$ What are you using to convert to g3dj? It sounds like Blender > Export to FBX > fbx-conv (what version, what command?) > copy to your libgdx project. \$\endgroup\$
    – Jag
    Commented Oct 9, 2019 at 16:33

1 Answer 1

1
\$\begingroup\$

Turns out that this is a materials problem.

For some reason FBX converter is writing opacity to 0.000000 why? I don't know. But for now, a workaround is to change it to 1.000000 in the g3dj file under materials block

Also, the material color is taken from the Viewport Display section Color and not from the Surface Color section of blender.

Note that this is not a blender 2.8 problem as I believed at first if you change the render engine to cycles in blender 2.76 FBX converter will write the material with opacity 0.00000 too

This of course is only valid if your using g3dj file, if someone has a better solution please do answer, at this point any solution is better than this.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .