Commit Graph

186 Commits

Author SHA1 Message Date
Par Winzell 366e904b70 FB Copyright compliance. 2019-04-22 08:45:05 -07:00
Pär Winzell 7970914dd0 Delete spurious (and utterly broken) log line. 2019-04-20 22:08:24 -07:00
Par Winzell 5ba62a726c these were never meant to be here 2019-04-19 23:58:13 -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
Par Winzell 4ed510ca8e Add required Facebook copyright headers. 2019-04-17 18:06:09 -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
Par Winzell 9c76e5ade1 Stop testing if conversion failed. 2019-04-07 18:33:27 -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 9e6ab31e37 Oops, forgot to actually commit json.hpp. 2019-04-03 09:58:48 -07:00
Par Winzell c6ed20a45a Commit JSON header-only dependency to our repo. 2019-03-29 20:05:01 -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
Pär Winzell ca78a31b22
Merge pull request #171 from mtostenson/master
Only create aoMetRoughTex when metalnesss or roughness texture provided.

Following up with tweak commit.
2019-03-29 09:31:44 -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
Pär Winzell b8d587d2c7
Add link to bleeding-edge builds. 2019-02-25 09:31:15 -08: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 4780efdc6f Extend tests a bit. 2019-02-24 17:42:13 -08:00
Par Winzell a3841fe7cd Formatting-only change. 2019-02-23 23:51:05 -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 9d4a599d0c Pin STB header files at working versions. 2019-02-22 17:11:34 -08:00
Par Winzell f170772f8a Use gltf-validator that knows about KHR_lights_punctual. 2019-02-21 12:50:09 -08:00
Par Winzell 70c3823eb7 Fix 'spot' light export. 2019-02-21 12:45:02 -08:00
Pär Winzell 5ec3184a8a
Mocha integration test suite (#150)
This moves ./npm to ./npm/fbx2gltf, and introduces a Mocha / TypeScript based testing harness. 

We're also adding a GIT LFS dependency, but only for people who want to run tests. We're using LFS to store the many FBX models we want to convert to GLB as part of the integration test suite.
2019-01-25 16:01:08 -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 09089a7d79 Create a compilation database. 2018-12-16 12:41:40 -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
Par Winzell f71be404f4 Remaining fixes for 2019.2. 2018-12-07 09:52:38 -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 c1faf6b822 I'm going to stab someone. 2018-12-04 10:01:07 -08:00
Par Winzell 90e5bef116 Better iconv handling. Jeez, CMake... 2018-12-04 09:54:08 -08:00