Commit Graph

19 Commits

Author SHA1 Message Date
Par Winzell 39cb6bd789 Merge branch 'master' into feat-morph-targets 2017-11-04 20:13:47 -07:00
Pär Winzell 5e0f05261c
Sort triangles with vertex transparency separately. (#32)
Lean on the excellent pre-existing support for creating multiple glTF
meshes from a single FBX mesh based on material type. All the triangles
with (at least one) non-opaque vertex get flagged as transparent
material. They will all go separately in their own mesh after the
CreateMaterialModels() gauntlet.

Fixes #25.
2017-11-04 20:10:28 -07:00
Par Winzell 9520c26649 Drop 0-100 assumptions. Let influences go wild. 2017-11-03 23:36:59 -07:00
Par Winzell 14150269a0 Switch FbxDouble4 uses to FbxVector4, clean up. 2017-11-03 21:48:41 -07:00
Par Winzell ec303a3b8a Tiny but critical logic oops. 2017-10-31 15:09:25 -07:00
Par Winzell 44a9233d4a Disable normal and tangent gathering.
It's always junk. I'm not sure they're ever exported.

We can explore this in greater detail another time.
2017-10-31 15:08:54 -07:00
Par Winzell a8bb38f110 Progressive morphing + tiny critical bugfix 2017-10-30 20:48:46 -07:00
Par Winzell 91a783dc2d Much progress with morph targets.
Everything's in place to drop the progressive morph calculations into
readAnimations(). Shouldn't be hard.

Normals are proving trickier. I'm not convinced they make it into the
FBX at all. The SDK reports the existence of normals in the primary
layer, but they seems to consist exclusively of zeroes.

We may have to compute them.
2017-10-29 22:25:14 -07:00
Par Winzell 77470e236e First functional morph shape export.
- This does not support progressive morphs. Still evaluating whether
  that's required functionality. It's really just a little bit of more
  work. An example implementation is available in the SDK samples.

- We're blithely ignoring NORMALs and TANGENTs. This almost certainly
  has to change.
2017-10-29 01:59:51 -07:00
Par Winzell 075dc4a8c3 Fix and improve inheritance warnings.
We were warnings against eInheritRSrs, which is actually the one type of
ineritance we're good with. It's eInheritRrSs we should freak out about.

That said, no need to do it for the root node -- at that point there is
no global transform to worry about.
2017-10-27 15:47:49 -07:00
Par Winzell db3f232fc9 Cope with geometry opting out of geometry.
Some FBX files have index arrays that contain -1 (indeed, that are
nothing but negative ones). Presumably the intention is to specify "no
material". In any case, let's not segfault.
2017-10-24 20:57:55 -07:00
Par Winzell 5580dcfa92 Whitespace tweaks in log output. 2017-10-23 18:59:32 -07:00
Pär Winzell 8cf7f446b7 Further improvemens to texture resolution. (#16)
* Further improvemens to texture resolution.

- Move towards std::string over char * and FbxString where convenient,
- Make a clear distinction between textures whose image files have been
  located and those who haven't; warn early in the latter case.
- Extend RawTexture so we always know logical name in FBX, original file
  name in FBX, and inferred location in local filesystem.
- In non-binary mode, simply output the inferred local file basename as
  the URI; this will be the correct relative path as long as the texture
  files are located next to the .gltf and .bin files.

Primary remaining urge for a follow-up PR:

- We should be copying texture image files into the .gltf output folder,
  but before that we should switch to an off-the-shelf cross-platform
  file manipulation library like https://github.com/cginternals/cppfs.
  When we make that transition, all this texture resolution code will
  undergo another refactoring.
2017-10-20 09:42:39 -07:00
Par Winzell bc803213fc Delete obsolete snippets. 2017-10-17 21:19:36 -07:00
Par Winzell bf28c29f50 Multiple fixes for transparency.
- alphaMode is only BLEND for transparent materials.
- We use RawMaterial.type to figure out what's transparent.
- FBX TransparencyFactor is not opacity, but 1.0-opacity.
- Treat vertex coloured materials as transparent
  - We should at least iterate over vertices here and see if any of them
    actually are transparent
- Sort triangles properly: transparent ones render last!
2017-10-17 21:14:52 -07:00
Par Winzell b44d3b19a8 Fix build across all platforms. 2017-10-17 17:56:21 -07:00
Par Winzell f2a057d783 Do a better job resolving texture files.
- Nix GetFileFolder(). It was not helping. Always search for textures
- near the FBX file.
- Use RawTexture::name for the texture name and ::fileName for the
  inferred local filename path.
2017-10-16 23:31:19 -07:00
Par Winzell e9067850e1 Break out material property & texture code.
Digging the property values and texture shadows thereof, associated with
a certain FbxSurfaceTexture, should clearly happen once per material,
not per polygon. Furthermore there is a pre-existing pattern of
Fbx-specific accessclasses in Fbx2Raw that we should follow.

Soon we'll be extracting more than Phong/Lambert properties here, and
then we'll need to do further refactoring.
2017-10-16 23:12:57 -07:00
Par Winzell 276a0dfb86 Initial commit. 2017-10-13 01:55:11 -07:00