سؤال

How would you read animations from a .fbx file? I'm using Java with OpenGL for this, but that's not too relevant for this question. I've looked around at several different sources and can't find any information on the formatting of .FBX files.

My model loader currently loads in Names, Indices, Vertices, Normals, Bone Names, Bone weights, and Bone matrices. But I'm having troubles understanding as to how to read the animations from here.

I can assume this is the animation section of the file.

;Takes and animation section
;----------------------------------------------------

Takes:  {
    Current: "ArmatureAction"
    Take: "ArmatureAction" {
        FileName: "ArmatureAction.tak"
        LocalTime: -1924423249,105843278750
        ReferenceTime: -1924423249,105843278750

        ;Models animation
        ;----------------------------------------------------
        Model: "Model::body" {
            Version: 1.1
            Channel: "Transform" {
                Channel: "T" {
                    Channel: "X" {
                        Default: 0.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,0.000000000000000,L
                        Color: 1,0,0
                    }
                    Channel: "Y" {
                        Default: 0.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,0.000000000000000,L
                        Color: 0,1,0
                    }
                    Channel: "Z" {
                        Default: 0.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,0.000000000000000,L
                        Color: 0,0,1
                    }
                    LayerType: 1
                }
                Channel: "R" {
                    Channel: "X" {
                        Default: 90.000002504348856
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,90.000002504348856,L
                        Color: 1,0,0
                    }
                    Channel: "Y" {
                        Default: -89.999995674159678
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,-89.999995674159678,L
                        Color: 0,1,0
                    }
                    Channel: "Z" {
                        Default: 0.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,0.000000000000000,L
                        Color: 0,0,1
                    }
                    LayerType: 2
                }
                Channel: "S" {
                    Channel: "X" {
                        Default: 1.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,1.000000000000000,L
                        Color: 1,0,0
                    }
                    Channel: "Y" {
                        Default: 1.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,1.000000000000000,L
                        Color: 0,1,0
                    }
                    Channel: "Z" {
                        Default: 1.000000000000000
                        KeyVer: 4005
                        KeyCount: 1
                        Key: 
                            1924423250,1.000000000000000,L
                        Color: 0,0,1
                    }
                    LayerType: 3
                }
            }
        }
        Model: "Model::head" {
            Version: 1.1
            Channel: "Transform" {
                Channel: "T" {
                    Channel: "X" {...............................

Would a kind soul please explain how this is formatted? Help appreciated!

هل كانت مفيدة؟

المحلول

Since (IIRC) the FBX specification is not public, you usually want to use the FBX SDK.

The online documentation is a great place to start learning. However, the SDK only exposes a C++ and a Python API.

You can also take a look at Blender (Open-Source), which provides an FBX exporter written without using the FBX SDK.

Wikipedia also states that the OpenEndedGroup's product, Field, includes an FBX java library. You can find their code on Github and the part you're interested in is probably part of jfbxlib.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top