To switch between the original ufbx.c
source code and a fixed version of the source code ufbx_fixed.c
,
you can comment/uncomment one of the following two lines in main.c
#include "ufbx.c" // (base64 BUGGED) <--- original ufbx base64 decoding
// #include "ufbx_fixed.c" // (base64 FIXED) <--- fixed base64 decoding (see Assimp FBX import code)
- The base64 decoding bug in ufbx leads to corrupted/malformed binary blobs when decoding FBX embedded textures.
- In the example of the embedded .jpeg textures, the extracted JPEG blob might still be decoded by some JPEG decoding libraries (like libjpeg)
but the decoded image will show severe or subtle texture artifacts. - stb_image sometimes even fails to decode the corrupted JPEG blob entirely,
which might lead to no textures being shown for the .fbx in your 3D engine/app.
notice the 1px green horizontal line at the very bottom in the diffuse image
notice the misaligned encoding blocks and random color shifts in the normal image
you can see the 1px green horizontal line on the hands & hair of the character