1
1
# FBX2glTF
2
+
2
3
[ ![ License] ( https://img.shields.io/badge/License-BSD%203--Clause-blue.svg )] ( https://opensource.org/licenses/BSD-3-Clause )
3
4
4
5
This is a command line tool for converting 3D model assets on Autodesk's
@@ -17,11 +18,13 @@ Bleeding-edge binaries for Windows may be found [here](https://ci.appveyor.com/p
17
18
## Running
18
19
19
20
The tool can be invoked like so:
21
+
20
22
```
21
23
> FBX2glTF ~/models/butterfly.fbx
22
24
```
23
25
24
26
Or perhaps, as part of a more complex pipeline:
27
+
25
28
```
26
29
> FBX2glTF --binary --draco --verbose \
27
30
--input ~/models/source/butterfly.fbx \
@@ -33,6 +36,7 @@ There are also some friendly & hands-on instructions available [over at Facebook
33
36
### CLI Switches
34
37
35
38
You can always run the binary with --help to see what options it takes:
39
+
36
40
```
37
41
FBX2glTF 0.9.7: Generate a glTF 2.0 representation of an FBX model.
38
42
Usage: FBX2glTF [OPTIONS] [FBX Model]
@@ -106,7 +110,7 @@ Some of these switches are not obvious:
106
110
- ` --compute-normals ` controls when automatic vertex normals should be computed
107
111
from the mesh. By default, empty normals (which are forbidden by glTF) are
108
112
replaced. A choice of 'missing' implies 'broken', but additionally creates
109
- normals for models that lack them completely.
113
+ normals for models that lack them completely.
110
114
- ` --no-flip-v ` will actively disable v coordinat flipping. This can be useful
111
115
if your textures are pre-flipped, or if for some other reason you were already
112
116
in a glTF-centric texture coordinate system.
@@ -116,7 +120,7 @@ Some of these switches are not obvious:
116
120
will be chosen by default if you supply none of the others. Material switches
117
121
are documented further below.
118
122
- If you supply any ` -keep-attribute ` option, you enable a mode wherein you must
119
- supply it repeatedly to list * all * the vertex attributes you wish to keep in
123
+ supply it repeatedly to list _ all _ the vertex attributes you wish to keep in
120
124
the conversion process. This is a way to trim the size of the resulting glTF
121
125
if you know the FBX contains superfluous attributes. The supported arguments
122
126
are ` position ` , ` normal ` , ` tangent ` , ` color ` , ` uv0 ` , and ` uv1 ` .
@@ -144,10 +148,12 @@ all of which are automatically downloaded and/or built.
144
148
build system will not successfully locate any other version.
145
149
146
150
### Linux and MacOS X
151
+
147
152
Your development environment will need to have:
153
+
148
154
- build essentials (gcc for Linux, clang for Mac)
149
155
- cmake
150
- - python 3.* and associated pip3/pip command
156
+ - python 3.\ * and associated pip3/pip command
151
157
- zstd
152
158
153
159
Then, compilation on Unix machines will look something like:
@@ -165,11 +171,11 @@ else
165
171
fi
166
172
167
173
# Fetch Project
168
- > GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/facebookincubator/FBX2glTF.git
174
+ > git clone https://github.com/facebookincubator/FBX2glTF.git
169
175
> cd FBX2glTF
170
176
171
177
# Fetch and unpack FBX SDK
172
- > curl -sL "${FBXSDK_TARBALL}" | tar xz --strip-components=1 --wildcards */sdk
178
+ > curl -sL "${FBXSDK_TARBALL}" | tar xz --strip-components=1 --include */sdk/
173
179
# Then decompress the contents
174
180
> zstd -d -r --rm sdk
175
181
@@ -198,10 +204,11 @@ versions of the IDE are unlikely to successfully build the tool.
198
204
199
205
Note that the ` CMAKE_BUILD_TYPE ` variable from the Unix Makefile system is
200
206
entirely ignored here; it is when you open the generated solution that
201
- you will be choose one of the canonical build types — * Debug * ,
202
- * Release * , * MinSizeRel * , and so on.
207
+ you will be choose one of the canonical build types — _ Debug _ ,
208
+ _ Release _ , _ MinSizeRel _ , and so on.
203
209
204
210
## Conversion Process
211
+
205
212
The actual translation begins with the FBX SDK parsing the input file, and ends
206
213
with the generation of the descriptive ` JSON ` that forms the core of glTF, along
207
214
with binary buffers that hold geometry and animations (and optionally also
@@ -213,13 +220,14 @@ process happens in reverse when we construct meshes and materials that conform
213
220
to the expectations of the glTF format.
214
221
215
222
### Animations
223
+
216
224
Every animation in the FBX file becomes an animation in the glTF file. The
217
225
method used is one of "baking": we step through the interval of time spanned by
218
226
the animation, keyframe by keyframe, calculate the local transform of each
219
227
node, and whenever we find any node that's rotated, translated or scaled, we
220
228
record that fact in the output.
221
229
222
- Beyond skeleton-based animation, * Blend Shapes * are also supported; they are
230
+ Beyond skeleton-based animation, _ Blend Shapes _ are also supported; they are
223
231
read from the FBX file on a per-mesh basis, and clips can use them by varying
224
232
the weights associated with each one.
225
233
@@ -228,6 +236,7 @@ drawback of creating potentially very large files. The more complex the
228
236
animation rig, the less avoidable this data explosion is.
229
237
230
238
There are three future enhancements we hope to see for animations:
239
+
231
240
- Version 2.0 of glTF brought us support for expressing quadratic animation
232
241
curves, where previously we had only had linear. Not coincidentally, quadratic
233
242
splines are one of the key ways animations are expressed inside the FBX. When
@@ -257,33 +266,37 @@ old workflow often contain baked lighting of the type that would arise naturally
257
266
in a PBR environment.
258
267
259
268
Some material settings remain well supported and transfer automatically:
260
- - Emissive constants and textures
261
- - Occlusion maps
262
- - Normal maps
269
+
270
+ - Emissive constants and textures
271
+ - Occlusion maps
272
+ - Normal maps
263
273
264
274
This leaves the other traditional settings, first of Lambert:
265
- - Ambient — this is anathema in the PBR world, where such effects should
266
- emerge naturally from the fundamental colour of the material and any ambient
267
- lighting present.
268
- - Diffuse — the material's direction-agnostic, non-specular reflection,
269
- and additionally, with Blinn/Phong:
270
- - Specular — a more polished material's direction-sensitive reflection,
271
- - Shininess — just how polished the material is; a higher value here yields a
272
- more mirror-like surface.
275
+
276
+ - Ambient — this is anathema in the PBR world, where such effects should
277
+ emerge naturally from the fundamental colour of the material and any ambient
278
+ lighting present.
279
+ - Diffuse — the material's direction-agnostic, non-specular reflection,
280
+ and additionally, with Blinn/Phong:
281
+ - Specular — a more polished material's direction-sensitive reflection,
282
+ - Shininess — just how polished the material is; a higher value here yields a
283
+ more mirror-like surface.
273
284
274
285
(All these can be either constants or textures.)
275
286
276
287
#### Exporting as Unlit
288
+
277
289
If you have a model was constructed using an unlit workflow, e.g. a photogrammetry
278
290
capture or a landscape with careful baked-in lighting, you may choose to export
279
291
it using the --khr-materials-common switch. This incurs a dependency on the glTF
280
- extension 'KHR_materials_unlit; a client that accepts that extension is making
292
+ extension 'KHR_materials_unlit; a client that accepts that extension is making
281
293
a promise it'll do its best to render pixel values without lighting calculations.
282
294
283
295
** Note that at the time of writing, this glTF extension is still undergoing the
284
296
ratification process**
285
297
286
298
#### Exporting as Metallic-Roughness PBR
299
+
287
300
Given the command line flag --pbr-metallic-roughness, we throw ourselves into
288
301
the warm embrace of glTF 2.0's PBR preference.
289
302
@@ -296,6 +309,7 @@ that route should be digested propertly by FBX2glTF.
296
309
when hooked up to Maya.)
297
310
298
311
## Draco Compression
312
+
299
313
The tool will optionally apply [ Draco] ( https://github.com/google/draco )
300
314
compression to the geometric data of each mesh (vertex indices, positions,
301
315
normals, per-vertex color, and so on). This can be dramatically effective
@@ -309,16 +323,18 @@ viewer that is willing and able to decompress the data.
309
323
ratification process.**
310
324
311
325
## Future Improvements
326
+
312
327
This tool is under continuous development. We do not have a development roadmap
313
328
per se, but some aspirations have been noted above. The canonical list of active
314
329
TODO items can be found
315
330
[ on GitHub] ( https://github.com/facebookincubator/FBX2glTF/labels/enhancement ) .
316
331
317
-
318
332
## Authors
319
- - Pär Winzell
320
- - J.M.P. van Waveren
321
- - Amanda Watson
333
+
334
+ - Pär Winzell
335
+ - J.M.P. van Waveren
336
+ - Amanda Watson
322
337
323
338
## License
339
+
324
340
FBX2glTF is licensed under the [ 3-clause BSD license] ( LICENSE ) .
0 commit comments