Skip to content

drywolf/ufbx_base64_decode_bugfix

Repository files navigation

UFBX base64 decoding bug

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)

Notes

  • 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.

BUGGED vs. FIXED Diffuse .jpg

notice the 1px green horizontal line at the very bottom in the diffuse image

BUGGED vs. FIXED Normals .jpg

notice the misaligned encoding blocks and random color shifts in the normal image

The same bug in Godot 4.3 with ufbx import

you can see the 1px green horizontal line on the hands & hair of the character

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published