Rarysson Guilherme 7c32a2ef51 Add missing include header to FBXCommon.h | 1 year ago | |
---|---|---|
.. | ||
data | 1 year ago | |
doc_classes | 2 years ago | |
fbx_parser | 9 months ago | |
tools | 1 year ago | |
SCsub | 3 years ago | |
config.py | 4 years ago | |
editor_scene_importer_fbx.cpp | 1 year ago | |
editor_scene_importer_fbx.h | 1 year ago | |
readme.md | 4 years ago | |
register_types.cpp | 1 year ago | |
register_types.h | 1 year ago |
The goal of this document is to make everything in FBX clearly stated, any errors will be corrected over time this is a first draft.
308db73d0b
, 2019)This can never be updated from upstream, we have heavily modified the parser to provide memory safety and add some functionality. If anything we should give this parser back to assimp at some point as it has a lot of new features.
Don't. it's not possible the code is rewritten in many areas to remove thirdparty deps and various bugs are fixed.
Many days were put into rewriting the parser to use safe code and safe memory accessors.
FBX Binaries start with the header "Kaydara FBX Binary"
FBX ASCII documents contain a larger header, sometimes with copyright information for a file.
Detecting these is pretty simple.
It's an object to property link. It lists the properties for that object in some cases. Source and destination based by ID.
Its an object to object link, it contains the ID source and destination ID.
Nodes in FBX are connected using OO links, This means Object to Object.
FBX has a single other kind of link which is Object Property, this is used for Object to Property Links, this can be extra attributes, defaults, or even some simple settings.
Bones in FBX are nodes, they initially have the Model:: Type, then have links to SubDeformer the sub deformer is part of the skin there is also an explicit Skin link, which then links to the geometry using OO links in the document.
Godot uses the rotation order: YXZ
FBX has dynamic rotation order to prevent gimbal lock with complex animations
enum RotOrder {
RotOrder_EulerXYZ = 0
RotOrder_EulerXZY,
RotOrder_EulerYZX,
RotOrder_EulerYXZ,
RotOrder_EulerZXY,
RotOrder_EulerZYX,
RotOrder_SphericXYZ // nobody uses this - as far as we can tell
};
// Maya pivots Transform T = chain[TransformationComp_Translation]; Transform Roff = chain[TransformationComp_RotationOffset]; Transform Rp = chain[TransformationComp_RotationPivot]; Transform Rpre = chain[TransformationComp_PreRotation]; Transform R = chain[TransformationComp_Rotation]; Transform Rpost = chain[TransformationComp_PostRotation]; Transform Soff = chain[TransformationComp_ScalingOffset]; Transform Sp = chain[TransformationComp_ScalingPivot]; Transform S = chain[TransformationComp_Scaling];
// 3DS Max Pivots Transform OT = chain[TransformationComp_GeometricTranslation]; Transform OR = chain[TransformationComp_GeometricRotation]; Transform OS = chain[TransformationComp_GeometricScaling];
// Calculate 3DS max pivot transform - use geometric space (e.g doesn't effect children nodes only the current node) geometric_transform = OT * OR * OS; // Calculate standard maya pivots return T * Roff * Rp * Rpre * R * Rpost.inverse() * Rp.inverse() * Soff * Sp * S * Sp.inverse(); }
# Transform inheritance for FBX Nodes
The goal of below is to explain why they implement this in the first place.
The use case is to make nodes have an option to override their local scaling or to make scaling influenced by orientation, which i would imagine would be useful for when you need to rotate a node and the child to scale based on the orientation rather than setting on the rotation matrix planes.
```cpp
// not modified the formatting here since this code must remain clear
enum TransformInheritance {
Transform_RrSs = 0,
// Parent Rotation * Local Rotation * Parent Scale * Local Scale -- Parent Rotation Offset * Parent ScalingOffset (Local scaling is offset by rotation of parent node)
Transform_RSrs = 1, // Parent Rotation * Parent Scale * Local Rotation * Local Scale -- Parent * Local (normal mode)
Transform_Rrs = 2, // Parent Rotation * Local Rotation * Local Scale -- Node transform scale is the only relevant component
TransformInheritance_MAX // end-of-enum sentinel
};
enum TransformInheritance {
Transform_RrSs = 0,
// Local scaling is offset by rotation of parent node
Transform_RSrs = 1,
// Parent * Local (normal mode)
Transform_Rrs = 2,
// Node transform scale is the only relevant component
TransformInheritance_MAX // end-of-enum sentinel
};
Godot has one format for the declared axis
AXIS X, AXIS Y, -AXIS Z
FBX supports any format you can think of. As it has to support Maya and 3DS Max.
GlobalSettings: {
Version: 1000
Properties70: {
P: "UpAxis", "int", "Integer", "",1
P: "UpAxisSign", "int", "Integer", "",1
P: "FrontAxis", "int", "Integer", "",2
P: "FrontAxisSign", "int", "Integer", "",1
P: "CoordAxis", "int", "Integer", "",0
P: "CoordAxisSign", "int", "Integer", "",1
P: "OriginalUpAxis", "int", "Integer", "",1
P: "OriginalUpAxisSign", "int", "Integer", "",1
P: "UnitScaleFactor", "double", "Number", "",1
P: "OriginalUnitScaleFactor", "double", "Number", "",1
P: "AmbientColor", "ColorRGB", "Color", "",0,0,0
P: "DefaultCamera", "KString", "", "", "Producer Perspective"
P: "TimeMode", "enum", "", "",6
P: "TimeProtocol", "enum", "", "",2
P: "SnapOnFrameMode", "enum", "", "",0
P: "TimeSpanStart", "KTime", "Time", "",0
P: "TimeSpanStop", "KTime", "Time", "",92372316000
P: "CustomFrameRate", "double", "Number", "",-1
P: "TimeMarker", "Compound", "", ""
P: "CurrentTimeMarker", "int", "Integer", "",-1
}
}
Coord is X Up is Y Front is Z
Coord is X positive, Y is up positive, Front is -Z negative
Reference type declared:
ControlPoint is a vertex