首页 > 解决方案 > 如何将搅拌机 2.8 制作的 FBX 转换为 `g3db/g3dj` 文件?

问题描述

我尝试使用 libGDX FBX-Converter转换一个简单的多维数据集,但该多维数据集未显示在我的游戏应用程序中。

FBX 文件是使用 blender 2.8 创建的

另一方面,如果我使用 blender 2.76 制作一个 FBX 文件,然后将其转换为 g3dj 文件,它会成功显示。

工作的与不工作的唯一区别是属性TEXCOORD0

这是2个g3dj文件,一个用blender 2.76制作的,一个用blender 2.8制作的

这是可行的,FBX 使用搅拌机 2.76 创建,然后转换为g3dj

{
    "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": []
}

这是一个不起作用的,FBX 用搅拌机 2.8 创建然后转换为g3dj

{
    "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": []
}

那么有没有办法在blender 2.8中省略这个属性?或者甚至更好地让 libgdx 考虑到这个属性?

我在搅拌机 2.8 中使用漫反射 BSDF 材料

标签: libgdx

解决方案


推荐阅读