Skip to content

Commit da5d606

Browse files
author
Par Winzell
committed
Documentation tweaks.
1 parent 608c6f1 commit da5d606

File tree

2 files changed

+28
-40
lines changed

2 files changed

+28
-40
lines changed

README.md

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The tool can be invoked like so:
1717

1818
Or perhaps, as part of a more complex pipeline:
1919
```
20-
> FBX2glTF --binary --draco --khr-materials-common \
20+
> FBX2glTF --binary --draco --verbose \
2121
--input ~/models/source/butterfly.fbx \
2222
--output ~/models/target/butterfly.glb
2323
```
@@ -41,18 +41,18 @@ Usage:
4141
behaviour!)
4242
--no-flip-v Suppress the default flipping of V texture
4343
coordinates
44-
--khr-materials-common (WIP) Use KHR_materials_common extensions to
45-
specify Unlit/Lambert/Blinn/Phong shaders.
46-
--pbr-metallic-roughness (WIP) Try to glean glTF 2.0 native PBR
47-
attributes from the FBX, or make a best effort
48-
to convert from traditional shader models.
49-
--pbr-specular-glossiness
50-
(WIP) Very experimentally employ the
51-
KHR_materials_pbrSpecularGlossiness extension.
44+
--pbr-metallic-roughness Try to glean glTF 2.0 native PBR attributes
45+
from the FBX.
46+
--khr-materials-unlit Use KHR_materials_unlit extension to specify
47+
Unlit shader.
5248
--blend-shape-normals Include blend shape normals, if reported
5349
present by the FBX SDK.
5450
--blend-shape-tangents Include blend shape tangents, if reported
5551
present by the FBX SDK.
52+
--long-indices arg Whether to use 32-bit indices
53+
(never|auto|always).
54+
--compute-normals arg When to compute normals for vertices
55+
(never|broken|missing|always).
5656
-k, --keep-attribute arg Used repeatedly to build a limiting set of
5757
vertex attributes to keep.
5858
-v, --verbose Enable verbose output.
@@ -73,6 +73,12 @@ Some of these switches are not obvious:
7373
Your FBX is likely constructed with the assumption that `(0, 0)` is bottom
7474
left, whereas glTF has `(0, 0)` as top left. To produce spec-compliant glTF,
7575
we must flip the texcoords. To request unflipped coordinates:
76+
- `--long-indices` lets you force the use of either 16-bit or 32-bit indices.
77+
The default option is auto, which make the choice on a per-mesh-size basis.
78+
- `--compute-mormals` controls when automatic vertex normals should be computed
79+
from the mesh. By default, empty normals (which are forbidden by glTF) are
80+
replaced. A choice of 'missing' implies 'broken', but additionally creates
81+
normals for models that lack them completely.
7682
- `--no-flip-v` will actively disable v coordinat flipping. This can be useful
7783
if your textures are pre-flipped, or if for some other reason you were already
7884
in a glTF-centric texture coordinate system.
@@ -216,19 +222,15 @@ and additionally, with Blinn/Phong:
216222

217223
(All these can be either constants or textures.)
218224

219-
#### Exporting as Unlit/Lambert/Phong
220-
If you have a model was constructed using the traditional workflow, you may
221-
choose to export it using the --khr-materials-common switch. This incurs a
222-
dependency on the glTF extension 'KHR_materials_common'; a client that accepts
223-
that extension is making a promise it'll do its best to render i.e. Lambert or
224-
Phong.
225-
226-
You can use this flag even for PBR models, but the conversion is imperfect to
227-
say the least, and there is no reason why you would ever want to do such a
228-
thing.
225+
#### Exporting as Unlit
226+
If you have a model was constructed using an unlit workflow, e.g. a photogrammetry
227+
capture or a landscape with careful baked-in lighting, you may choose to export
228+
it using the --khr-materials-common switch. This incurs a dependency on the glTF
229+
extension 'KHR_materials_unlit; a client that accepts that extension is making
230+
a promise it'll do its best to render pixel values without lighting calculations.
229231

230232
**Note that at the time of writing, this glTF extension is still undergoing the
231-
ratification process, and is furthermore likely to change names.**
233+
ratification process**
232234

233235
#### Exporting as Metallic-Roughness PBR
234236
Given the command line flag --pbr-metallic-roughness, we throw ourselves into
@@ -242,20 +244,6 @@ that route should be digested propertly by FBX2glTF.
242244
(A happy note: Allegorithmic's Susbstance Painter also exports Stingray PBS,
243245
when hooked up to Maya.)
244246

245-
If your model is not a Stingray PBS one, but you still wish to export PBR
246-
(perhaps you want to generate only core glTF wirhout reliance on extensions),
247-
this converter will try its best to convert your old textures. It calculates, on
248-
a pixel by pixel basis, reasonable values for base colour, metallicness and
249-
roughness, using your model's diffuse, specular, and shinines textures.
250-
251-
It should noted here that this process cannot ever be perfect; this is very much
252-
an apples and oranges situation.
253-
254-
A note of gratitude here to Gary Hsu who developed the formulae we use for this
255-
process. They can be eyeballed
256-
[here](https://github.com/KhronosGroup/glTF/blob/master/extensions/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows/js/three.pbrUtilities.js)
257-
for the curious.
258-
259247
## Draco Compression
260248
The tool will optionally apply [Draco](https://github.com/google/draco)
261249
compression to the geometric data of each mesh (vertex indices, positions,

src/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ int main(int argc, char *argv[])
5757
(
5858
"b,binary", "Output a single binary format .glb file.",
5959
cxxopts::value<bool>(gltfOptions.outputBinary))
60+
(
61+
"long-indices", "Whether to use 32-bit indices (never|auto|always).",
62+
cxxopts::value<std::vector<std::string>>())
6063
(
6164
"d,draco", "Apply Draco mesh compression to geometries.",
6265
cxxopts::value<bool>(gltfOptions.useDraco))
66+
(
67+
"compute-normals", "When to compute normals for vertices (never|broken|missing|always).",
68+
cxxopts::value<std::vector<std::string>>())
6369
("flip-u", "Flip all U texture coordinates.")
6470
("flip-v", "Flip all V texture coordinates (default behaviour!)")
6571
("no-flip-v", "Suppress the default flipping of V texture coordinates")
@@ -75,12 +81,6 @@ int main(int argc, char *argv[])
7581
(
7682
"blend-shape-tangents", "Include blend shape tangents, if reported present by the FBX SDK.",
7783
cxxopts::value<bool>(gltfOptions.useBlendShapeTangents))
78-
(
79-
"long-indices", "Whether to use 32-bit indices (never|auto|always).",
80-
cxxopts::value<std::vector<std::string>>())
81-
(
82-
"compute-normals", "When to compute normals for vertices (never|broken|missing|always).",
83-
cxxopts::value<std::vector<std::string>>())
8484
(
8585
"k,keep-attribute", "Used repeatedly to build a limiting set of vertex attributes to keep.",
8686
cxxopts::value<std::vector<std::string>>())

0 commit comments

Comments
 (0)