Code Monkey home page Code Monkey logo

fbx2gltf's Introduction

FBX2glTF

A command-line tool for the conversion of 3D model assets on the FBX file format to the glTF file format.

Change skinning-weights to 4 with --skinning-weights 4, if your engine does not support the 8 bone weights feature.

Change the default import of the engine to be different from 30 fps if needed, with --anim-framerate (bake24|bake30|bake60).

License

The FBX2glTF command line tool is distributed under the 3-clause BSD license.

Precompiled binaries include proprietary code from the Autodesk FBX SDK 2020, which is distributed under the Autodesk LICENSE AND SERVICES AGREEMENT.

By downloading and using this tool, you agree to the terms of that Autodesk proprietary license.

Platform binaries

Check the latest release for the last precompiled binaries for Linux, macOS, and Windows.

There are also artifacts of the latest commit for Linux, macOS, and Windows in the GitHub Actions tab.

Build instructions

Reference the GitHub workflow.

fbx2gltf's People

Contributors

abbaswasim avatar akien-mga avatar alextmjugador avatar calinou avatar davilovick avatar dvanderleij avatar escapezero avatar etherlore avatar fire avatar freakthemighty avatar gmorganarium avatar gwihlidal avatar hu-xd avatar jfaust avatar jkiss avatar jordyvandortmont avatar js-dignitas avatar lyuma avatar mayanknagpal-hike avatar msfeldstein avatar mtostenson avatar projectbarks avatar robertlong avatar samskivert avatar seanlinrl avatar shrinktofit avatar simonwashere avatar valentinegb avatar vfxgordon avatar zellski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fbx2gltf's Issues

Conan 2.0 no longer supports cmake_ paths,how can I build correctly?

In the conanfile.py file:
generators="cmake_find_package", "cmake_paths".
when i run
>conan install . -build-folder=build_debug --build=missing
I got :
ERROR: Invalid generator 'cmake_paths'. Available types: CMakeToolchain, CMakeDeps, MesonToolchain, MSBuildDeps, MSBuildToolchain, NMakeToolchain, NMakeDeps, VCVars, QbsProfile, VirtualRunEnv, VirtualBuildEnv, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps, BazelDeps, BazelToolchain, IntelCC, XcodeDeps, XcodeToolchain, PremakeDeps

I tried other values of generators, such as:"CMakeDeps", "CMakeToolchain"...
The install command is successful, but conan_paths.cmake is not produced !!!
When I compile, I always an error:
The Conan package manager must run (install) first. Example usage: mkdir -p build_debug conan install . -i build_debug -s build_type=Debug -e FBXSDK_SDKS=/home/zell/FBXSDK conan build . -bf build_debug

Missing resource: buffer.bin

I converted a simple cube model into glTF format with the latest version of the converter. When I try to load it in Blender, it throws an error: Missing resource, 'buffer.bin'. When I look into models converted to glTF with Blender, they typically have the buffers encoded as URI, i.e.

 "buffers" : [
        {
            "byteLength" : 4587280,
            "uri" : "data:application/octet-stream;base64,..."

Is this a bug?

Edit:
By the way - I checked it with GLB and I can load assets converted to the binary format.

Can't build on MacOS 13

Godot version

N/A

System information

M1 Macbook Pro, macOS 13.5

Issue description

I'm hoping to contribute to this project, so I'm starting by trying to get a local build working. Conan is not finding iconv even though it's provided by OSX. In searching, I see lots of people having vaguely related problems, but I have no idea how to even debug why Conan can't seem to find iconv, much less fix it.

I figured I'd ask in case someone has tried and knows the magic incantation.

Steps to reproduce

I followed the Github actions, so after cloning the repo and fetching the FBX SDK, I tried running:

pip install --upgrade conan==1.58
conan profile new default --detect
conan profile show default
env CMAKE_OSX_ARCHITECTURES=x86_64 conan install . -i build -s build_type=Release --settings arch=x86_64 --build missing

But at this point, I get an error about failing to find iconv:

Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : x86 [1]
    - compiler supports SSE2   : yes [2]
    - compiler supports SSE4.1 : yes [2]
    - has std::atomic_ref      : no [2]
    - has statx                : no [2]
    - has statx syscall        : no [2]
    - has init_priority attribute : yes [2]
    - has stat::st_blksize     : no [2]
    - has stat::st_mtim        : no [2]
    - has stat::st_mtimensec   : no [2]
    - has stat::st_mtimespec   : yes [2]
    - has stat::st_birthtim    : no [2]
    - has stat::st_birthtimensec : no [2]
    - has stat::st_birthtimespec : yes [2]
    - zlib                     : yes [3]
    - bzip2                    : yes [3]
    - iconv (libc)             : no [2]
    - iconv (separate)         : no [2]
- Boost.Locale failed to find iconv (separate) library to be built.
boost/1.78.0: 
boost/1.78.0: ERROR: Package 'c9b9cbf463efdfe91cd1b39fbd90e49b9d3ac02b' build failed
boost/1.78.0: WARN: Build folder /Users/elalish/.conan/data/boost/1.78.0/_/_/build/c9b9cbf463efdfe91cd1b39fbd90e49b9d3ac02b/build-release
ERROR: boost/1.78.0: Error in build() method, line 887
	self.run(full_command)
	ConanException: Error 1 while executing b2 -q target-os=darwin architecture=x86 address-model=64 binary-format=mach-o abi=sysv --layout=system --user-config=/Users/elalish/.conan/data/boost/1.78.0/_/_/source/src/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libiconv threading=multi visibility=hidden link=static variant=release --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-iostreams --with-locale --with-log --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=clang-darwin pch=on -sLIBBACKTRACE_PATH=/Users/elalish/.conan/data/libbacktrace/cci.20210118/_/_/package/6841fe8f0f22f6fa260da36a43a94ab525c7ed8d -sICONV_PATH=/Users/elalish/.conan/data/libiconv/1.15/_/_/package/6841fe8f0f22f6fa260da36a43a94ab525c7ed8d linkflags="-stdlib=libc++" cxxflags="-fPIC -stdlib=libc++ -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/Users/elalish/.conan/data/boost/1.78.0/_/_/package/c9b9cbf463efdfe91cd1b39fbd90e49b9d3ac02b -j10 --abbreviate-paths -d0 --debug-configuration --build-dir="/Users/elalish/.conan/data/boost/1.78.0/_/_/build/c9b9cbf463efdfe91cd1b39fbd90e49b9d3ac02b/build-release"

Minimal reproduction project

N/A

Fbx GeometricTransformation support is problematic

Godot version

Fbx2Gltf commit 6154391

System information

Windows 11

Issue description

Fbx GeometricTransformation support is problematic
See Code, current logic is "Apply the geometric transform to the mesh geometry (vertices, normal etc.)"

but this is problematic since a mesh can be shared by several nodes with different GeometricTransformation, so in this scenario, effectively only 1 node will actually use its GeometricTransformation, other nodes' GeometricTransformation-s will be ignored, since the mesh/surface will only be loaded once.

Steps to reproduce

Build an model in 3DMax with several nodes that share the same mesh/instance but with different object-offset, export it as FBX.
Convert the FBX file to GLTF/GLB with Fbx2Gltf.
View the GLB file and see those geometries are incorrect.

Minimal reproduction project

N/A

Wrong message

-v,--verbose Include blend shape tangents, if reported present by the FBX SDK.

Typo

Potential invalid fbx or wrong conversion

Hello!

A user uploaded a fbx over the last weekend and it created all sort of problems (see CesiumGS/gltf-pipeline#608 and google/draco#998), including the hanging of the whole server due to a bus error in draco.

I was able to reproduce it with the generated gltf, but now wondering if the original fbx already had issues. I don't know any fbx validator out there. I'm attaching the originally uploaded fbx here, and also the resulting gltf. Could you perhaps check if it is valid to begin with?

To be clear our pipeline is as follows:

  • run fbx through fbx2gltf without draco
  • run resulting conversion through gltf-pipeline with draco

Fixing the resulting gltf's accessors, as described in the issues makes the problem go away.

Thanks!

broken fbx and resulting gltf.zip

Importing 3d models has non-deterministic behavior

Hi! I had a problem that the build for linux does not work (I'm not sure about all the models, but it fell on mine) with optimization -O0 (without optimizations), its failed here

the same problem with artefacts for mac and windows (they are also non deterministic with or without compiler optimizations such as -O1 -O2 -O3).

also the model can be either converted or not converted from launch to launch . I think it may be due to too serious compiler optimizations (mb some variables store trash values).

here channel.index can store negative value (in my case it was -1). So i hot-fixed it as shown below so that the converter would not fall with segmentation fault , but I'm sure it's the wrong solution.

Raw2gltf.cpp#L170

        const RawChannel& channel = animation.channels[channelIx];
        //new code
        if(channel.nodeIndex < 0)
        {
          continue;
        }
        // end new code
        const RawNode& node = raw.GetNode(channel.nodeIndex);

Maybe someone fixed it or have the same problem?

No way to have an animation restore to the default pose

The last animation track gets copied to the rest pose.

Any keyframes identical to the original rest pose are deleted. Combined with the first bug, it means there is no way to have an animation restore to the default pose.

One workaround is to duplicate the default animation and name it to be "ZZZdefault."

How different is this compared to the original facebookincubator repo?

Hello!

Not sure if this is the place to ask such question, so feel free to point me in the right direction here.

I recently started using this repo, after finding it was a more up-to-date version of the original facebookincubator fbx2gltf repo. But now I'm wondering if the notes in the original README about certain improvements and not supported features are already taken into consideration in this fork. I'm asking because the README from this fork doesn't have all the info the original had.

In essence, I would like to know what's not supported when converting from fbx to gltf using the latest release (v0.13.0-p1). Do you happen to have a list or some info on it?

Thank you for your time and your awesome work!

fbx2glTF produces model with EMPTY_ENTITY errors

Godot version

v0.13.0-p1

System information

Windows 11 Pro, Intel(R) Core(TM) i7-10750H

Issue description

The attached model, Avocado.zip, produces two glTF validation errors when ran through fbx2gltf. Below is the

{
  "mimeType": "model/gltf-binary",
  "validatorVersion": "2.0.0-dev.3.9",
  "validatedAt": "2023-06-10T00:39:18.378Z",
  "issues": {
    "numErrors": 2,
    "numWarnings": 0,
    "numInfos": 0,
    "numHints": 0,
    "messages": [
      {
        "code": "EMPTY_ENTITY",
        "message": "Entity cannot be empty.",
        "severity": 0,
        "pointer": "/animations/0/channels"
      },
      {
        "code": "EMPTY_ENTITY",
        "message": "Entity cannot be empty.",
        "severity": 0,
        "pointer": "/animations/0/samplers"
      }
    ],
    "truncated": false
  },
  "info": {
    "version": "2.0",
    "generator": "FBX2glTF v0.13.0",
    "resources": [
      {
        "pointer": "/buffers/0",
        "mimeType": "application/gltf-buffer",
        "storage": "glb",
        "byteLength": 8673296
      },
      {
        "pointer": "/images/0",
        "mimeType": "image/png",
        "storage": "buffer-view",
        "image": {
          "width": 2048,
          "height": 2048,
          "format": "rgb",
          "primaries": "srgb",
          "transfer": "srgb",
          "bits": 8
        }
      },
      {
        "pointer": "/images/1",
        "mimeType": "image/png",
        "storage": "buffer-view",
        "image": {
          "width": 2048,
          "height": 2048,
          "format": "rgb",
          "primaries": "srgb",
          "transfer": "srgb",
          "bits": 8
        }
      }
    ],
    "animationCount": 1,
    "materialCount": 1,
    "hasMorphTargets": false,
    "hasSkins": false,
    "hasTextures": true,
    "hasDefaultScene": true,
    "drawCallCount": 1,
    "totalVertexCount": 406,
    "totalTriangleCount": 682,
    "maxUVs": 1,
    "maxInfluences": 0,
    "maxAttributes": 3
  }
}

Steps to reproduce

  1. Download Avocado.zip
  2. Run `fbx2gltf -i Avaocado.fbx -o out
  3. Validate the model with the gltf-validator

Minimal reproduction project

N/A

Investigate removing dependency on MSVC redistributable on Windows

The README says:

FBX2glTF.exe is for Windows. REQUIRES MVSC redistributable on Windows https://support.microsoft.com/en-ca/help/2977003/the-latest-supported-visual-c-downloads

We should investigate removing this requirement to make installation easier, especially in automated scenarios. I see two ways to do this:

  • Link against the GNU ABI by building using MinGW using either GCC or Clang. This is what official Godot binaries do. This makes binaries slightly larger, but it's probably not much of an issue here. However, fbx2gltf may not build with MinGW out of the box, and the FBX SDK may not be compatible with this either.
  • Link against the built-in Windows C++ runtime. This runtime is only present on Windows 10 and 11. Therefore, this would bump the baseline Windows support to Windows 10, but I don't think a whole lot of people will be using Godot 4.x and FBX import on older Windows versions by the time Godot 4.0 is released. This shouldn't increase binary size by a noticeable margin.

Godot itself does not require the MSVC redistributable installed, so it would be good to not have fbx2gltf require it either.

Of course, the above points are moot if the FBX SDK itself requires the MSVC redistributable with no way to work around this.

For now, the README should mention the MSVC redistributable version that is expected by the executable, as newer redistributables are not compatible with executables linked against older versions (and vice versa). Is fbx2gltf built with MSVC 2019 or 2022 on GitHub Actions?

SeparateTextures Option is not work when convert to glb

Use the latest version of the converter convert a model(contain textures)
FBX2glTF.exe -i .\test.fbx -o test.glb --separate-textures
or
FBX2glTF.exe -i .\test.fbx -o test.glb -b

the test.glb still contain textures.

If I try convert to glft
FBX2glTF.exe -i .\test.fbx -o test.gltf --e
It will save textures separately.

test.zip

Relative paths to textures?

Hi! I see this repo doesn't have a issues template - I hope the below info is ok.

Using: recently downloaded FBX2glTF 0.13.0, and Godot: v4.0.stable.official [92bee43ad]

I recently purchased a Synty bundle thinking that I might be able to 'just drop' assets in Godot. Oh my!

Generally speaking, the Synty folder structure is reasonably fixed with a subfolder of Texture, with individual assets and characters in subfolders (and a demo in its root which tbh is an anomoly and users can shift to subfolder if that is easier);
image

Looking at the demo map fbx with Notepad++ I can see references to;

  • Filename U:/Dropbox/SyntyStudios/PolygonRoyale/_Working/Textures_Unreal/PolygonBattleRoyale_Road_01.png
  • RelativeFilename ....\SyntyStudios\PolygonRoyale_Working\Textures_Unreal\PolygonBattleRoyale_Road_01.png
  • XRefUrl U:/Dropbox/SyntyStudios/PolygonRoyale/_Working/Textures_Unreal/PolygonBattleRoyale_Texture_02_A.png
  • Shininess 4 (if you squint between the double/number/D/etc)

In Godot, this appears to translate to a models with shared textures - awesome! This does make fixing the scene vastly easier.

  • Name: Mat_PolygonBattleRoyale_Road_01 😮
  • surface/material/albedo/texture - empty 😢
  • alpha - I have no idea what to set this to, all the setttings seem weird checking a Quartunius nature tree.
  • Metallic + Roughness - has values? I reset these, and things look cvastly better, and I don't ^think^ I dragged files in the wrong places in all places. 😒
  • ShadowMesh - (part of godot import, never mind)

I imagine this project really isn't able to read the encoded details in these files , especially as they change all the time. And I imagine that the intent of the tool is to deal only in the files that are provided rather than to 'look' around and try fix things.

I'm wondering if "Mat_" is a prefix used in fbx2gltf, and to specify a different prefix/suffix instead? "..\Textures{name}.png" or something that be recognized by Godot might MIGHT be a relatively trivial change?

Thanks for the long read - I hope it makes sense!

FbxSkeleton should create empty skins with all of the bones.

See here for a description:
godotengine/godot#60854 (comment)
and here:
godotengine/godot#62275 (comment)

FBX knows that the nodes are part of a skeleton because they have an FbxSkeleton attached. Hence, FBX2glTF should detect this case and create a dummy glTF skin like discussed in this blender gltf io issue here:
KhronosGroup/glTF-Blender-IO#822

(This functionality that allows you to convert in Blender is therefore actually quite new, in Blender 3.2 )

Animation FBX should reset to the keyframe of the first animation

Godot version

4.1.dev 2c89516

System information

Windows 10

Issue description

These animation FBX work fine in other engines, but look incorrect in Godot and Blender because the baked Node "Lcl Rotation" values are incorrect / based on the animation rather than the T-pose.

FBX seems to have a convention in which the poses included in the file should be ignored, and the first frame of the first AnimStack object is used instead.

Expected behavior in other engines is for the initial rest pose to be the first frame of the first animation stack object. This can be observed for example in Unity by swapping the order of the AnimStack objects in the ASCII FBX and observing that the humanoid configuration screen no longer puts the model into T-pose by default, when Pose -> Reset is selected.

FBX2glTF uses EvaluateLocalTransform passing the default time of infinite, which ignores animation curves.

Given the possibility that this could break or change existing content, it may make sense to be an optional setting (use first animation keyframe). It may help to do more testing/research on more FBX compatible software.

Steps to reproduce

  1. Open the project
  2. Open the idle / jump / run animation FBX
  3. These converted FBX should be in T-pose so the retargeting system can run, but instead they are in the first frame

Minimal reproduction project

fbx files and project are available in:
kenney_fbx_animations.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.