Commit Graph

146 Commits

Author SHA1 Message Date
K. S. Ernest (iFire) Lee 1ef0916f01 Restore building for Linux. 2021-06-06 16:18:01 -07:00
Henrik Halen 4f63da8e5f Allow arbitrary number of skinning weights.
Controlled through command line parameter. Defaults to 4 skinning weights.
2019-12-25 15:04:25 -08:00
Jordy van Dortmont 94f3a6783b Fixed morph target names 2019-12-25 06:12:12 -08:00
vfxgordon 1d735698ba Morph target names output to mesh.extras.targetNames (#231) 2019-10-07 16:46:38 -07:00
Pär Winzell 3c08169510 Prepare patch release 0.9.7. 2019-08-10 09:33:02 -07:00
Jesse Vander Does 44d2d5bf97 Write `.gltf` to parent directory & infer binary from `.glb` (#193)
If the output extension is gltf then set the output directory to the parent. The binary and any associated textures will be written to this directory.
2019-08-07 09:35:17 -07:00
Pär Winzell 24092a80bb Use the correct camera property.
Looks like FieldOfViewX/FieldOfViewY are only well-defined when
aperture mode is eHorizAndVert. Use FieldOfView instead.

Fixes #209.
2019-08-06 17:48:45 -07:00
Pär Winzell 31e3665862 Minor cleanup. 2019-08-06 17:22:30 -07:00
Pär Winzell 7b39358f46 Be explicit in our list-initialisation.
This caused https://github.com/facebookincubator/FBX2glTF/issues/218
in ways that I honestly don't fully understand, and I believe only under
Windows, with Release-level optimisation turned on.

It's possible we should drop all these initializer lists, and replace
them with simple and explicit initialising constructors.

Fixes #218.
2019-08-06 16:36:19 -07:00
Leslie Leigh 648fdfb944 Add option "--fbx-tmp-dir" (#219)
Merge code from @shrinktofit that allows control over where temporary files are created.

(Most commonly the .fbm directory where the SDK extracts embedded resources.)
2019-08-06 08:39:59 -07:00
“Brandon 3daf2b712a Fix issue where code segfaults when surface material is missing
Ignores missing material and warns user of bad FBX

Only edge case is handled while previously working models should operate as before
2019-07-18 09:35:44 -07:00
Par Winzell 9853625ba1 Fix logic error.
Thanks @C0lumbo. This fixes #202.
2019-06-04 22:48:25 -07:00
Par Winzell 8e5ded122e Argh. This is the actual commit intended. 2019-05-05 01:21:25 -07:00
Par Winzell df00e0538d Ignore animation 'takes', calculate frame intervals ourselves.
Lifted from comment in source:

Individual animations are often concatenated on the timeline, and the
only certain way to identify precisely what interval they occupy is to
depth-traverse the entire animation stack, and examine the actual keys.

There is a deprecated concept of an "animation take" which is meant to
provide precisely this time interval information, but the data is not
actually derived by the SDK from source-of-truth data structures, but
rather provided directly by the FBX exporter, and not sanity checked.

Some exporters calculate it correctly. Others do not. In any case, we
now ignore it completely.
2019-05-05 01:00:53 -07:00
Par Winzell a07cabd1ec eTotalOne is strictly a subset of aNormalize. 2019-05-03 21:48:51 -07:00
Pär Winzell 4b501431fe
License -> BSD (#186)
Relicense FBX2glTF as BSD.
2019-05-03 16:13:18 -07:00
Pär Winzell 7970914dd0 Delete spurious (and utterly broken) log line. 2019-04-20 22:08:24 -07:00
Pär Winzell 7dd8438c78
Embrace Conan, use it to grab boost::filesystem. (#180)
With this, we are able to get rid of all the increasingly broken file
system utility code, and trust boost::filesystem to handle all the
cross-platform complexity.

The first version of this PR centred around C++17 & std::filesystem,
but support remains too elusive; it seems works out of the box in
Visual Studio (especially 2019), but is entirely missing from the Mac
dclang, and even with GCC 8.0 it requires an explicit '-l c++fs'.

Luckily the std:: version is almost exactly the boost:: version (not
surprising) so when the world's caught up, we can ditch Boost and go
all stdlib.

Setting up Conan requires a bit of work; we'll want to document the
details in the README.
2019-04-19 23:54:11 -07:00
Simon 4bb4bdbac1 animation framerate option 2019-04-18 09:24:38 -07:00
hhalen 13f463d336 Fix skinning weight normalization. Previous code would call Normalized() on a Vec4f containing the weights. This normalizes the vector, i.e. makes the length of the vector equal to 1.0. For skinning weights what we want is the sum of the weights to be 1.0, which is a different. This commit fixes that. 2019-04-09 10:12:11 -07:00
Pär Winzell 769454e964 This all needs rewriting, but at least let's make it not crash on Windows. 2019-04-07 15:18:13 -07:00
Par Winzell 11398f6acb This is an expected case and shouldn't be logged. 2019-04-03 11:57:20 -07:00
Par Winzell 910a8bfdd0 Left-over debug line. 2019-04-03 10:37:13 -07:00
Par Winzell 1f21a50cc9 Fix the previous fixes.
Alright, less haphazardly now after the two previous botched commits,
this fixes mistakes and bugs made a year or more in the past:
 - We now always pass the metallic and roughness factors through all
   the way to the glTF layer. They should not be multiplied into the
   generated textures, and so they should be present as-is in glTF
   output.
 - We only generate the AO/Rough/Net combined texture if at least two
   of the constituent textures are present.
 - We only reference the generated texture as an occlusionTexture if
   there really was an occlusion map present (and it had non-trivial
   pixels).

It's also now ridiculously clear that:
 - The material conversion section is long and tortured and it's very
   easy to screw up. It should be broken into functions and classes.
 - We urgely need a real regression suite, and we need to model some
   artificial FBX files that test both realistic scenarios and edge-
   case permutations.
2019-03-29 19:56:33 -07:00
Par Winzell 46f6234af5 Fix previous fix. 2019-03-29 10:29:59 -07:00
Par Winzell d2f7d0e270 Generally repair old broken logic around aoMetRough texture. 2019-03-29 09:59:57 -07:00
Michael Tostenson 9c114ffa49 Only create aoMetRoughTex when metalnesss or roughness texture provided 2019-03-26 17:28:10 -07:00
abbaswasim 678a9bf844 Fix typo (#167)
Corrects spelling of `roughness`
2019-03-11 12:45:38 -07:00
Par Winzell a596073f04 Identify materials by unique ID, not name.
At the end of the various material/mesh transformations we do, we were still using a ridiculously simplistic method of mapping RawMaterial to glTF MaterialData.

This switches to using FBX's GetUniqueID(), which should be the law of the land in general. Other model entities may need further investigation as well.
2019-02-24 19:32:13 -08:00
Par Winzell e83d495fdc Fix Draco. How long was this broken? 2019-02-22 23:02:14 -08:00
Par Winzell 713ee2f879 Tiny type tweak. 2019-02-22 17:15:42 -08:00
Par Winzell 70c3823eb7 Fix 'spot' light export. 2019-02-21 12:45:02 -08:00
Par Winzell ffd6af3142 Fixes to lights. Oops. 2019-01-25 15:14:37 -08:00
Par Winzell ce2a9f8d85 Handle 'inverse roughness' flag. 2019-01-25 14:33:53 -08:00
Par Winzell d0883136d3 First cleaned-up, consistent physical material implementation.
There's still work to be done here, mainly:
 - Convert BUMP to NORMAL
 - Apply "roughness inversion" to roughness map

But it now informs the user of unsupported properties their model uses,
and generally works correctly!
2019-01-25 10:51:30 -08:00
Par Winzell a3bee2e42a Tiny order tweak. 2019-01-24 17:03:24 -08:00
Par Winzell 12025de179 Don't discriminate textures only by FBX logical name.
We don't want to use the logical texture name from the FBX to distinguish separate textures. It seems entirely valid for distinct textures to have the same name. It's not completely clear what's best to use instead, but adding fileLocation seems reasonable. It can be blank, for textures that don't exist on the filesystem –– but that's a pretty weird edge case, and even then we have both 'usage' and 'name' to distinguish.
2019-01-24 16:59:36 -08:00
Par Winzell d451aa73f3 Delete obsolete classes, poke at Physical Material support.
Looks like I never did the required cleanup after my accidental commit back in August.
This deletes the materials classes that were obsoleted back then, and comments out the
large swathes of PhysicalMaterial code that's not currently doing anything (i.e. all the
materials properties that glTF can't currently represent.)
2019-01-16 13:52:33 -08:00
Par Winzell 1328a4b96f Another, better argument parsing fix. 2019-01-11 20:47:08 -08:00
Par Winzell 5c07d274c3 Fix broken U/V flipping. 2019-01-11 19:38:33 -08:00
Par Winzell 1145defda3 Use case-insensitive matching on old shader types. 2018-12-19 14:22:58 -08:00
Pär Winzell 5730d1c301
Apply clang-format to all our source. (#149)
Apply clang-format to all our source.
2018-12-18 23:30:29 -08:00
Pär Winzell be1b75431d
Switch from CXXOPTS to CLI11. (#148)
We want to move to auto-formatting all our code, and it just seemed impossible
to make cxxopts usage tidy under clang-format's dominion. While trying to work
out its quirks, I realised that CLI11 did everything I wanted much better, and
so we've switched.

We're also going to chuck the usage of ExternalProject_Add(), at least for the
simplest use cases such as single-header include files. We'll just commit them
directly; that's kind of the whole point.

The one discipline we'll maintain is that commits that involve third_party/
should be as self-contained as possible (without breaking the app).
2018-12-17 16:13:53 -08:00
Par Winzell 5389d848e2 Implement KHR_lights_punctual. 2018-12-17 10:21:43 -08:00
Par Winzell 49892c5e83 Abstract out user property serialisation. 2018-12-14 00:05:43 -08:00
Graham Wihlidal f2cb6a1010 Fix various tabs vs spaces formatting inconsistencies 2018-12-13 23:00:05 -08:00
Graham Wihlidal 8b081a5fc3 Implemented support for exporting user properties assigned to materials 2018-12-13 23:00:05 -08:00
Par Winzell 7374bcf34f No default argument in implementation. 2018-12-12 12:46:45 -08:00
Pär Winzell 62bb8710c0 Fix cross-platform path handling.
This is a recreation of the PR @robertlong submitted long ago here:
https://github.com/facebookincubator/FBX2glTF/pull/97

Refactors and whitespace conflicts made this easier.

There is still a substantial rewrite of the texture-loading and
file-path handling pending, for sometime soon.
2018-12-07 09:40:21 -08:00
Par Winzell 2029fa7277 Delete unused variable. 2018-12-02 19:02:24 -08:00