#define | ufbx_assert(cond) |
Assertion function used in ufbx, defaults to C standard assert()
.
You can define this to your custom preferred assert macro, but in that case
make sure that it is also used within ufbx.c
.
Defining UFBX_NO_ASSERT
to any value disables assertions.
#define | ufbx_nullable |
Pointer may be NULL
.
#define | ufbx_unsafe |
Changing this value from default or calling this function can lead into breaking API guarantees.
#define | ufbx_abi |
Linkage of the main ufbx API functions.
Defaults to nothing, or static
if UFBX_STATIC
is defined.
If you want to isolate ufbx to a single translation unit you can do the following:
#define UFBX_STATIC #include "ufbx.h" #include "ufbx.c"
#define | ufbx_abi_data |
Linkage of the main ufbx data fields in the header.
Defaults to extern
, or static
if UFBX_STATIC
is defined.
#define | ufbx_abi_data_def |
Linkage of the main ufbx data fields in the source.
Defaults to nothing, or static
if UFBX_STATIC
is defined.
#define | UFBX_ERROR_STACK_MAX_DEPTH |
#define | UFBX_PANIC_MESSAGE_LENGTH |
#define | UFBX_ERROR_INFO_LENGTH |
Limits for embedded arrays within structures.
#define | UFBX_THREAD_GROUP_COUNT |
Number of thread groups to use if threading is enabled.
A thread group processes a number of tasks and is then waited and potentially re-used later. In essence, this controls the granularity of threading.
#define | ufbx_pack_version(major, minor, patch) |
#define | ufbx_version_major(version) |
#define | ufbx_version_minor(version) |
#define | ufbx_version_patch(version) |
Packing/unpacking for UFBX_HEADER_VERSION
and ufbx_source_version
.
#define | UFBX_HEADER_VERSION |
#define | UFBX_VERSION |
Version of the ufbx header.
UFBX_VERSION
is simply an alias of UFBX_HEADER_VERSION
.
ufbx_source_version
contains the version of the corresponding source file.
The version can be compared numerically to the result of ufbx_pack_version()
,
for example #if UFBX_VERSION >= ufbx_pack_version(0, 12, 0)
.
struct ufbx_string
struct ufbx_vec4
struct ufbx_quat
enum ufbx_rotation_order
Order in which Euler-angle rotation axes are applied for a transform
The order in the name refers to the order of axes applied,
not the multiplication order: eg. UFBX_ROTATION_ORDER_XYZ
is Z*Y*X
struct ufbx_transform
struct ufbx_matrix
4x3 matrix encoding an affine transformation.
cols[0..2]
are the X/Y/Z basis vectors, cols[3]
is the translation
struct ufbx_void_list
struct ufbx_bool_list
struct ufbx_uint32_list
struct ufbx_real_list
struct ufbx_vec2_list
struct ufbx_vec3_list
struct ufbx_vec4_list
struct ufbx_string_list
ufbx_string* | data |
size_t | count |
#define | UFBX_NO_INDEX |
Sentinel value used to represent a missing index.
enum ufbx_dom_value_type
struct ufbx_dom_value
ufbx_dom_value_type | type |
ufbx_string | value_str |
ufbx_blob | value_blob |
int64_t | value_int |
double | value_float |
struct ufbx_dom_node_list
ufbx_dom_node** | data |
size_t | count |
struct ufbx_dom_value_list
ufbx_dom_value* | data |
size_t | count |
enum ufbx_prop_type
Data type contained within the property. All the data fields are always
populated regardless of type, so there's no need to switch by type usually
eg. prop->value_real
and prop->value_int
have the same value (well, close)
if prop->type == UFBX_PROP_INTEGER
. String values are not converted from/to.
enum ufbx_prop_flags
Property flags: Advanced information about properties, not usually needed.
Supports animation.
ufbx ignores this and allows animations on non-animatable properties.
User defined (custom) property.
Hidden in UI.
Disallow modification from UI for components.
Disable animation from components.
Property created by ufbx when an element has a connected ufbx_anim_prop
but doesn't contain the ufbx_prop
it's referring to.
The property may have been found in the templated defaults.
The property has at least one ufbx_anim_prop
in some layer.
Used by ufbx_evaluate_prop()
to indicate the the property was not found.
The property is connected to another one.
This use case is relatively rare so ufbx_prop
does not track connections
directly. You can find connections from ufbx_element.connections_dst
where
ufbx_connection.dst_prop
is this property and ufbx_connection.src_prop
is defined.
The value of this property is undefined (represented as zero).
This property has been overridden by the user.
See ufbx_anim.prop_overrides
for more information.
Value type.
REAL/VEC2/VEC3/VEC4
are mutually exclusive but may coexist with eg. STRING
in some rare cases where the string defines the unit for the vector.
struct ufbx_prop
Single property with name/type/value.
struct ufbx_prop_list
struct ufbx_props
List of alphabetically sorted properties with potential defaults.
For animated objects in as scene from ufbx_evaluate_scene()
this list
only has the animated properties, the originals are stored under defaults
.
struct ufbx_element_list
ufbx_element** | data |
size_t | count |
struct ufbx_unknown_list
ufbx_unknown** | data |
size_t | count |
struct ufbx_node_list
struct ufbx_mesh_list
struct ufbx_light_list
ufbx_light** | data |
size_t | count |
struct ufbx_camera_list
ufbx_camera** | data |
size_t | count |
struct ufbx_bone_list
struct ufbx_empty_list
ufbx_empty** | data |
size_t | count |
struct ufbx_line_curve_list
ufbx_line_curve** | data |
size_t | count |
struct ufbx_nurbs_curve_list
ufbx_nurbs_curve** | data |
size_t | count |
struct ufbx_nurbs_surface_list
ufbx_nurbs_surface** | data |
size_t | count |
struct ufbx_nurbs_trim_surface_list
ufbx_nurbs_trim_surface** | data |
size_t | count |
struct ufbx_nurbs_trim_boundary_list
ufbx_nurbs_trim_boundary** | data |
size_t | count |
struct ufbx_procedural_geometry_list
ufbx_procedural_geometry** | data |
size_t | count |
struct ufbx_stereo_camera_list
ufbx_stereo_camera** | data |
size_t | count |
struct ufbx_camera_switcher_list
ufbx_camera_switcher** | data |
size_t | count |
struct ufbx_marker_list
ufbx_marker** | data |
size_t | count |
struct ufbx_lod_group_list
ufbx_lod_group** | data |
size_t | count |
struct ufbx_skin_deformer_list
ufbx_skin_deformer** | data |
size_t | count |
struct ufbx_skin_cluster_list
ufbx_skin_cluster** | data |
size_t | count |
struct ufbx_blend_deformer_list
ufbx_blend_deformer** | data |
size_t | count |
struct ufbx_blend_channel_list
ufbx_blend_channel** | data |
size_t | count |
struct ufbx_blend_shape_list
ufbx_blend_shape** | data |
size_t | count |
struct ufbx_cache_deformer_list
ufbx_cache_deformer** | data |
size_t | count |
struct ufbx_cache_file_list
ufbx_cache_file** | data |
size_t | count |
struct ufbx_material_list
ufbx_material** | data |
size_t | count |
struct ufbx_texture_list
ufbx_texture** | data |
size_t | count |
struct ufbx_video_list
ufbx_video** | data |
size_t | count |
struct ufbx_shader_list
ufbx_shader** | data |
size_t | count |
struct ufbx_shader_binding_list
ufbx_shader_binding** | data |
size_t | count |
struct ufbx_anim_stack_list
ufbx_anim_stack** | data |
size_t | count |
struct ufbx_anim_layer_list
ufbx_anim_layer** | data |
size_t | count |
struct ufbx_anim_value_list
ufbx_anim_value** | data |
size_t | count |
struct ufbx_anim_curve_list
ufbx_anim_curve** | data |
size_t | count |
struct ufbx_display_layer_list
ufbx_display_layer** | data |
size_t | count |
struct ufbx_selection_set_list
ufbx_selection_set** | data |
size_t | count |
struct ufbx_selection_node_list
ufbx_selection_node** | data |
size_t | count |
struct ufbx_character_list
ufbx_character** | data |
size_t | count |
struct ufbx_constraint_list
ufbx_constraint** | data |
size_t | count |
struct ufbx_audio_layer_list
ufbx_audio_layer** | data |
size_t | count |
struct ufbx_audio_clip_list
ufbx_audio_clip** | data |
size_t | count |
struct ufbx_pose_list
struct ufbx_metadata_object_list
ufbx_metadata_object** | data |
size_t | count |
enum ufbx_element_type
struct ufbx_connection
Connection between two elements.
Source and destination are somewhat arbitrary but the destination is often the "container" like a parent node or mesh containing a deformer.
struct ufbx_connection_list
ufbx_connection* | data |
size_t | count |
struct ufbx_element
Element "base-class" common to each element.
Some fields (like connections_src
) are advanced and not visible
in the specialized element structs.
The element_id
value is consistent when loading the
same file, but re-exporting the file will invalidate them.
struct ufbx_unknown
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Shared "base-class" header, see ufbx_element
.
FBX format specific type information.
In ASCII FBX format:
super_type: ID, "type::name", "sub_type" { ... }
enum ufbx_inherit_mode
Inherit type specifies how hierarchial node transforms are combined.
This only affects the final scaling, as rotation and translation are always inherited correctly.
These don't map to "InheritType"
property as there may be new ones for
compatibility with various exporters.
Normal matrix composition of hierarchy: R*S*r*s
.
child.node_to_world = parent.node_to_world * child.node_to_parent;
Ignore parent scale when computing the transform: R*r*s
.
ufbx_transform t = node.local_transform; t.translation *= parent.inherit_scale; t.scale *= node.inherit_scale_node.inherit_scale; child.node_to_world = parent.unscaled_node_to_world * t;
Also known as "Segment scale compensate" in some software.
Apply parent scale component-wise: R*r*S*s
.
ufbx_transform t = node.local_transform; t.translation *= parent.inherit_scale; t.scale *= node.inherit_scale_node.inherit_scale; child.node_to_world = parent.unscaled_node_to_world * t;
enum ufbx_mirror_axis
Axis used to mirror transformations for handedness conversion.
struct ufbx_node
Nodes form the scene transformation hierarchy and can contain attached
elements such as meshes or lights. In normal cases a single ufbx_node
contains only a single attached element, so using type/mesh/...
is safe.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Parent node containing this one if not root.
Always non-NULL
for non-root nodes unless
ufbx_load_opts.allow_nodes_out_of_root
is enabled.
List of child nodes parented to this node.
Common attached element type and typed pointers. Set to NULL
if not in
use, so checking attrib_type
is not required.
If you need less common attributes access ufbx_node.attrib
, you
can use utility functions like ufbx_as_nurbs_curve(attrib)
to convert
and check the attribute in one step.
Less common attributes use these fields.
Defined even if it is one of the above, eg. ufbx_mesh
. In case there
is multiple attributes this will be the first one.
Geometry transform helper if one exists.
Scale helper if one exists.
attrib->type
if attrib
is defined, otherwise UFBX_ELEMENT_UNKNOWN
.
List of all attached attribute elements.
In most cases there is only zero or one attributes per node, but if you have a very exotic FBX file nodes may have multiple attributes.
ufbx_inherit_mode | inherit_mode |
ufbx_inherit_mode | original_inherit_mode |
ufbx_transform | local_transform |
ufbx_transform | geometry_transform |
Local transform in parent, geometry transform is a non-inherited transform applied only to attachments like meshes
Combined scale when using UFBX_INHERIT_MODE_COMPONENTWISE_SCALE
.
Contains local_transform.scale
otherwise.
Node where scale is inherited from for UFBX_INHERIT_MODE_COMPONENTWISE_SCALE
and even for UFBX_INHERIT_MODE_IGNORE_PARENT_SCALE
.
For componentwise-scale nodes, this will point to parent
, for scale ignoring
nodes this will point to the parent of the nearest componentwise-scaled node
in the parent chain.
Specifies the axis order euler_rotation
is applied in.
Rotation around the local X/Y/Z axes in rotation_order
.
The angles are specified in degrees.
Transform from this node to parent
space.
Equivalent to ufbx_transform_to_matrix(&local_transform)
.
Transform from this node to the world space, ie. multiplying all the
node_to_parent
matrices of the parent chain together.
Transform from the attribute to this node. Does not affect the transforms
of children
!
Equivalent to ufbx_transform_to_matrix(&geometry_transform)
.
Transform from attribute space to world space.
Equivalent to ufbx_matrix_mul(&node_to_world, &geometry_to_node)
.
Transform from this node to world space, ignoring self scaling.
Translation applied between parent and self
Rotation applied between parent and self
Scaling applied between parent and self
Rotation applied in local space at the end
Scaling applied in local space at the end
Scaling applied to translation only
Mirror translation and rotation on this axis
bool | visible |
Visibility state.
bool | is_root |
True if this node is the implicit root node of the scene.
True if the node has a non-identity geometry_transform
.
bool | has_adjust_transform |
If true
the transform is adjusted by ufbx, not enabled by default.
See adjust_pre_rotation
, adjust_pre_scale
, adjust_post_rotation
,
and adjust_post_scale
.
Scale is adjusted by root scale.
True if this node is a synthetic geometry transform helper.
bool | is_scale_helper |
True if the node is a synthetic scale compensation helper.
Parent node to children that can compensate for parent scale.
uint32_t | node_depth |
How deep is this node in the parent hierarchy. Root node is at depth 0
and the immediate children of root at 1
.
struct ufbx_vertex_attrib
Vertex attribute: All attributes are stored in a consistent indexed format regardless of how it's actually stored in the file.
values
is a contiguous array of attribute values.
indices
maps each mesh index into a value in the values
array.
If unique_per_vertex
is set then the attribute is guaranteed to have a
single defined value per vertex accessible via:
attrib.values.data[attrib.indices.data[mesh->vertex_first_index[vertex_ix]]
bool | exists |
Is this attribute defined by the mesh.
List of values the attribute uses.
Indices into values[]
, indexed up to ufbx_mesh.num_indices
.
size_t | value_reals |
Number of ufbx_real
entries per value.
bool | unique_per_vertex |
true
if this attribute is defined per vertex, instead of per index.
Optional 4th 'W' component for the attribute.
May be defined for the following:
ufbx_mesh.vertex_normal ufbx_mesh.vertex_tangent / ufbx_uv_set.vertex_tangent ufbx_mesh.vertex_bitangent / ufbx_uv_set.vertex_bitangent
This is not loaded by default, set ufbx_load_opts.retain_vertex_attrib_w
.
struct ufbx_vertex_real
1D vertex attribute, see ufbx_vertex_attrib
for information
bool | exists |
ufbx_real_list | values |
ufbx_uint32_list | indices |
size_t | value_reals |
bool | unique_per_vertex |
ufbx_real_list | values_w |
struct ufbx_vertex_vec2
2D vertex attribute, see ufbx_vertex_attrib
for information
bool | exists |
ufbx_vec2_list | values |
ufbx_uint32_list | indices |
size_t | value_reals |
bool | unique_per_vertex |
ufbx_real_list | values_w |
struct ufbx_vertex_vec3
3D vertex attribute, see ufbx_vertex_attrib
for information
bool | exists |
ufbx_vec3_list | values |
ufbx_uint32_list | indices |
size_t | value_reals |
bool | unique_per_vertex |
ufbx_real_list | values_w |
struct ufbx_vertex_vec4
4D vertex attribute, see ufbx_vertex_attrib
for information
bool | exists |
ufbx_vec4_list | values |
ufbx_uint32_list | indices |
size_t | value_reals |
bool | unique_per_vertex |
ufbx_real_list | values_w |
struct ufbx_uv_set
Vertex UV set/layer
ufbx_string | name |
uint32_t | index |
UV / texture coordinates
(optional) Tangent vector in UV.x direction
(optional) Tangent vector in UV.y direction
struct ufbx_color_set
Vertex color set/layer
ufbx_string | name |
uint32_t | index |
Per-vertex RGBA color
struct ufbx_uv_set_list
ufbx_uv_set* | data |
size_t | count |
struct ufbx_color_set_list
ufbx_color_set* | data |
size_t | count |
struct ufbx_edge
struct ufbx_edge_list
struct ufbx_face
Polygonal face with arbitrary number vertices, a single face contains a
contiguous range of mesh indices, eg. {5,3}
would have indices 5, 6, 7
num_indices
maybe less than 3 in which case the face is invalid!
uint32_t | index_begin |
uint32_t | num_indices |
struct ufbx_face_list
struct ufbx_mesh_part
Subset of mesh faces used by a single material or group.
uint32_t | index |
Index of the mesh part.
size_t | num_faces |
Number of faces (polygons)
size_t | num_triangles |
Number of triangles if triangulated
size_t | num_empty_faces |
Number of faces with zero vertices
size_t | num_point_faces |
Number of faces with a single vertex
size_t | num_line_faces |
Number of faces with two vertices
struct ufbx_mesh_part_list
ufbx_mesh_part* | data |
size_t | count |
struct ufbx_face_group
int32_t | id |
Numerical ID for this group.
Name for the face group.
struct ufbx_face_group_list
ufbx_face_group* | data |
size_t | count |
struct ufbx_subdivision_weight_range
uint32_t | weight_begin |
uint32_t | num_weights |
struct ufbx_subdivision_weight_range_list
ufbx_subdivision_weight_range* | data |
size_t | count |
struct ufbx_subdivision_weight
struct ufbx_subdivision_weight_list
ufbx_subdivision_weight* | data |
size_t | count |
struct ufbx_subdivision_result
size_t | result_memory_used |
size_t | temp_memory_used |
size_t | result_allocs |
size_t | temp_allocs |
ufbx_subdivision_weight_range_list | source_vertex_ranges |
ufbx_subdivision_weight_list | source_vertex_weights |
Weights of vertices in the source model.
Defined if ufbx_subdivide_opts.evaluate_source_vertices
is set.
ufbx_subdivision_weight_range_list | skin_cluster_ranges |
ufbx_subdivision_weight_list | skin_cluster_weights |
Weights of skin clusters in the source model.
Defined if ufbx_subdivide_opts.evaluate_skin_weights
is set.
enum ufbx_subdivision_boundary
OpenSubdiv: VTX_BOUNDARY_EDGE_AND_CORNER
/ FVAR_LINEAR_CORNERS_ONLY
OpenSubdiv: VTX_BOUNDARY_EDGE_ONLY
/ FVAR_LINEAR_NONE
OpenSubdiv: FVAR_LINEAR_BOUNDARIES
OpenSubdiv: FVAR_LINEAR_ALL
struct ufbx_mesh
Polygonal mesh geometry.
Example mesh with two triangles (x, z) and a quad (y). The faces have a constant UV coordinate x/y/z. The vertices have per vertex normals that point up/down.
^ ^ ^ A---B-----C |x / /| | / y / | |/ / z| D-----E---F v v v
Attributes may have multiple values within a single vertex, for example a
UV seam vertex has two UV coordinates. Thus polygons are defined using
an index that counts each corner of each face polygon. If an attribute is
defined (even per-vertex) it will always have a valid indices
array.
{0,3} {3,4} {7,3} faces ({ index_begin, num_indices }) 0 1 2 3 4 5 6 7 8 9 index 0 1 3 1 2 4 3 2 4 5 vertex_indices[index] A B D B C E D C E F vertices[vertex_indices[index]] 0 0 1 0 0 1 1 0 1 1 vertex_normal.indices[index] ^ ^ v ^ ^ v v ^ v v vertex_normal.data[vertex_normal.indices[index]] 0 0 0 1 1 1 1 2 2 2 vertex_uv.indices[index] x x x y y y y z z z vertex_uv.data[vertex_uv.indices[index]]
Vertex position can also be accessed uniformly through an accessor:
0 1 3 1 2 4 3 2 4 5 vertex_position.indices[index] A B D B C E D C E F vertex_position.data[vertex_position.indices[index]]
Some geometry data is specified per logical vertex. Vertex positions are
the only attribute that is guaranteed to be defined uniquely per vertex.
Vertex attributes may be defined per vertex if unique_per_vertex == true
.
You can access the per-vertex values by first finding the first index that
refers to the given vertex.
0 1 2 3 4 5 vertex A B C D E F vertices[vertex] 0 1 4 2 5 9 vertex_first_index[vertex] 0 0 0 1 1 1 vertex_normal.indices[vertex_first_index[vertex]] ^ ^ ^ v v v vertex_normal.data[vertex_normal.indices[vertex_first_index[vertex]]]
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
size_t | num_vertices |
Number of logical "vertex" points
size_t | num_indices |
Number of combiend vertex/attribute tuples
size_t | num_faces |
Number of faces (polygons) in the mesh
size_t | num_triangles |
Number of triangles if triangulated
size_t | num_edges |
Number of edges in the mesh.
May be zero in valid meshes if the file doesn't contain edge adjacency data!
size_t | max_face_triangles |
Maximum number of triangles in a face in this mesh
size_t | num_empty_faces |
Number of faces with zero vertices
size_t | num_point_faces |
Number of faces with a single vertex
size_t | num_line_faces |
Number of faces with two vertices
Face index range
Should the face have soft normals
Face polygon group index, indices to ufbx_mesh.face_groups[]
Should the face be hidden as a "hole"
Edge index range
Should the edge have soft normals
Crease value for subdivision surfaces
Should the edge be visible
Logical vertices and positions, alternatively you can use
vertex_position
for consistent interface with other attributes.
First index referring to a given vertex, UFBX_NO_INDEX
if the vertex is unused.
Vertex positions
(optional) Normal vectors, always defined if ufbx_load_opts.generate_missing_normals
(optional) UV / texture coordinates
(optional) Tangent vector in UV.x direction
(optional) Tangent vector in UV.y direction
(optional) Per-vertex RGBA color
(optional) Crease value for subdivision surfaces
Multiple named UV/color sets
The first set contains the same data as vertex_uv/color
!
Face groups for this mesh.
Segments that use a given material.
Defined even if the mesh doesn't have any materials.
Segments for each face group.
Order of material_parts
by first face that refers to it.
Useful for compatibility with FBX SDK and various importers using it, as they use this material order by default.
Skinned vertex positions, for efficiency the skinned positions are the
same as the static ones for non-skinned meshes and skinned_is_local
is set to true meaning you need to transform them manually using
ufbx_transform_position(&node->geometry_to_world, skinned_pos)
!
ufbx_skin_deformer_list | skin_deformers |
ufbx_blend_deformer_list | blend_deformers |
ufbx_cache_deformer_list | cache_deformers |
ufbx_element_list | all_deformers |
Deformers
Subdivision
bool | reversed_winding |
The winding of the faces has been reversed.
bool | generated_normals |
Normals have been generated instead of evaluated.
Either from missing normals (via ufbx_load_opts.generate_missing_normals
), skinning,
tessellation, or subdivision.
Subdivision (result)
Tessellation (result)
enum ufbx_light_type
The kind of light source
Single point at local origin, at node->world_transform.position
Infinite directional light pointing locally towards light->local_direction
For global: ufbx_transform_direction(&node->node_to_world, light->local_direction)
Cone shaped light towards light->local_direction
, between light->inner/outer_angle
.
For global: ufbx_transform_direction(&node->node_to_world, light->local_direction)
Area light, shape specified by light->area_shape
Volumetric light source
enum ufbx_light_decay
How fast does the light intensity decay at a distance
UFBX_LIGHT_DECAY_NONE |
1 (no decay) |
UFBX_LIGHT_DECAY_LINEAR |
1 / d |
UFBX_LIGHT_DECAY_QUADRATIC |
1 / d2 (physically accurate) |
UFBX_LIGHT_DECAY_CUBIC |
1 / d3 |
UFBX_LIGHT_DECAY_COUNT |
struct ufbx_light
Light source attached to a ufbx_node
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
Color and intensity of the light, usually you want to use color * intensity
intensity
is 0.01x of the property "Intensity"
as that matches
matches values in DCC programs before exporting.
Direction the light is aimed at in node's local space, usually -Y
ufbx_light_type | type |
ufbx_light_decay | decay |
ufbx_light_area_shape | area_shape |
ufbx_real | inner_angle |
ufbx_real | outer_angle |
Type of the light and shape parameters
bool | cast_light |
bool | cast_shadows |
enum ufbx_projection_mode
Perspective projection.
Orthographic projection.
enum ufbx_aspect_mode
Method of specifying the rendering resolution from properties
Handled internally by ufbx, ignore unless you interpret ufbx_props
directly!
No defined resolution
"AspectWidth"
and "AspectHeight"
are relative to each other
"AspectWidth"
and "AspectHeight"
are both pixels
"AspectWidth"
is pixels, "AspectHeight"
is relative to width
< "AspectHeight"
is pixels, "AspectWidth"
is relative to height
enum ufbx_aperture_mode
Method of specifying the field of view from properties
Handled internally by ufbx, ignore unless you interpret ufbx_props
directly!
Use separate "FieldOfViewX"
and "FieldOfViewY"
as horizontal/vertical FOV angles
Use "FieldOfView"
as horizontal FOV angle, derive vertical angle via aspect ratio
Use "FieldOfView"
as vertical FOV angle, derive horizontal angle via aspect ratio
Compute the field of view from the render gate size and focal length
enum ufbx_gate_fit
Method of specifying the render gate size from properties
Handled internally by ufbx, ignore unless you interpret ufbx_props
directly!
Use the film/aperture size directly as the render gate
Fit the render gate to the height of the film, derive width from aspect ratio
Fit the render gate to the width of the film, derive height from aspect ratio
Fit the render gate so that it is fully contained within the film gate
Fit the render gate so that it fully contains the film gate
Stretch the render gate to match the film gate
enum ufbx_aperture_format
Camera film/aperture size defaults
Handled internally by ufbx, ignore unless you interpret ufbx_props
directly!
UFBX_APERTURE_FORMAT_CUSTOM |
Use |
UFBX_APERTURE_FORMAT_16MM_THEATRICAL |
0.404 x 0.295 inches |
UFBX_APERTURE_FORMAT_SUPER_16MM |
0.493 x 0.292 inches |
UFBX_APERTURE_FORMAT_35MM_ACADEMY |
0.864 x 0.630 inches |
UFBX_APERTURE_FORMAT_35MM_TV_PROJECTION |
0.816 x 0.612 inches |
UFBX_APERTURE_FORMAT_35MM_FULL_APERTURE |
0.980 x 0.735 inches |
UFBX_APERTURE_FORMAT_35MM_185_PROJECTION |
0.825 x 0.446 inches |
UFBX_APERTURE_FORMAT_35MM_ANAMORPHIC |
0.864 x 0.732 inches (squeeze ratio: 2) |
UFBX_APERTURE_FORMAT_70MM_PROJECTION |
2.066 x 0.906 inches |
UFBX_APERTURE_FORMAT_VISTAVISION |
1.485 x 0.991 inches |
UFBX_APERTURE_FORMAT_DYNAVISION |
2.080 x 1.480 inches |
UFBX_APERTURE_FORMAT_IMAX |
2.772 x 2.072 inches |
UFBX_APERTURE_FORMAT_COUNT |
enum ufbx_coordinate_axis
struct ufbx_coordinate_axes
Coordinate axes the scene is represented in.
front
is the opposite from forward!
struct ufbx_camera
Camera attached to a ufbx_node
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
Projection mode (perspective/orthographic).
bool | resolution_is_pixels |
If set to true
, resolution
represents actual pixel values, otherwise
it's only useful for its aspect ratio.
Render resolution, either in pixels or arbitrary units, depending on above
Horizontal/vertical field of view in degrees
Valid if projection_mode == UFBX_PROJECTION_MODE_PERSPECTIVE
.
Component-wise tan(field_of_view_deg)
, also represents the size of the
proection frustum slice at distance of 1.
Valid if projection_mode == UFBX_PROJECTION_MODE_PERSPECTIVE
.
Orthographic camera extents.
Valid if projection_mode == UFBX_PROJECTION_MODE_ORTHOGRAPHIC
.
Orthographic camera size.
Valid if projection_mode == UFBX_PROJECTION_MODE_ORTHOGRAPHIC
.
Size of the projection plane at distance 1.
Equal to field_of_view_tan
if perspective, orthographic_size
if orthographic.
Aspect ratio of the camera.
Near plane of the frustum in units from the camera.
Coordinate system that the projection uses.
FBX saves cameras with +X forward and +Y up, but you can override this using
ufbx_load_opts.target_camera_axes
and it will be reflected here.
ufbx_aspect_mode | aspect_mode |
ufbx_aperture_mode | aperture_mode |
ufbx_gate_fit | gate_fit |
ufbx_aperture_format | aperture_format |
Advanced properties used to compute the above
Focal length in millimeters
Film size in inches
Aperture/film gate size in inches
Anamoprhic stretch ratio
struct ufbx_bone
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
Length of the bone relative to the distance between two nodes
bool | is_root |
Is the bone a root bone
struct ufbx_empty
Empty/NULL/locator connected to a node, actual details in ufbx_node
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
struct ufbx_line_segment
Segment of a ufbx_line_curve
, indices refer to ufbx_line_curve.point_indices[]
uint32_t | index_begin |
uint32_t | num_indices |
struct ufbx_line_segment_list
ufbx_line_segment* | data |
size_t | count |
struct ufbx_line_curve
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
List of possible values the line passes through
Indices to control_points[]
the line goes through
Tessellation (result)
enum ufbx_nurbs_topology
The endpoints are not connected.
Repeats first ufbx_nurbs_basis.order - 1
control points after the end.
Repeats the first control point after the end.
struct ufbx_nurbs_basis
NURBS basis functions for an axis
uint32_t | order |
Number of control points influencing a point on the curve/surface.
Equal to the degree plus one.
Topology (periodicity) of the dimension.
Subdivision of the parameter range to control points.
Parameter values of control points.
bool | is_2d |
true
if this axis is two-dimensional.
size_t | num_wrap_control_points |
Number of control points that need to be copied to the end.
This is just for convenience as it could be derived from topology
and
order
. If for example num_wrap_control_points == 3
you should repeat
the first 3 control points after the end.
You don't need to worry about this if you use ufbx functions
like ufbx_evaluate_nurbs_curve()
as they handle this internally.
bool | valid |
true
if the parametrization is well defined.
struct ufbx_nurbs_curve
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
Basis in the U axis
Linear array of control points
The control points are not homogeneous, meaning you have to multiply
them by w
before evaluating the surface.
struct ufbx_nurbs_surface
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
Basis in the U/V axes
size_t | num_control_points_u |
size_t | num_control_points_v |
Number of control points for the U/V axes
2D array of control points.
Memory layout: V * num_control_points_u + U
The control points are not homogeneous, meaning you have to multiply
them by w
before evaluating the surface.
uint32_t | span_subdivision_u |
uint32_t | span_subdivision_v |
How many segments tessellate each span in ufbx_nurbs_basis.spans
.
bool | flip_normals |
If true
the resulting normals should be flipped when evaluated.
Material for the whole surface.
May be NULL
!
struct ufbx_nurbs_trim_surface
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
struct ufbx_nurbs_trim_boundary
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
struct ufbx_procedural_geometry
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
struct ufbx_stereo_camera
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
struct ufbx_camera_switcher
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
enum ufbx_marker_type
UFBX_MARKER_UNKNOWN |
Unknown marker type |
UFBX_MARKER_FK_EFFECTOR |
FK (Forward Kinematics) effector |
UFBX_MARKER_IK_EFFECTOR |
IK (Inverse Kinematics) effector |
UFBX_MARKER_TYPE_COUNT |
struct ufbx_marker
Tracking marker for effectors
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
Type of the marker
enum ufbx_lod_display
LOD level display mode.
UFBX_LOD_DISPLAY_USE_LOD |
Display the LOD level if the distance is appropriate. |
UFBX_LOD_DISPLAY_SHOW |
Always display the LOD level. |
UFBX_LOD_DISPLAY_HIDE |
Never display the LOD level. |
UFBX_LOD_DISPLAY_COUNT |
struct ufbx_lod_level
Single LOD level within an LOD group.
Specifies properties of the Nth child of the node containing the LOD group.
Minimum distance to show this LOD level.
In world units by default, or in screen percentage if
ufbx_lod_group.relative_distances
is set.
LOD display mode.
Mostly for editing, you should probably ignore this unless making a modeling program.
struct ufbx_lod_level_list
ufbx_lod_level* | data |
size_t | count |
struct ufbx_lod_group
Group of LOD (Level of Detail) levels for an object.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_node_list | instances |
bool | relative_distances |
If set to true
, ufbx_lod_level.distance
represents a screen size percentage.
If set to true
don't account for parent transform when computing the distance.
If use_distance_limit
is enabled hide the group if the distance is not between
distance_limit_min
and distance_limit_max
.
enum ufbx_skinning_method
Method to evaluate the skinning on a per-vertex level
Linear blend skinning: Blend transformation matrices by vertex weights
One vertex should have only one bone attached
Convert the transformations to dual quaternions and blend in that space
Blend between UFBX_SKINNING_METHOD_LINEAR
and UFBX_SKINNING_METHOD_BLENDED_DQ_LINEAR
The blend weight can be found either per-vertex in ufbx_skin_vertex.dq_weight
or in ufbx_skin_deformer.dq_vertices/dq_weights
(indexed by vertex).
struct ufbx_skin_vertex
Skin weight information for a single mesh vertex
uint32_t | weight_begin |
Index to start from in the weights[]
array
uint32_t | num_weights |
Number of weights influencing the vertex
Blend weight between Linear Blend Skinning (0.0) and Dual Quaternion (1.0).
Should be used if skinning_method == UFBX_SKINNING_METHOD_BLENDED_DQ_LINEAR
struct ufbx_skin_vertex_list
ufbx_skin_vertex* | data |
size_t | count |
struct ufbx_skin_weight
Single per-vertex per-cluster weight, see ufbx_skin_vertex
uint32_t | cluster_index |
Index into ufbx_skin_deformer.clusters[]
struct ufbx_skin_weight_list
ufbx_skin_weight* | data |
size_t | count |
struct ufbx_skin_deformer
Skin deformer specifies a binding between a logical set of bones (a skeleton)
and a mesh. Each bone is represented by a ufbx_skin_cluster
that contains
the binding matrix and a ufbx_node *bone
that has the current transformation.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Clusters (bones) in the skin
Per-vertex weight information
size_t | max_weights_per_vertex |
Largest amount of weights a single vertex can have
Blend weights between Linear Blend Skinning (0.0) and Dual Quaternion (1.0).
You probably want to use vertices
and ufbx_skin_vertex.dq_weight
instead!
These may be out-of-bounds for a given mesh, vertices
is always safe.
struct ufbx_skin_cluster
Cluster of vertices bound to a single bone.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
The bone node the cluster is attached to
Always valid if found from ufbx_skin_deformer.clusters[]
unless
ufbx_load_opts.connect_broken_elements
is true
.
Binding matrix from local mesh vertices to the bone
Binding matrix from local mesh node to the bone.
Prefer geometry_to_bone
in most use cases!
Matrix that specifies the rest/bind pose transform of the node,
not generally needed for skinning, use geometry_to_bone
instead.
Precomputed matrix/transform that accounts for the current bone transform
ie. ufbx_matrix_mul(&cluster->bone->node_to_world, &cluster->geometry_to_bone)
size_t | num_weights |
Number of vertices in the cluster
Per-vertex weight values
struct ufbx_blend_deformer
Blend shape deformer can contain multiple channels (think of sliders between morphs) that may optionally have in-between keyframes.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Independent morph targets of the deformer.
struct ufbx_blend_keyframe
Blend shape associated with a target weight in a series of morphs
The target blend shape offsets.
Weight value at which to apply the keyframe at full strength
The weight the shape should be currently applied with
struct ufbx_blend_keyframe_list
ufbx_blend_keyframe* | data |
size_t | count |
struct ufbx_blend_channel
Blend channel consists of multiple morph-key targets that are interpolated.
In simple cases there will be only one keyframe that is the target shape.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Key morph targets to blend between depending on weight
In usual cases there's only one target per channel
Final blend shape ignoring any intermediate blend shapes.
struct ufbx_blend_shape
Blend shape target containing the actual vertex offsets
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
size_t | num_offsets |
Number of vertex offsets in the following arrays
Always specified per-vertex offsets
Empty if not specified
enum ufbx_cache_file_format
UFBX_CACHE_FILE_FORMAT_UNKNOWN |
Unknown cache file format |
UFBX_CACHE_FILE_FORMAT_PC2 |
.pc2 Point cache file |
UFBX_CACHE_FILE_FORMAT_MC |
.mc/.mcx Maya cache file |
UFBX_CACHE_FILE_FORMAT_COUNT |
enum ufbx_cache_data_format
UFBX_CACHE_DATA_FORMAT_UNKNOWN |
Unknown data format |
UFBX_CACHE_DATA_FORMAT_REAL_FLOAT |
|
UFBX_CACHE_DATA_FORMAT_VEC3_FLOAT |
|
UFBX_CACHE_DATA_FORMAT_REAL_DOUBLE |
|
UFBX_CACHE_DATA_FORMAT_VEC3_DOUBLE |
|
UFBX_CACHE_DATA_FORMAT_COUNT |
enum ufbx_cache_data_encoding
UFBX_CACHE_DATA_ENCODING_UNKNOWN |
Unknown data encoding |
UFBX_CACHE_DATA_ENCODING_LITTLE_ENDIAN |
Contiguous little-endian array |
UFBX_CACHE_DATA_ENCODING_BIG_ENDIAN |
Contiguous big-endian array |
UFBX_CACHE_DATA_ENCODING_COUNT |
enum ufbx_cache_interpretation
Known interpretations of geometry cache data.
Unknown interpretation, see ufbx_cache_channel.interpretation_name
for more information.
Generic "points" interpretation, FBX SDK default. Usually fine to interpret as vertex positions if no other cache channels are specified.
Vertex positions.
Vertex normals.
struct ufbx_cache_frame
Name of the channel this frame belongs to.
double | time |
Time of this frame in seconds.
Name of the file containing the data.
The specified file may contain multiple frames, use data_offset
etc. to
read at the right position.
Format of the wrapper file.
Axis to mirror the read data by.
Factor to scale the geometry by.
Format of the data in the file
Binary encoding of the data
uint64_t | data_offset |
Byte offset into the file
uint32_t | data_count |
Number of data elements
uint32_t | data_element_bytes |
Size of a single data element in bytes
uint64_t | data_total_bytes |
Size of the whole data blob in bytes
struct ufbx_cache_frame_list
ufbx_cache_frame* | data |
size_t | count |
struct ufbx_cache_channel
Name of the geometry cache channel.
What does the data in this channel represent.
Source name for interpretation
, especially useful if interpretation
is
UFBX_CACHE_INTERPRETATION_UNKNOWN
.
List of frames belonging to this channel.
Sorted by time (ufbx_cache_frame.time
).
Axis to mirror the frames by.
Factor to scale the geometry by.
struct ufbx_cache_channel_list
ufbx_cache_channel* | data |
size_t | count |
struct ufbx_geometry_cache
struct ufbx_cache_deformer
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Only valid if ufbx_load_opts.load_external_files
is set!
struct ufbx_cache_file
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Filename relative to the currently loaded file.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file.
Relative filename specified in the file.
May be absolute if the file is saved in a different drive.
Filename relative to the loaded file, non-UTF-8 encoded.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file, non-UTF-8 encoded.
Relative filename specified in the file, non-UTF-8 encoded.
May be absolute if the file is saved in a different drive.
Only valid if ufbx_load_opts.load_external_files
is set!
struct ufbx_material_map
Material property, either specified with a constant value or a mapped texture
Constant value or factor for the map.
May be specified simultaneously with a texture, in this case most shading models use multiplicative tinting of the texture values.
int64_t | value_int |
Texture if connected, otherwise NULL
.
May be valid but "disabled" (application specific) if texture_enabled == false
.
bool | has_value |
true
if the file has specified any of the values above.
The value may be set to a non-zero default even if has_value == false
,
for example missing factors are set to 1.0
if a color is defined.
bool | texture_enabled |
Controls whether shading should use texture
.
Some shading models allow this to be true
even if texture == NULL
.
bool | feature_disabled |
Set to true
if this feature should be disabled (specific to shader type).
uint8_t | value_components |
Number of components in the value from 1 to 4 if defined, 0 if not.
struct ufbx_material_feature_info
Material feature
bool | enabled |
Whether the material model uses this feature or not.
The feature can be enabled but still not used if eg. the corresponding factor is at zero!
bool | is_explicit |
Explicitly enabled/disabled by the material.
struct ufbx_material_texture
Texture attached to an FBX property
Name of the property in ufbx_material.props
Shader-specific property mapping name
Texture attached to the property.
struct ufbx_material_texture_list
ufbx_material_texture* | data |
size_t | count |
enum ufbx_shader_type
Shading model type
Unknown shading model
FBX builtin diffuse material
FBX builtin diffuse+specular material
Open Shading Language standard surface https://github.com/Autodesk/standard-surface
Arnold standard surface https://docs.arnoldrenderer.com/display/A5AFMUG/Standard+Surface
Stingray ShaderFX shader graph.
Contains a serialized "ShaderGraph"
in ufbx_props
.
Variation of the FBX phong shader that can recover PBR properties like
metalness
or roughness
from the FBX non-physical values.
Wavefront .mtl format shader (used by .obj files)
enum ufbx_material_fbx_map
FBX builtin material properties, matches maps in ufbx_material_fbx_maps
enum ufbx_material_pbr_map
Known PBR material properties, matches maps in ufbx_material_pbr_maps
enum ufbx_material_feature
Known material features
struct ufbx_material_fbx_maps
struct ufbx_material_pbr_maps
struct ufbx_material_features
struct ufbx_material
Surface material properties such as color, roughness, etc. Each property may
be optionally bound to an ufbx_texture
.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
FBX builtin properties
These may be empty if the material is using a custom shader
PBR material properties, defined for all shading models but may be
somewhat approximate if shader == NULL
.
Material features, primarily applies to pbr
.
Always defined
Optional extended shader information
Often one of { "lambert", "phong", "unknown" }
Prefix before shader property names with trailing |
.
For example "3dsMax|Parameters|"
where properties would have names like
"3dsMax|Parameters|base_color"
. You can ignore this if you use the built-in
ufbx_material_fbx_maps fbx
and ufbx_material_pbr_maps pbr
structures.
Sorted by material_prop
enum ufbx_texture_type
Texture associated with an image file/sequence. texture->filename
and
and texture->relative_filename
contain the texture's path. If the file
has embedded content texture->content
may hold texture->content_size
bytes of raw image data.
The texture consists of multiple texture layers blended together.
Reserved as these should exist in FBX files.
Node in a shader graph.
Use ufbx_texture.shader
for more information.
enum ufbx_blend_mode
Blend modes to combine layered textures with, compatible with common blend
mode definitions in many art programs. Simpler blend modes have equations
specified below where src
is the layer to composite over dst
.
See eg. https://www.w3.org/TR/2013/WD-compositing-1-20131010/#blendingseparable
UFBX_BLEND_TRANSLUCENT |
|
UFBX_BLEND_ADDITIVE |
|
UFBX_BLEND_MULTIPLY |
|
UFBX_BLEND_MULTIPLY_2X |
|
UFBX_BLEND_OVER |
|
UFBX_BLEND_REPLACE |
|
UFBX_BLEND_DISSOLVE |
|
UFBX_BLEND_DARKEN |
|
UFBX_BLEND_COLOR_BURN |
|
UFBX_BLEND_LINEAR_BURN |
|
UFBX_BLEND_DARKER_COLOR |
|
UFBX_BLEND_LIGHTEN |
|
UFBX_BLEND_SCREEN |
|
UFBX_BLEND_COLOR_DODGE |
|
UFBX_BLEND_LINEAR_DODGE |
|
UFBX_BLEND_LIGHTER_COLOR |
|
UFBX_BLEND_SOFT_LIGHT | |
UFBX_BLEND_HARD_LIGHT | |
UFBX_BLEND_VIVID_LIGHT |
Combination of |
UFBX_BLEND_LINEAR_LIGHT |
Combination of |
UFBX_BLEND_PIN_LIGHT |
Combination of |
UFBX_BLEND_HARD_MIX |
Produces primary colors depending on similarity |
UFBX_BLEND_DIFFERENCE |
|
UFBX_BLEND_EXCLUSION |
|
UFBX_BLEND_SUBTRACT |
|
UFBX_BLEND_DIVIDE |
|
UFBX_BLEND_HUE |
Replace hue |
UFBX_BLEND_SATURATION |
Replace saturation |
UFBX_BLEND_COLOR |
Replace hue and saturatio |
UFBX_BLEND_LUMINOSITY |
Replace value |
UFBX_BLEND_OVERLAY |
Same as |
UFBX_BLEND_MODE_COUNT |
enum ufbx_wrap_mode
Blend modes to combine layered textures with, compatible with common blend
UFBX_WRAP_REPEAT |
Repeat the texture past the [0,1] range |
UFBX_WRAP_CLAMP |
Clamp the normalized texture coordinates to [0,1] |
UFBX_WRAP_MODE_COUNT |
struct ufbx_texture_layer
Single layer in a layered texture
The inner texture to evaluate, never NULL
Equation to combine the layer to the background
struct ufbx_texture_layer_list
ufbx_texture_layer* | data |
size_t | count |
enum ufbx_shader_texture_type
Select an output of a multi-output shader.
If this type is used the ufbx_shader_texture.main_texture
and
ufbx_shader_texture.main_texture_output_index
fields are set.
Open Shading Language (OSL) shader.
struct ufbx_shader_texture_input
Input to a shader texture, see ufbx_shader_texture
.
Name of the input.
Constant value of the input.
int64_t | value_int |
ufbx_string | value_str |
ufbx_blob | value_blob |
Texture connected to this input.
int64_t | texture_output_index |
Index of the output to use if texture
is a multi-output shader node.
bool | texture_enabled |
Controls whether shading should use texture
.
Some shading models allow this to be true
even if texture == NULL
.
Property representing texture
.
Property representing texture_enabled
.
struct ufbx_shader_texture_input_list
ufbx_shader_texture_input* | data |
size_t | count |
struct ufbx_shader_texture
Texture that emulates a shader graph node.
3ds Max exports some materials as node graphs serialized to textures. ufbx can parse a small subset of these, as normal maps are often hidden behind some kind of bump node.
These encode a lot of details of 3ds Max internals, not recommended for direct use.
ufbx_texture.file_textures[]
contains a list of "real" textures that are connected
to the ufbx_texture
that is pretending to be a shader node.
Type of this shader node.
Name of the shader to use.
uint64_t | shader_type_id |
64-bit opaque identifier for the shader type.
Input values/textures (possibly further shader textures) to the shader.
Sorted by ufbx_shader_texture_input.name
.
Shader source code if found.
Representative texture for this shader.
Only specified if main_texture.outputs[main_texture_output_index]
is semantically
equivalent to this texture.
int64_t | main_texture_output_index |
Output index of main_texture
if it is a multi-output shader.
Prefix for properties related to this shader in ufbx_texture
.
Contains the trailing '|' if not empty.
struct ufbx_texture_file
Unique texture within the file.
uint32_t | index |
Index in ufbx_scene.texture_files[]
.
Filename relative to the currently loaded file.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file.
Relative filename specified in the file.
May be absolute if the file is saved in a different drive.
Filename relative to the loaded file, non-UTF-8 encoded.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file, non-UTF-8 encoded.
Relative filename specified in the file, non-UTF-8 encoded.
May be absolute if the file is saved in a different drive.
struct ufbx_texture_file_list
ufbx_texture_file* | data |
size_t | count |
struct ufbx_texture
Texture that controls material appearance
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Texture type (file / layered / procedural / shader)
Filename relative to the currently loaded file.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file.
Relative filename specified in the file.
May be absolute if the file is saved in a different drive.
Filename relative to the loaded file, non-UTF-8 encoded.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file, non-UTF-8 encoded.
Relative filename specified in the file, non-UTF-8 encoded.
May be absolute if the file is saved in a different drive.
FILE: Optional video texture
uint32_t | file_index |
FILE: Index into ufbx_scene.texture_files[]
or UFBX_NO_INDEX
.
bool | has_file |
FILE: True if file_index
has a valid value.
LAYERED: Inner texture layers, ordered from bottom to top
SHADER: Shader information
May be specified even if type == UFBX_TEXTURE_FILE
if ufbx_load_opts.disable_quirks
is not specified. Some known shaders that represent files are interpreted as UFBX_TEXTURE_FILE
.
List of file textures representing this texture.
Defined even if type == UFBX_TEXTURE_FILE
in which case the array contains only itself.
Name of the UV set to use
Wrapping mode
bool | has_uv_transform |
Has a non-identity transform
and derived matrices.
Texture transformation in UV space
Matrix representation of transform
UV coordinate to normalized texture coordinate matrix
struct ufbx_video
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Filename relative to the currently loaded file.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file.
Relative filename specified in the file.
May be absolute if the file is saved in a different drive.
Filename relative to the loaded file, non-UTF-8 encoded.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file, non-UTF-8 encoded.
Relative filename specified in the file, non-UTF-8 encoded.
May be absolute if the file is saved in a different drive.
struct ufbx_shader
Shader specifies a shading model and contains ufbx_shader_binding
elements
that define how to interpret FBX properties in the shader.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Known shading model
Bindings from FBX properties to the shader
ufbx_find_shader_prop()
translates shader properties to FBX properties
struct ufbx_shader_prop_binding
Binding from a material property to shader implementation
Property name used by the shader implementation
Property name inside ufbx_material.props
struct ufbx_shader_prop_binding_list
ufbx_shader_prop_binding* | data |
size_t | count |
struct ufbx_shader_binding
Shader binding table
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Sorted by shader_prop
struct ufbx_prop_override
uint32_t | element_id |
struct ufbx_prop_override_list
ufbx_prop_override* | data |
size_t | count |
struct ufbx_transform_override
uint32_t | node_id |
ufbx_transform | transform |
struct ufbx_transform_override_list
ufbx_transform_override* | data |
size_t | count |
struct ufbx_anim
Animation descriptor used for evaluating animation.
Usually obtained from ufbx_scene
via either global animation ufbx_scene.anim
,
per-stack animation ufbx_anim_stack.anim
or per-layer animation ufbx_anim_layer.anim
.
For advanced usage you can use ufbx_create_anim()
to create animation descriptors
with custom layers, property overrides, special flags, etc.
double | time_begin |
double | time_end |
Time begin/end for the animation, both may be zero if absent.
List of layers in the animation.
Optional overrides for weights for each layer in layers[]
.
Sorted by element_id, prop_name
Sorted by node_id
bool | ignore_connections |
Evaluate connected properties as if they would not be connected.
bool | custom |
Custom ufbx_anim
created by ufbx_create_anim()
.
struct ufbx_anim_stack
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
double | time_begin |
double | time_end |
struct ufbx_anim_prop_list
ufbx_anim_prop* | data |
size_t | count |
struct ufbx_anim_layer
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
ufbx_real | weight |
bool | weight_is_animated |
bool | blended |
bool | additive |
bool | compose_rotation |
bool | compose_scale |
Sorted by element,prop_name
struct ufbx_anim_value
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
enum ufbx_interpolation
Animation curve segment interpolation mode between two keyframes
UFBX_INTERPOLATION_CONSTANT_PREV |
Hold previous key value |
UFBX_INTERPOLATION_CONSTANT_NEXT |
Hold next key value |
UFBX_INTERPOLATION_LINEAR |
Linear interpolation between two keys |
UFBX_INTERPOLATION_CUBIC |
Cubic interpolation, see |
UFBX_INTERPOLATION_COUNT |
struct ufbx_tangent
struct ufbx_keyframe
Single real value
at a specified time
, interpolation between two keyframes
is determined by the interpolation
field of the previous key.
If interpolation == UFBX_INTERPOLATION_CUBIC
the span is evaluated as a
cubic bezier curve through the following points:
(prev->time, prev->value) (prev->time + prev->right.dx, prev->value + prev->right.dy) (next->time - next->left.dx, next->value - next->left.dy) (next->time, next->value)
You can use ufbx_evaluate_curve(ufbx_anim_curve *curve, double time)
rather than trying to manually handle all the interpolation modes.
struct ufbx_keyframe_list
ufbx_keyframe* | data |
size_t | count |
struct ufbx_anim_curve
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
struct ufbx_display_layer
Collection of nodes to hide/freeze
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Nodes included in the layer (exclusively at most one layer per node)
bool | visible |
Contained nodes are visible
bool | frozen |
Contained nodes cannot be edited
struct ufbx_selection_set
Named set of nodes/geometry features to select.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Included nodes and geometry features
struct ufbx_selection_node
Selection state of a node, potentially contains vertex/edge/face selection as well.
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Selection targets, possibly NULL
bool | include_node |
Is target_node
included in the selection
struct ufbx_character
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
enum ufbx_constraint_type
Type of property constrain eg. position or look-at
Inverse kinematic chain to a single effector ufbx_constraint.ik_effector
targets
optionally contains a list of pole targets!
struct ufbx_constraint_target
struct ufbx_constraint_target_list
ufbx_constraint_target* | data |
size_t | count |
enum ufbx_constraint_aim_up_type
Method to determine the up vector in aim constraints
UFBX_CONSTRAINT_AIM_UP_SCENE |
Align the up vector to the scene global up vector |
UFBX_CONSTRAINT_AIM_UP_TO_NODE |
Aim the up vector at |
UFBX_CONSTRAINT_AIM_UP_ALIGN_NODE |
Copy the up vector from |
UFBX_CONSTRAINT_AIM_UP_VECTOR |
Use |
UFBX_CONSTRAINT_AIM_UP_NONE |
Don't align the up vector to anything |
UFBX_CONSTRAINT_AIM_UP_TYPE_COUNT |
enum ufbx_constraint_ik_pole_type
Method to determine the up vector in aim constraints
UFBX_CONSTRAINT_IK_POLE_VECTOR |
Use towards calculated from |
UFBX_CONSTRAINT_IK_POLE_NODE |
Use |
UFBX_CONSTRAINT_IK_POLE_TYPE_COUNT |
struct ufbx_constraint
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Type of constraint to use
List of weighted targets for the constraint (pole vectors for IK)
bool[3] | constrain_translation |
bool[3] | constrain_rotation |
bool[3] | constrain_scale |
Translation/rotation/scale axes the constraint is applied to
Offset from the constrained position
ufbx_vec3 | aim_vector |
ufbx_constraint_aim_up_type | aim_up_type |
ufbx_node* | aim_up_node |
ufbx_vec3 | aim_up_vector |
AIM: Target and up vectors
SINGLE_CHAIN_IK: Target for the IK, targets
contains pole vectors!
struct ufbx_audio_layer
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Clips contained in this layer.
struct ufbx_audio_clip
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
Filename relative to the currently loaded file.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file.
Relative filename specified in the file.
May be absolute if the file is saved in a different drive.
Filename relative to the loaded file, non-UTF-8 encoded.
If using functions other than ufbx_load_file()
, you can provide
ufbx_load_opts.filename/raw_filename
to let ufbx resolve this.
Absolute filename specified in the file, non-UTF-8 encoded.
Relative filename specified in the file, non-UTF-8 encoded.
May be absolute if the file is saved in a different drive.
struct ufbx_bone_pose
Matrix from node local space to world space.
Matrix from node local space to parent space.
FBX only stores world transformations so this is approximated from the parent world transform.
struct ufbx_bone_pose_list
ufbx_bone_pose* | data |
size_t | count |
struct ufbx_pose
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
bool | is_bind_pose |
Set if this pose is marked as a bind pose.
struct ufbx_metadata_object
ufbx_string | name |
ufbx_props | props |
uint32_t | element_id |
uint32_t | typed_id |
struct ufbx_name_element_list
ufbx_name_element* | data |
size_t | count |
enum ufbx_exporter
enum ufbx_file_format
UFBX_FILE_FORMAT_UNKNOWN |
Unknown file format |
UFBX_FILE_FORMAT_FBX |
.fbx Kaydara/Autodesk FBX file |
UFBX_FILE_FORMAT_OBJ |
.obj Wavefront OBJ file |
UFBX_FILE_FORMAT_MTL |
.mtl Wavefront MTL (Material template library) file |
UFBX_FILE_FORMAT_COUNT |
enum ufbx_warning_type
Missing external file file (for example .mtl for Wavefront .obj file or a geometry cache)
Loaded a Wavefront .mtl file derived from the filename instead of a proper
mtllib
statement.
Truncated array has been auto-expanded.
Geometry data has been defined but has no data.
Duplicated connection between two elements that shouldn't have.
Vertex 'W' attribute length differs from main attribute.
Missing polygon mapping type.
Out-of-bounds index has been clamped to be in-bounds.
You can use ufbx_index_error_handling
to adjust behavior.
Non-UTF8 encoded strings.
You can use ufbx_unicode_error_handling
to adjust behavior.
Non-node element connected to root.
Duplicated object ID in the file, connections will be wrong.
Empty face has been removed.
Use ufbx_load_opts.allow_empty_faces
if you want to allow them.
Unknown .obj file directive.
Warnings after this one are deduplicated.
See ufbx_warning.count
for how many times they happened.
struct ufbx_warning
Warning about a non-fatal issue in the file.
Often contains information about issues that ufbx has corrected about the file but it might indicate something is not working properly.
Type of the warning.
Description of the warning.
uint32_t | element_id |
The element related to this warning or UFBX_NO_INDEX
if not related to a specific element.
size_t | count |
Number of times this warning was encountered.
struct ufbx_warning_list
ufbx_warning* | data |
size_t | count |
enum ufbx_thumbnail_format
UFBX_THUMBNAIL_FORMAT_UNKNOWN |
Unknown format |
UFBX_THUMBNAIL_FORMAT_RGB_24 |
8-bit RGB pixels, in memory R,G,B |
UFBX_THUMBNAIL_FORMAT_RGBA_32 |
8-bit RGBA pixels, in memory R,G,B,A |
UFBX_THUMBNAIL_FORMAT_COUNT |
enum ufbx_space_conversion
Specify how unit / coordinate system conversion should be performed.
Affects how ufbx_load_opts.target_axes
and ufbx_load_opts.target_unit_meters
work,
has no effect if neither is specified.
Store the space conversion transform in the root node.
Sets ufbx_node.local_transform
of the root node.
Perform the conversion by using "adjust" transforms.
Compensates for the transforms using ufbx_node.adjust_pre_rotation
and
ufbx_node.adjust_pre_scale
. You don't need to account for these unless
you are manually building transforms from ufbx_props
.
Perform the conversion by scaling geometry in addition to adjusting transforms.
Compensates transforms like UFBX_SPACE_CONVERSION_ADJUST_TRANSFORMS
but
applies scaling to geometry as well.
struct ufbx_thumbnail
Embedded thumbnail in the file, valid if the dimensions are non-zero.
Format of ufbx_thumbnail.data
.
Thumbnail pixel data, layout as contiguous rows from bottom to top.
See ufbx_thumbnail.format
for the pixel format.
struct ufbx_metadata
Miscellaneous data related to the loaded file
List of non-fatal warnings about the file.
If you need to only check whether a specific warning was triggered you
can use ufbx_metadata.has_warning[]
.
bool | ascii |
FBX ASCII file format.
uint32_t | version |
FBX version in integer format, eg. 7400 for 7.4.
File format of the source file.
bool | may_contain_no_index |
Index arrays may contain UFBX_NO_INDEX
instead of a valid index
to indicate gaps.
May contain meshes with no defined vertex position.
ufbx_mesh.vertex_position.exists
may be false
!
Arrays may contain items with NULL
element references.
bool | is_unsafe |
Some API guarantees do not apply (depending on unsafe options used).
Loaded with ufbx_load_opts.allow_unsafe
enabled.
Flag for each possible warning type.
See ufbx_metadata.warnings[]
for detailed warning information.
ufbx_string | creator |
bool | big_endian |
ufbx_exporter | exporter |
uint32_t | exporter_version |
bool | geometry_ignored |
bool | animation_ignored |
bool | embedded_ignored |
size_t | max_face_triangles |
size_t | result_memory_used |
size_t | temp_memory_used |
size_t | result_allocs |
size_t | temp_allocs |
size_t | element_buffer_size |
size_t | num_shader_textures |
int64_t | ktime_second |
One second in internal KTime units
Space conversion method used on the scene.
Transform that has been applied to root for axis/unit conversion.
Axis that the scene has been mirrored by.
All geometry has been mirrored in this axis.
Amount geometry has been scaled.
enum ufbx_time_mode
enum ufbx_time_protocol
enum ufbx_snap_mode
struct ufbx_scene_settings
Global settings: Axes and time/unit scales
Mapping of X/Y/Z axes to world-space directions.
Use ufbx_load_opts.target_axes
to normalize this.
This contains the original axes even if you supply ufbx_load_opts.target_axes
.
How many meters does a single world-space unit represent.
FBX files usually default to centimeters, reported as 0.01
here.
Use ufbx_load_opts.target_unit_meters
to normalize this.
double | frames_per_second |
Frames per second the animation is defined at.
Animation user interface settings.
Use ufbx_scene_settings.frames_per_second
instead of interpreting these yourself.
Original settings (?)
struct ufbx_scene
Global settings
Nodes
ufbx_mesh_list | meshes |
ufbx_light_list | lights |
ufbx_camera_list | cameras |
ufbx_bone_list | bones |
ufbx_empty_list | empties |
Node attributes (common)
Node attributes (curves/surfaces)
ufbx_procedural_geometry_list | procedural_geometries |
ufbx_stereo_camera_list | stereo_cameras |
ufbx_camera_switcher_list | camera_switchers |
ufbx_marker_list | markers |
ufbx_lod_group_list | lod_groups |
Node attributes (advanced)
Deformers
ufbx_material_list | materials |
ufbx_texture_list | textures |
ufbx_video_list | videos |
ufbx_shader_list | shaders |
ufbx_shader_binding_list | shader_bindings |
Materials
ufbx_anim_stack_list | anim_stacks |
ufbx_anim_layer_list | anim_layers |
ufbx_anim_value_list | anim_values |
ufbx_anim_curve_list | anim_curves |
Animation
ufbx_display_layer_list | display_layers |
ufbx_selection_set_list | selection_sets |
ufbx_selection_node_list | selection_nodes |
Collections
Constraints
Miscellaneous
Unique texture files referenced by the scene.
Sorted by id
Sorted by src,src_prop
Sorted by dst,dst_prop
Elements sorted by name, type
Enabled if ufbx_load_opts.retain_dom == true
.
struct ufbx_curve_point
struct ufbx_surface_point
enum ufbx_topo_flags
UFBX_TOPO_NON_MANIFOLD |
Edge with three or more faces |
struct ufbx_topo_edge
uint32_t | index |
Starting index of the edge, always defined
uint32_t | next |
Ending index of the edge / next per-face ufbx_topo_edge
, always defined
uint32_t | prev |
Previous per-face ufbx_topo_edge
, always defined
uint32_t | twin |
ufbx_topo_edge
on the opposite side, UFBX_NO_INDEX
if not found
uint32_t | face |
Index into mesh->faces[]
, always defined
uint32_t | edge |
Index into mesh->edges[]
, UFBX_NO_INDEX
if not found
struct ufbx_vertex_stream
Vertex data array for ufbx_generate_indices()
.
ufbx_generate_indices()
compares the vertices using memcmp()
, so
any padding should be cleared to zero.
void* | data |
Data pointer of shape char[vertex_count][vertex_size]
.
size_t | vertex_count |
Number of vertices in this stream, for sanity checking.
size_t | vertex_size |
Size of a vertex in bytes.
Allocate size
bytes, must be at least 8 byte aligned
Reallocate old_ptr
from old_size
to new_size
If omit alloc_fn
and free_fn
they will be translated to:
`alloc(size)` -> `realloc_fn(user, NULL, 0, size)` `free_fn(ptr, size)` -> `realloc_fn(user, ptr, size, 0)`
Free pointer ptr
(of size
bytes) returned by alloc_fn
or realloc_fn
Free the allocator itself
struct ufbx_allocator
Allocator callbacks and user context
The allocator will be stored to the loaded scene and will be called
again from ufbx_free_scene()
so make sure user
outlives that!
You can use free_allocator_fn()
to free the allocator yourself.
ufbx_alloc_fn* | alloc_fn |
ufbx_realloc_fn* | realloc_fn |
ufbx_free_fn* | free_fn |
ufbx_free_allocator_fn* | free_allocator_fn |
void* | user |
Callback functions, see typedef
s above for information
struct ufbx_allocator_opts
Allocator callbacks
size_t | memory_limit |
Maximum number of bytes to allocate before failing
size_t | allocation_limit |
Maximum number of allocations to attempt before failing
size_t | huge_threshold |
Threshold to swap from batched allocations to individual ones Defaults to 1MB if set to zero
If set to 1
ufbx will allocate everything in the smallest
possible chunks which may be useful for debugging (eg. ASAN)
size_t | max_chunk_size |
Maximum size of a single allocation containing sub-allocations.
Defaults to 16MB if set to zero
The maximum amount of wasted memory depends on max_chunk_size
and
huge_threshold
: each chunk can waste up to huge_threshold
bytes
internally and the last chunk might be incomplete. So for example
with the defaults we can waste around 1MB/16MB = 6.25% overall plus
up to 32MB due to the two incomplete blocks. The actual amounts differ
slightly as the chunks start out at 4kB and double in size each time,
meaning that the maximum fixed overhead (up to 32MB with defaults) is
at most ~30% of the total allocation size.
Try to read up to size
bytes to data
, return the amount of read bytes.
Return SIZE_MAX
to indicate an IO error.
Skip size
bytes in the file.
Get the size of the file.
Return 0
if unknown, UINT64_MAX
if error.
Close the file
struct ufbx_stream
Required
Optional: Will use read_fn()
if missing
Optional
Optional
void* | user |
Context passed to other functions
enum ufbx_open_file_type
UFBX_OPEN_FILE_MAIN_MODEL |
Main model file |
UFBX_OPEN_FILE_GEOMETRY_CACHE |
Unknown geometry cache file |
UFBX_OPEN_FILE_OBJ_MTL |
.mtl material library file |
UFBX_OPEN_FILE_TYPE_COUNT |
typedef uintptr_t | ufbx_open_file_context |
struct ufbx_open_file_info
Context that can be passed to the following functions to use a shared allocator:
Kind of file to load.
Original filename in the file, not resolved or UTF-8 encoded.
Not necessarily NULL-terminated!
Callback for opening an external file from the filesystem
struct ufbx_open_file_cb
ufbx_open_file_fn* | fn |
void* | user |
struct ufbx_open_file_opts
Options for ufbx_open_file()
.
Allocator to allocate the memory with.
The filename is guaranteed to be NULL-terminated.
Memory stream options
struct ufbx_close_memory_cb
ufbx_close_memory_fn* | fn |
void* | user |
struct ufbx_open_memory_opts
Options for ufbx_open_memory()
.
Allocator to allocate the memory with.
Used even if no copy is made to allocate a small metadata block.
bool | no_copy |
Do not copy the memory.
You can use close_cb
to free the memory when the stream is closed.
This means the provided data pointer is referenced after creating the memory stream, make sure the data stays valid until the stream is closed!
Callback to free the memory blob.
struct ufbx_error_frame
Detailed error stack frame
uint32_t | source_line |
ufbx_string | function |
ufbx_string | description |
enum ufbx_error_type
Error causes (and UFBX_ERROR_NONE
for no error).
No error, operation has been performed successfully.
Unspecified error, most likely caused by an invalid FBX file or a file that contains something ufbx can't handle.
File not found.
Empty file.
External file not found.
See ufbx_load_opts.load_external_files
for more information.
Out of memory (allocator returned NULL
).
ufbx_allocator_opts.memory_limit
exhausted.
ufbx_allocator_opts.allocation_limit
exhausted.
File ended abruptly.
IO read error.
eg. returning SIZE_MAX
from ufbx_stream.read_fn
or stdio ferror()
condition.
User cancelled the loading via ufbx_load_opts.progress_cb
returning UFBX_PROGRESS_CANCEL
.
Could not detect file format from file data or filename.
You can supply it manually using ufbx_load_opts.file_format
or use ufbx_load_opts.filename
when using ufbx_load_memory()
to let ufbx guess the format from the extension.
Options struct (eg. ufbx_load_opts
) is not cleared to zero.
Make sure you initialize the structure to zero via eg.
ufbx_load_opts opts = { 0 }; // C ufbx_load_opts opts = { }; // C++
The vertex streams in ufbx_generate_indices()
are empty.
Vertex stream passed to ufbx_generate_indices()
.
Invalid UTF-8 encountered in a file when loading with UFBX_UNICODE_ERROR_HANDLING_ABORT_LOADING
.
Feature needed for the operation has been compiled out.
Attempting to tessellate an invalid NURBS object.
See ufbx_nurbs_basis.valid
.
Out of bounds index in the file when loading with UFBX_INDEX_ERROR_HANDLING_ABORT_LOADING
.
Node is deeper than ufbx_load_opts.node_depth_limit
in the hierarchy.
Error parsing ASCII array in a thread.
Threaded ASCII parsing is slightly more strict than non-threaded, for cursed files,
set ufbx_load_opts.force_single_thread_ascii_parsing
to true
.
Unsafe options specified without enabling ufbx_load_opts.allow_unsafe
.
Duplicated override property in ufbx_create_anim()
struct ufbx_error
Error description with detailed stack trace
You can use ufbx_format_error()
for formatting the error
struct ufbx_progress
uint64_t | bytes_read |
uint64_t | bytes_total |
Called periodically with the current progress
Return false
to cancel further processing
struct ufbx_progress_cb
ufbx_progress_fn* | fn |
void* | user |
struct ufbx_inflate_input
Source data/stream to decompress with ufbx_inflate()
size_t | total_size |
Total size of the data in bytes
void* | buffer |
size_t | buffer_size |
(optional) Temporary buffer, defaults to 256b stack buffer
ufbx_read_fn* | read_fn |
void* | read_user |
(optional) Streaming read function, concatenated after data
(optional) Progress reporting
uint64_t | progress_interval_hint |
Bytes between progress report calls
uint64_t | progress_size_before |
uint64_t | progress_size_after |
(optional) Change the progress scope
bool | no_header |
(optional) No the DEFLATE header
bool | no_checksum |
(optional) No the Adler32 checksum
size_t | internal_fast_bits |
(optional) Force internal fast lookup bit amount
struct ufbx_inflate_retain
Persistent data between ufbx_inflate()
calls
You must set initialized
to false
, but data
may be uninitialized
bool | initialized |
uint64_t[1024] | data |
enum ufbx_index_error_handling
Clamp to a valid value.
Set bad indices to UFBX_NO_INDEX
.
This is the recommended way if you need to deal with files with gaps in information.
If you use this ufbx_get_vertex_TYPE()
functions will return zero
on invalid indices instead of failing.
Fail loading entierely when encountering a bad index.
Pass bad indices through as-is.
Requires ufbx_load_opts.allow_unsafe
.
UNSAFE: Breaks any API guarantees regarding indexes being in bounds and makes
ufbx_get_vertex_TYPE()
memory-unsafe to use.
enum ufbx_unicode_error_handling
Replace errors with U+FFFD "Replacement Character"
Replace errors with '_' U+5F "Low Line"
Replace errors with '?' U+3F "Question Mark"
Remove errors from the output
Fail loading on encountering an Unicode error
Ignore and pass-through non-UTF-8 string data.
Requires ufbx_load_opts.allow_unsafe
.
UNSAFE: Breaks API guarantee that ufbx_string
is UTF-8 encoded.
enum ufbx_geometry_transform_handling
How to handle FBX node geometry transforms.
FBX nodes can have "geometry transforms" that affect only the attached meshes, but not the children. This is not allowed in many scene representations so ufbx provides some ways to simplify them. Geometry transforms can also be used to transform any other attributes such as lights or cameras.
Preserve the geometry transforms as-is.
To be correct for all files you have to use ufbx_node.geometry_transform
,
ufbx_node.geometry_to_node
, or ufbx_node.geometry_to_world
to compensate
for any potential geometry transforms.
Add helper nodes between the nodes and geometry where needed.
The created nodes have ufbx_node.is_geometry_transform_helper
set and are
named ufbx_load_opts.geometry_transform_helper_name
.
Modify the geometry of meshes attached to nodes with geometry transforms.
Will add helper nodes like UFBX_GEOMETRY_TRANSFORM_HANDLING_HELPER_NODES
if
necessary, for example if there are multiple instances of the same mesh with
geometry transforms.
Modify the geometry of meshes attached to nodes with geometry transforms.
This will not work correctly for instanced geometry.
enum ufbx_inherit_mode_handling
How to handle FBX transform inherit modes.
Preserve inherit mode in ufbx_node.inherit_mode
.
To correctly handle all scenes you would need to handle the non-standard inherit modes.
Create scale helper nodes parented to nodes that need special inheritance.
Scale helper nodes will have ufbx_node.is_scale_helper
and parents of
scale helpers will have ufbx_node.scale_helper
pointing to it.
Attempt to compensate for bone scale by inversely scaling children.
This only works for uniform non-animated scaling, if scale is
non-uniform or animated, ufbx will add scale helpers in the same way
as UFBX_INHERIT_MODE_HANDLING_HELPER_NODES
.
Attempt to compensate for bone scale by inversely scaling children.
Will never create helper nodes.
Ignore non-standard inheritance modes.
Forces all nodes to have UFBX_INHERIT_MODE_NORMAL
regardless of the
inherit mode specified in the file. This can be useful for emulating
results from importers/programs that don't support inherit modes.
enum ufbx_pivot_handling
How to handle FBX transform pivots.
Take pivots into account when computing the transform.
Translate objects to be located at their pivot.
Only applied if rotation and scaling pivots are equal.
Results in geometric translation. Use ufbx_geometry_transform_handling
to interpret these in a standard scene graph.
enum ufbx_baked_key_flags
This keyframe represents a constant step from the left side
This keyframe represents a constant step from the right side
This keyframe is the main part of a step
Bordering either UFBX_BAKED_KEY_STEP_LEFT
or UFBX_BAKED_KEY_STEP_RIGHT
.
This keyframe is a real keyframe in the source animation
This keyframe has been reduced by maximum sample rate.
struct ufbx_baked_vec3
double | time |
Time of the keyframe, in seconds
Additional information about the keyframe
struct ufbx_baked_vec3_list
ufbx_baked_vec3* | data |
size_t | count |
struct ufbx_baked_quat
double | time |
Time of the keyframe, in seconds
Additional information about the keyframe
struct ufbx_baked_quat_list
ufbx_baked_quat* | data |
size_t | count |
struct ufbx_baked_node
Baked transform animation for a single node.
uint32_t | typed_id |
Typed ID of the node, maps to ufbx_scene.nodes[]
.
uint32_t | element_id |
Element ID of the element, maps to ufbx_scene.elements[]
.
bool | constant_translation |
The translation channel has constant values for the whole animation.
bool | constant_rotation |
The rotation channel has constant values for the whole animation.
bool | constant_scale |
The scale channel has constant values for the whole animation.
Translation keys for the animation, maps to ufbx_node.local_transform.translation
.
Rotation keyframes, maps to ufbx_node.local_transform.rotation
.
Scale keyframes, maps to ufbx_node.local_transform.scale
.
struct ufbx_baked_node_list
ufbx_baked_node* | data |
size_t | count |
struct ufbx_baked_prop
Baked property animation.
Name of the property, eg. "Visibility"
.
bool | constant_value |
The value of the property is constant for the whole animation.
Property value keys.
struct ufbx_baked_prop_list
ufbx_baked_prop* | data |
size_t | count |
struct ufbx_baked_element
Baked property animation for a single element.
uint32_t | element_id |
Element ID of the element, maps to ufbx_scene.elements[]
.
List of properties the animation modifies.
struct ufbx_baked_element_list
ufbx_baked_element* | data |
size_t | count |
struct ufbx_baked_anim_metadata
size_t | result_memory_used |
size_t | temp_memory_used |
size_t | result_allocs |
size_t | temp_allocs |
Memory statistics
struct ufbx_baked_anim
Animation baked into linearly interpolated keyframes.
See ufbx_bake_anim()
.
Nodes that are modified by the animation.
Some nodes may be missing if the specified animation does not transform them. Conversely, some non-obviously animated nodes may be included as exporters often may add dummy keyframes for objects.
Element properties modified by the animation.
double | playback_time_begin |
double | playback_time_end |
double | playback_duration |
Playback time range for the animation.
double | key_time_min |
double | key_time_max |
Keyframe time range.
Additional bake information.
typedef uintptr_t | ufbx_thread_pool_context |
struct ufbx_thread_pool_info
uint32_t | max_concurrent_tasks |
struct ufbx_thread_pool
struct ufbx_thread_opts
ufbx_thread_pool | pool |
size_t | num_tasks |
size_t | memory_limit |
struct ufbx_load_opts
Options for ufbx_load_file/memory/stream/stdio()
Initialize to zero with { 0 }
(C) or { }
(C++)
Allocator used during loading
Allocator used for the final scene
Threading options
bool | ignore_geometry |
Do not load geometry datsa (vertices, indices, etc)
bool | ignore_animation |
Do not load animation curves
bool | ignore_embedded |
Do not load embedded content
bool | ignore_all_content |
Do not load any content (geometry, animation, embedded)
bool | evaluate_skinning |
Evaluate skinning (see ufbx_mesh.skinned_vertices)
bool | evaluate_caches |
Evaluate vertex caches (see ufbx_mesh.skinned_vertices)
bool | load_external_files |
Try to open external files referenced by the main file automatically.
Applies to geometry caches and .mtl files for OBJ.
This may be risky for untrusted data as the input files may contain references to arbitrary paths in the filesystem.
This only applies to files implicitly referenced by the scene, if
you request additional files via eg. ufbx_load_opts.obj_mtl_path
they
are still loaded.
Will fail loading if any external files are not found by default, use
ufbx_load_opts.ignore_missing_external_files
to suppress this, in this case
you can find the errors at ufbx_metadata.warnings[]
as UFBX_WARNING_MISSING_EXTERNAL_FILE
.
Don't fail loading if external files are not found.
bool | skip_skin_vertices |
Don't compute ufbx_skin_deformer
vertices
and weights
arrays saving
a bit of memory and time if not needed
bool | skip_mesh_parts |
Skip computing ufbx_mesh.material_parts[]
and ufbx_mesh.face_group_parts[]
.
bool | clean_skin_weights |
Clean-up skin weights by removing negative, zero and NAN weights.
Read Blender materials as PBR values.
Blender converts PBR materials to legacy FBX Phong materials in a deterministic way.
If this setting is enabled, such materials will be read as UFBX_SHADER_BLENDER_PHONG
,
which means ufbx will be able to parse roughness and metallic textures.
bool | disable_quirks |
Don't adjust reading the FBX file depending on the detected exporter
bool | strict |
Don't allow partially broken FBX files to load
Force ASCII parsing to use a single thread.
The multi-threaded ASCII parsing is slightly more lenient as it ignores the self-reported size of ASCII arrays, that threaded parsing depends on.
bool | allow_unsafe |
UNSAFE: If enabled allows using unsafe options that may fundamentally break the API guarantees.
Specify how to handle broken indices.
Connect related elements even if they are broken. If false
(default)
ufbx_skin_cluster
with a missing bone
field are not included in
the ufbx_skin_deformer.clusters[]
array for example.
Allow nodes that are not connected in any way to the root. Conversely if
disabled, all lone nodes will be parented under ufbx_scene.root_node
.
Allow meshes with no vertex position attribute.
If this is set ufbx_mesh.vertex_position.exists
may be false
.
bool | allow_empty_faces |
Allow faces with zero indices.
Generate vertex normals for a meshes that are missing normals.
You can see if the normals have been generated from ufbx_mesh.generated_normals
.
Ignore open_file_cb
when loading the main file.
char | path_separator |
Path separator character, defaults to '' on Windows and '/' otherwise.
uint32_t | node_depth_limit |
Maximum depth of the node hirerachy.
Will fail with UFBX_ERROR_NODE_DEPTH_LIMIT
if a node is deeper than this limit.
The default of 0 allows arbitrarily deep hierarchies. Be careful if using recursive algorithms without setting this limit.
uint64_t | file_size_estimate |
Estimated file size for progress reporting
size_t | read_buffer_size |
Buffer size in bytes to use for reading from files or IO callbacks
Filename to use as a base for relative file paths if not specified using
ufbx_load_file()
. Use length = SIZE_MAX
for NULL-terminated strings.
raw_filename
will be derived from this if empty.
Raw non-UTF8 filename. Does not support NULL termination.
filename
will be derived from this if empty.
Progress reporting
uint64_t | progress_interval_hint |
Bytes between progress report calls
External file callbacks (defaults to stdio.h)
How to handle geometry transforms in the nodes.
See ufbx_geometry_transform_handling
for an explanation.
How to handle unconventional transform inherit modes.
See ufbx_inherit_mode_handling
for an explanation.
How to handle pivots.
See ufbx_pivot_handling
for an explanation.
How to perform space conversion by target_axes
and target_unit_meters
.
See ufbx_space_conversion
for an explanation.
Axis used to mirror for conversion between left-handed and right-handed coordinates.
Do not change winding of faces when converting handedness.
bool | reverse_winding |
Reverse winding of all faces.
If handedness_conversion_retain_winding
is not specified, mirrored meshes
will retain their original winding.
Apply an implicit root transformation to match axes.
Used if ufbx_coordinate_axes_valid(target_axes)
.
Scale the scene so that one world-space unit is target_unit_meters
meters.
By default units are not scaled.
Target space for camera.
By default FBX cameras point towards the positive X axis.
Used if ufbx_coordinate_axes_valid(target_camera_axes)
.
Target space for directed lights.
By default FBX lights point towards the negative Y axis.
Used if ufbx_coordinate_axes_valid(target_light_axes)
.
Name for dummy geometry transform helper nodes.
Name for dummy scale helper nodes.
bool | normalize_normals |
Normalize vertex normals.
bool | normalize_tangents |
Normalize tangents and bitangents.
Override for the root transform
double | key_clamp_threshold |
Animation keyframe clamp threhsold, only applies to specific interpolation modes.
Specify how to handle Unicode errors in strings.
Retain the 'W' component of mesh normal/tangent/bitangent.
bool | retain_dom |
Retain the raw document structure using ufbx_dom_node
.
Force a specific file format instead of detecting it.
size_t | file_format_lookahead |
How far to read into the file to determine the file format.
Default: 16kB
Do not attempt to detect file format from file content.
Do not attempt to detect file format from filename extension.
ufbx primarily detects file format from the file header, this is just used as a fallback.
(.obj) Try to find .mtl file with matching filename as the .obj file.
Used if the file specified mtllib
line is not found, eg. for a file called
model.obj
that contains the line usemtl materials.mtl
, ufbx would first
try to open materials.mtl
and if that fails it tries to open model.mtl
.
bool | obj_merge_objects |
(.obj) Don't split geometry into meshes by object.
bool | obj_merge_groups |
(.obj) Don't split geometry into meshes by groups.
bool | obj_split_groups |
(.obj) Force splitting groups even on object boundaries.
(.obj) Path to the .mtl file.
Use length = SIZE_MAX
for NULL-terminated strings.
This is used instead of the one in the file even if not found
and sidesteps load_external_files
as it's explicitly requested.
(.obj) Data for the .mtl file.
The world unit in meters that .obj files are assumed to be in.
.obj files do not define the working units. By default the unit scale is read as zero, and no unit conversion is performed.
Coordinate space .obj files are assumed to be in.
.obj files do not define the coordinate space they use. By default no coordinate space is assumed and no conversion is performed.
struct ufbx_evaluate_opts
Options for ufbx_evaluate_scene()
Initialize to zero with { 0 }
(C) or { }
(C++)
Allocator used during evaluation
Allocator used for the final scene
bool | evaluate_skinning |
Evaluate skinning (see ufbx_mesh.skinned_vertices)
bool | evaluate_caches |
Evaluate vertex caches (see ufbx_mesh.skinned_vertices)
bool | load_external_files |
WARNING: Potentially unsafe! Try to open external files such as geometry caches
External file callbacks (defaults to stdio.h)
struct ufbx_const_uint32_list
struct ufbx_const_real_list
struct ufbx_prop_override_desc
uint32_t | element_id |
Element (ufbx_element.element_id
) to override the property from
Property name to override.
ufbx_vec4 | value |
ufbx_string | value_str |
int64_t | value_int |
Override value, use value.x
for scalars. value_int
is initialized
from value.x
if zero so keep value
zeroed even if you don't need it!
struct ufbx_const_prop_override_desc_list
const ufbx_prop_override_desc* | data |
size_t | count |
struct ufbx_const_transform_override_list
const ufbx_transform_override* | data |
size_t | count |
struct ufbx_anim_opts
Animation layers indices.
Corresponding to ufbx_scene.anim_layers[]
, aka ufbx_anim_layer.typed_id
.
Override layer weights, parallel to ufbx_anim_opts.layer_ids[]
.
Property overrides.
These allow you to override FBX properties, such as 'UFBX_Lcl_Rotation`.
Transform overrides.
These allow you to override individual nodes' ufbx_node.local_transform
.
bool | ignore_connections |
Ignore connected properties
Allocator used to create the ufbx_anim
enum ufbx_bake_step_handling
Specifies how to handle stepped tangents.
One millisecond default step duration, with potential extra slack for converting to float
.
Use a custom interpolation duration for the constant step.
See ufbx_bake_opts.step_custom_duration
and optionally ufbx_bake_opts.step_custom_epsilon
.
Stepped keyframes are represented as keyframes at the exact same time.
Use flags UFBX_BAKED_KEY_STEP_LEFT
and UFBX_BAKED_KEY_STEP_RIGHT
to differentiate
between the primary key and edge limits.
Represent stepped keyframe times as the previous/next representable double
value.
Using this and robust linear interpolation will handle stepped tangents correctly without having to look at the key flags.
Casting these values to float
or otherwise modifying them can collapse
the keyframes to have the identical time.
Treat all stepped tangents as linearly interpolated.
struct ufbx_bake_opts
Allocator used during loading
Allocator used for the final baked animation
bool | trim_start_time |
Move the keyframe times to start from zero regardless of the animation start time.
For example, for an animation spanning between frames [30, 60] will be moved to [0, 30] in the baked animation.
This is in general not equivalent to subtracting ufbx_anim.time_begin
from each keyframe, as this trimming is done exactly using internal FBX ticks.
double | resample_rate |
Samples per second to use for resampling non-linear animation.
Default: 30
double | minimum_sample_rate |
Minimum sample rate to not resample.
Many exporters resample animation by default. To avoid double-resampling keyframe rates higher or equal to this will not be resampled. Default: 19.5
double | maximum_sample_rate |
Maximum sample rate to use, this will remove keys if they are too close together.
Default: unlimited
bool | bake_transform_props |
Bake the raw versions of properties related to transforms.
bool | skip_node_transforms |
Do not bake node transforms.
bool | no_resample_rotation |
Do not resample linear rotation keyframes.
FBX interpolates rotation in Euler angles, so this might cause incorrect interpolation.
Ignore layer weight animation.
size_t | max_keyframe_segments |
Maximum number of segments to generate from one keyframe.
Default: 32
How to handle stepped tangents.
double | step_custom_duration |
Interpolation duration used by UFBX_BAKE_STEP_HANDLING_CUSTOM_DURATION
.
double | step_custom_epsilon |
Interpolation epsilon used by UFBX_BAKE_STEP_HANDLING_CUSTOM_DURATION
.
Defined as the minimum fractional decrease/increase in key time, ie.
time / (1.0 + step_custom_epsilon)
and time * (1.0 + step_custom_epsilon)
.
Enable key reduction.
Enable key reduction for non-constant rotations.
Assumes rotations will be interpolated using a spherical linear interpolation at runtime.
double | key_reduction_threshold |
Threshold for reducing keys for linear segments.
Default 0.000001
, use negative to disable.
size_t | key_reduction_passes |
Maximum passes over the keys to reduce.
Every pass can potentially halve the the amount of keys.
Default: 4
struct ufbx_tessellate_curve_opts
Options for ufbx_tessellate_nurbs_curve()
Initialize to zero with { 0 }
(C) or { }
(C++)
Allocator used during tessellation
Allocator used for the final line curve
size_t | span_subdivision |
How many segments tessellate each span in ufbx_nurbs_basis.spans
.
struct ufbx_tessellate_surface_opts
Options for ufbx_tessellate_nurbs_surface()
Initialize to zero with { 0 }
(C) or { }
(C++)
Allocator used during tessellation
Allocator used for the final mesh
size_t | span_subdivision_u |
size_t | span_subdivision_v |
How many segments tessellate each span in ufbx_nurbs_basis.spans
.
Default is 4
, not ufbx_nurbs_surface.span_subdivision_u/v
as that
would make it easy to create an FBX file with an absurdly high subdivision
rate (similar to mesh subdivision). Please enforce copy the value yourself
enforcing whatever limits you deem reasonable.
bool | skip_mesh_parts |
Skip computing ufbx_mesh.material_parts[]
struct ufbx_subdivide_opts
Options for ufbx_subdivide_mesh()
Initialize to zero with { 0 }
(C) or { }
(C++)
Allocator used during subdivision
Allocator used for the final mesh
bool | ignore_normals |
Do not generate normals
bool | interpolate_normals |
Interpolate existing normals using the subdivision rules instead of generating new normals
bool | interpolate_tangents |
Subdivide also tangent attributes
Map subdivided vertices into weighted original vertices.
May be O(n2) if max_source_vertices
is not specified!
size_t | max_source_vertices |
Limit source vertices per subdivided vertex.
Calculate bone influences over subdivided vertices (if applicable).
May be O(n2) if max_skin_weights
is not specified!
size_t | max_skin_weights |
Limit bone influences per subdivided vertex.
size_t | skin_deformer_index |
Index of the skin deformer to use for evaluate_skin_weights
.
struct ufbx_geometry_cache_opts
Options for ufbx_load_geometry_cache()
Initialize to zero with { 0 }
(C) or { }
(C++)
Allocator used during loading
Allocator used for the final scene
External file callbacks (defaults to stdio.h)
double | frames_per_second |
FPS value for converting frame times to seconds
Axis to mirror the geometry by.
bool | use_scale_factor |
Enable scaling scale_factor
all geometry by.
Factor to scale the geometry by.
struct ufbx_geometry_cache_data_opts
Options for ufbx_read_geometry_cache_TYPE()
Initialize to zero with { 0 }
(C) or { }
(C++)
External file callbacks (defaults to stdio.h)
bool | additive |
bool | use_weight |
ufbx_real | weight |
bool | ignore_transform |
Ignore scene transform.
struct ufbx_panic
bool | did_panic |
size_t | message_length |
char[UFBX_PANIC_MESSAGE_LENGTH] | message |
const ufbx_string | ufbx_empty_string |
const ufbx_blob | ufbx_empty_blob |
const ufbx_matrix | ufbx_identity_matrix |
const ufbx_transform | ufbx_identity_transform |
const ufbx_vec2 | ufbx_zero_vec2 |
const ufbx_vec3 | ufbx_zero_vec3 |
const ufbx_vec4 | ufbx_zero_vec4 |
const ufbx_quat | ufbx_identity_quat |
Various zero/empty/identity values
Commonly used coordinate axes.
const size_t[UFBX_ELEMENT_TYPE_COUNT] | ufbx_element_type_size |
Sizes of element types. eg sizeof(ufbx_node)
const uint32_t | ufbx_source_version |
Version of the source file, comparable to UFBX_HEADER_VERSION
Practically always true
(see below), if not you need to be careful with threads.
Guaranteed to be true
in any of the following conditions:
- ufbx.c has been compiled using: GCC / Clang / MSVC / ICC / EMCC / TCC
- ufbx.c has been compiled as C++11 or later
- ufbx.c has been compiled as C11 or later with
<stdatomic.h>
support
If false
you can't call the following functions concurrently:
Load a scene from a size
byte memory buffer at data
Load a scene by opening a file named filename
Load a scene by reading from an FILE *file
stream
file
is passed as a void
pointer to avoid including <stdio.h>
Load a scene by reading from an FILE *file
stream with a prefix
file
is passed as a void
pointer to avoid including <stdio.h>
Load a scene from a user-specified stream
Load a scene from a user-specified stream with a prefix
Free a previously loaded or evaluated scene
Increment scene
refcount
Format a textual description of error
.
Always produces a NULL-terminated string to char dst[dst_size]
, truncating if
necessary. Returns the number of characters written not including the NULL terminator.
Find a property name
from props
, returns NULL
if not found.
Searches through ufbx_props.defaults
as well.
Utility functions for finding the value of a property, returns def
if not found.
For ufbx_string
you need to ensure the lifetime of the default is
sufficient as no copy is made.
Find property in props
with concatendated parts[num_parts]
.
Get an element connected to a property.
Find an element connected to a property by name.
Find any element of type type
in scene
by name
.
For example if you want to find ufbx_material
named Mat
:
(ufbx_material*)ufbx_find_element(scene, UFBX_ELEMENT_MATERIAL, "Mat");
Find a single animated property prop
of element
in layer
.
Returns NULL
if not found.
Find all animated properties of element
in layer
.
Get a matrix that transforms normals in the same way as Autodesk software.
The resulting normals are slightly incorrect as this function deliberately
inverts geometric transformation wrong. For better results use
ufbx_matrix_for_normals(&node->geometry_to_world)
.
Decompress a DEFLATE compressed buffer.
Returns the decompressed size or a negative error code (see source for details).
You must supply a valid retain
with ufbx_inflate_retain.initialized == false
but the rest can be uninitialized.
Same as ufbx_open_file()
but compatible with the callback in ufbx_open_file_fn
.
The user
parameter is actually not used here.
Open a ufbx_stream
from a file.
Use path_len == SIZE_MAX
for NULL terminated string.
Uses the default ufbx allocator!
Evaluate a single animation curve
at a time
.
Returns default_value
only if curve == NULL
or it has no keyframes.
Evaluate a value from bundled animation curves.
Evaluate an animated property name
from element
at time
.
If the property is not found it will have the flag UFBX_PROP_FLAG_NOT_FOUND
.
Evaluate all animated properties of element
.
This function returns an ufbx_props
structure with the original properties as
ufbx_props.defaults
. This lets you use ufbx_find_prop/value()
for the results.
enum ufbx_transform_flags
Flags to control ufbx_evaluate_transform_flags()
.
Ignore parent scale helper.
Ignore componentwise scale.
Note that if you don't specify this, ufbx will have to potentially evaluate the entire parent chain in the worst case.
Require explicit components
If UFBX_TRANSFORM_FLAG_EXPLICIT_INCLUDES
: Evaluate ufbx_transform.translation
.
If UFBX_TRANSFORM_FLAG_EXPLICIT_INCLUDES
: Evaluate ufbx_transform.rotation
.
If UFBX_TRANSFORM_FLAG_EXPLICIT_INCLUDES
: Evaluate ufbx_transform.scale
.
Evaluate the animated transform of a node given a time.
The returned transform is the local transform of the node (ie. relative to the parent),
comparable to ufbx_node.local_transform
.
Evaluate the blend shape weight of a blend channel.
Return value uses 1.0
for full weight, instead of 100.0
that the internal property UFBX_Weight
uses.
Evaluate the whole scene
at a specific time
in the animation anim
.
The returned scene behaves as if it had been exported at a specific time
in the specified animation, except that animated elements' properties contain
only the animated values, the original ones are in props->defaults
.
The returned scene refers to the original scene
so the original
scene cannot be freed until all evaluated scenes are freed.
Create a custom animation descriptor.
ufbx_anim_opts
is used to specify animation layers and weights.
You can also leave ufbx_anim_opts.layer_ids[]
empty and only specify
overrides to evaluate the scene with different properties or local transforms.
Free an animation returned by ufbx_create_anim()
.
Increase the animation reference count.
"Bake" an animation to linearly interpolated keyframes.
Composites the FBX transformation chain into quaternion rotations.
Evaluate baked animation keyframes
at time
.
Internally linearly interpolates between two adjacent keyframes. Handles stepped tangents cleanly, which is not strictly necessary for custom interpolation.
Evaluate baked animation keyframes
at time
.
Internally spherically interpolates (ufbx_quat_slerp()
) between two adjacent keyframes.
Handles stepped tangents cleanly, which is not strictly necessary for custom interpolation.
Retrieve the bone pose for node
.
Returns NULL
if the pose does not contain node
.
Find a texture for a given material FBX property.
Find a texture for a given shader property.
Map from a shader property to material property.
Find an input in a shader texture.
Returns true
if axes
forms a valid coordinate space.
Vector math utility functions.
Quaternion math utility functions.
Get a matrix that can be used to transform geometry normals.
You must normalize the normals after transforming them with this matrix,
eg. using ufbx_vec3_normalize()
.
This function flips the normals if the determinant is negative.
Matrix transformation utilities.
Conversions between ufbx_matrix
and ufbx_transform
.
Get a matrix representing the deformation for a single vertex.
Returns fallback
if the vertex is not skinned.
Resolve the index into ufbx_blend_shape.position_offsets[]
given a vertex.
Returns UFBX_NO_INDEX
if the vertex is not included in the blend shape.
Get the offset for a given vertex in the blend shape.
Returns ufbx_zero_vec3
if the vertex is not a included in the blend shape.
Get the current blend offset given a blend deformer.
This depends on the current animated blend weight of the deformer.
Apply the blend shape with weight
to given vertices.
Apply the blend deformer with weight
to given vertices.
This depends on the current animated blend weight of the deformer.
Low-level utility to evaluate NURBS the basis functions.
Evaluate a point on a NURBS curve given the parameter u
.
Evaluate a point on a NURBS surface given the parameter u
and v
.
Tessellate a NURBS curve into a polyline.
Tessellate a NURBS surface into a mesh.
Free a line returned by ufbx_tessellate_nurbs_curve()
.
Increase the refcount of the line.
Find the face that contains a given index
.
Returns UFBX_NO_INDEX
if out of bounds.
Triangulate a mesh face, returning the number of triangles.
You need to space for (face.num_indices - 2) * 3 - 1
indices!
Using ufbx_mesh.max_face_triangles * 3
is always safe.
Generate the half-edge representation of mesh
to topo[mesh->num_indices]
Get the next half-edge in topo
.
Get the previous half-edge in topo
.
Calculate a normal for a given face.
The returned normal is weighted by face area.
Generate indices for normals from the topology.
Respects smoothing groups.
Compute normals given normal indices.
You can use ufbx_generate_normal_mapping()
to generate the normal indices.
Subdivide a mesh using the Catmull-Clark subdivision level
times.
Free a mesh returned from ufbx_subdivide_mesh()
or ufbx_tessellate_nurbs_surface()
.
Increase the mesh reference count.
Load geometry cache information from a file.
As geometry caches can be massive, this does not actually read the data, but only seeks through the files to form the metadata.
Free a geometry cache returned from ufbx_load_geometry_cache()
.
Increase the geometry cache reference count.
Read a frame from a geometry cache.
Sample the a geometry cache channel, linearly blending between adjacent frames.
Find a DOM node given a name.
Generate an index buffer for a flat vertex buffer.
streams
specifies one or more vertex data arrays, each stream must contain num_indices
vertices.
This function compacts the data within streams
in-place, writing the deduplicated indices to indices
.
Run a single thread pool task.
See ufbx_thread_pool_run_fn
for more information.
Get or set an arbitrary user pointer for the thread pool context.
ufbx_thread_pool_get_user_ptr()
returns NULL
if unset.
Utility functions for reading geometry data for a single index.
Utility functions for reading geometry data for a single index.
Functions for converting an untyped ufbx_element
to a concrete type.
Returns NULL
if the element is not that type.
#define | UFBX_Lcl_Translation |
Local translation.
Used by: ufbx_node
#define | UFBX_Lcl_Rotation |
Local rotation expressed in Euler degrees.
Used by: ufbx_node
The rotation order is defined by the UFBX_RotationOrder
property.
#define | UFBX_Lcl_Scaling |
Local scaling factor, 3D vector.
Used by: ufbx_node
#define | UFBX_RotationOrder |
Euler rotation interpretation, used by UFBX_Lcl_Rotation
.
Used by: ufbx_node
, enum value ufbx_rotation_order
.
#define | UFBX_ScalingPivot |
Scaling pivot: point around which scaling is performed.
Used by: ufbx_node
.
#define | UFBX_RotationPivot |
Scaling pivot: point around which rotation is performed.
Used by: ufbx_node
.
#define | UFBX_ScalingOffset |
Scaling offset: translation added after scaling is performed.
Used by: ufbx_node
.
#define | UFBX_RotationOffset |
Rotation offset: translation added after rotation is performed.
Used by: ufbx_node
.
#define | UFBX_PreRotation |
Pre-rotation: Rotation applied after UFBX_Lcl_Rotation
.
Used by: ufbx_node
.
Affected by UFBX_RotationPivot
but not UFBX_RotationOrder
.
#define | UFBX_PostRotation |
Post-rotation: Rotation applied before UFBX_Lcl_Rotation
.
Used by: ufbx_node
.
Affected by UFBX_RotationPivot
but not UFBX_RotationOrder
.
#define | UFBX_Visibility |
Controls whether the node should be displayed or not.
Used by: ufbx_node
.
#define | UFBX_Weight |
Weight of an animation layer in percentage (100.0 being full).
Used by: ufbx_anim_layer
.
#define | UFBX_DeformPercent |
Blend shape deformation weight (100.0 being full).
Used by: ufbx_blend_channel
.