Skip to main content

Module fbx

Module fbx 

Source
Expand description

FBX, binary and ASCII, read with ufbx (MIT, https://github.com/ufbx/ufbx).

Every node with a mesh becomes one Mesh per material it uses, with the node’s geometry-to-world transform baked into positions and normals. Polygons are split with ufbx’s triangulation; normals the file lacks are generated by ufbx. Each material gives its base (diffuse) colour and opacity, and its diffuse (or base colour) texture when there is one: the picture comes from the file’s embedded media, else from a file next to the model (see texture::Loader), and is laid on with the file’s UVs (v flipped to picture space) and UV transform; wrap modes are ignored, textures always repeat (see texture). A picture that is missing or can’t be decoded leaves the colour.

The surface follows what Eagle’s viewer shows for FBX: the Bump and NormalMap pictures (also Maya’s TEX_normal_map) are read the same way and share the mesh’s UVs; the one UV transform baked in is the base map’s, else the normal map’s, else the bump map’s. A material is drawn see-through when its opacity is below 1 or a texture is connected to TransparentColor or TransparencyFactor (that picture is not drawn). Emissive colour and maps are deliberately not read: the viewer drops them for FBX, so the emissive stays black.

The scene is converted to the viewer’s convention: right-handed, Y up, and centimetres, the FBX default unit (the file’s UnitScaleFactor is applied, so a file saved in metres shows sizes in centimetres too).

Not read: other maps (emissive, specular, …), vertex colours, skinning and blend shapes (meshes stay in their bind pose), animation, cameras, lights, NURBS and external files other than texture pictures.

Functions§

parse