Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small mesh/armature/animation improvements #31

Merged
merged 54 commits into from
Aug 15, 2018
Merged

Small mesh/armature/animation improvements #31

merged 54 commits into from
Aug 15, 2018

Conversation

scurest
Copy link
Collaborator

@scurest scurest commented Jul 21, 2018

  • Includes my fix for Importer duplicates accessors in memory for every mesh that references it, causing extreme memory usage #29. I don't know for sure if it is fixed by that, but we need the change I made anyway.
  • Animation interpolation is set. Rotation always goes the short way round (try AnimatedTriangle for example).
  • Restrictions about overlapping armatures/skeleton properties being required were lifted.
  • And most importantly, the user can select a bone rotation! Try CesiumMan with XYZ rotations of 90d/0/0 and the model will actually look fairly good in Blender for once :)

@ksons Something bad happened when you merged the last PR and you lost the git history and people like cinghiale didn't manage to get credited as contributors. It made it really difficult to merge master into this branch and it's also why Github is listing all the commits from the last PR again. This PR has all the history intact so if you can do a normal merge this time that should be fixed 👍

scurest and others added 30 commits March 19, 2018 12:47
This removes support for skinning.
of the Blender camera, while the `aspectRatio`, if present, affects
the resolution instead of the `angle_x` (since the latter is computed
from the `angle_y` and the resolution in Blender)
...using just one cache-lookup function instead of one for every
different type of object.
RGBA vertex colors are supported (required) by Blender 2.79 it
appears.
Based on creating first a virtual forest that mirrors the scene
graph we're about to create in Blender. Details to be documented
later... if it works out :)
Skinning is now working (again (again))...
Messy and VERY slow for the moment, but functional so I'm commiting
it for my own reference.
Comments explained the main reasoning behind the bone function.

Also switching from keyframe_points.insert to the add/co loop
gave a **huge** performance boost.
This is for faster slicing.

This doesn't make any apparent impact on import times but hopefully
it saves some memory ^^;
...because 4-component vertex colors are assumed.

Should we use some shims to papers over the Blender version
differences and get greater support? I don't have access to !=2.79
vresion atm though so it doesn't matter for now.
They don't point the right way or anything but they're there :)
But have an option to just put everything into the current scene
too (I like that better).
This prevents loading the same one multiple times.
Using the groups from the exporter, thus relieving us form writing
all our own node groups.

The group for Specular Glossiness is also part of the serialized
data, so supporting that is getting closer.
We add superfluous COLOR_0 layers to any mesh that uses a material
that is ever applied to a primitive that has a COLOR_0 attribute.
This let's us add an Attribute node to those materials without the
problem of solid red colors coming in.

COLOR_1, etc. are still not supported (well, they're imported of
course, they just don't influence the materials).
- Avoid creating dummy vnodes for meshes when possible.
- Rotate cameras to their (correct?) position
- Some slightly tighter docs.
- Some more robustness in realizing vnodes; it would probably be
  possible to use an armature for the whole forest again with minimal
  code changes
Animating non-bone locations should work now. Curve clean-up should
be working too.
The vtree beneath an armature should now be all bones except
possibly at the leaves, and we should realize them correctly(?)
now.

Also fix a typo with mesh names.
Avoids confusion with the similarly named node_groups stuff.
Support for pbrSpecularGlossiness was added here too.
Such as they are, anyway.
scurest added 20 commits July 15, 2018 11:28
...by using multiple attributes sets. We anticipate here, since
though there is a PR for this, it hasn't been merged into the spec
yet.
If the accessor was used again later in the glTF, we would have
seen a modified array since we hard-modified the accessor elements.
Avoid doing this.
If the joints were eg. [0,0,0,0] and the weights were [1,0,0,0],
previously we would overwrite the weight for 0 three times so it
ended up as 0. Now it will correctly be 1.
We hardly have to do anything since Blender will already handle DDS
textures so we might as well. Untested though.
I initially thought the pose TRS was computed from (final TRS) *
(rest TRS)^{-1} (ie. the opposite order of multiplication from what
I now believe is correct.) Under this scheme, the pose components
could depend on multiple final components, which required bringing
the curves under a common domain. But under the correct order of
multiplication each pose components depends only on its corresponding
final component (and the rest TRS) so that turns out to have been
over-complicated and, thank God, we can finally get rid of it!

Though, alas! it does not fix Monster.
This ensures that COLOR_0 is always the first (and ensures Blender
thinks its the default, for eg. TEXCOORD_0 and UV maps?) and avoids
any gaps in the sequence of X.
- Pick better bone lengths (when the bones are rotated the armature
  actually looks plausible now)
- Report a warning when bones had non-unit scalings in the glTF
Also fix a typo that mysteriously did not prevent Blender from
figuring out what the fcurves were targeting.
For example, try rotating the bones in CesiumMan or Monster by 90d
in the X direction to get the skeleton to look correct.

I am somewhat uncertain of the math for this.
See KhronosGroup/glTF/issues/1395. Observe the difference in
AnimatedTriangle or the low-poly fox.
Just so the user knows. Very minor, theoreteical fix for bone
lengths too.
The restriction about overlapping armatures is lifted and we no
longer require a skeleton property.
This makes it more like what you'd by adding keyframes by hitting I
Fix a typo that created superfluous actions.
Always make the first animation the one that plays by default.
Fix setting of the default action on armatures.
Don't let Blender delete unused actions.
@scurest scurest mentioned this pull request Jul 26, 2018
@ksons ksons merged commit 803f56e into ksons:master Aug 15, 2018
ksons added a commit that referenced this pull request Aug 15, 2018
@scurest scurest deleted the dev branch August 25, 2018 17:56
ksons added a commit that referenced this pull request Oct 17, 2018
ksons added a commit that referenced this pull request Oct 17, 2018
ksons added a commit that referenced this pull request Oct 17, 2018
ksons added a commit that referenced this pull request Oct 17, 2018
@ksons
Copy link
Owner

ksons commented Oct 17, 2018

Reverted as I squashed the history which makes it difficult to merge the subsequent PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants