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

Emiliano/210 #852

Merged
merged 8 commits into from
Feb 27, 2017
Merged

Emiliano/210 #852

merged 8 commits into from
Feb 27, 2017

Conversation

emilian0
Copy link
Contributor

Implementing Morph Targets as discussed in #210.
@lexaknyazev all yours!

#### Morph Targets

Morph Targets are defined by extending the Mesh concept.
A Morph Target is a morphable Mesh where primitives' attributes are obtained by adding the original attributes to a weighted sum of targets attributes (this operation corresponds to COLLADA's `RELATIVE` blending method).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to show equation than use external COLLADA reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed. Thanks


Morph Targets are defined by extending the Mesh concept.
A Morph Target is a morphable Mesh where primitives' attributes are obtained by adding the original attributes to a weighted sum of targets attributes (this operation corresponds to COLLADA's `RELATIVE` blending method).
Morph Targets are implemented via the `targets` property defined in the Mesh `primitives`. Each target in the `targets` array is a dictionary mapping a primitive attribute to a Morph Target displacement, currently only two attributes ('POSITION' and 'NORMAL') are supported. All primitives are required to list the same number of `targets` in the same order.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each target ... mapping a primitive attribute to a Morph Target displacement

... mapping a primitive attribute to an accessor containing Morph Target displacement data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks

]
}
],
"weights": [0, 0.5]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still not quite obvious to me, why do we have two ways of defining initial morph state: mesh.weights and node.weights. Just asking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mesh.weights are the Morph Targets default weights.
node.weights are the instantiated Morph Targets weights (that override the weights of the mesh).
Say that you have a Morph Target, it is a character face. You want to instantiate it multiple times in your scene, and you want to instantiate it as a smiling face. Then just set the default mesh.weights accordingly (make it smile!) and don't set the instantiation weights node.weights when you instantiate it within a node.
Makes sense?

@@ -31,6 +31,14 @@
"default" : 4,
"gltf_detailedDescription" : "The type of primitives to render. All valid values correspond to WebGL enums."
},
"targets" : {
"type" : "array",
"description" : "An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only "POSITION" and "NORMAL" supported) to their deviations in the Morph Target.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-quotes must be escaped here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks

@emilian0
Copy link
Contributor Author

@lexaknyazev I addressed your concerns, back to you. Thanks

@lexaknyazev lexaknyazev merged commit fef81f5 into 2.0 Feb 27, 2017
@emilian0 emilian0 deleted the emiliano/210 branch March 22, 2017 01:26
@emilian0 emilian0 restored the emiliano/210 branch March 22, 2017 01:48
@lexaknyazev lexaknyazev deleted the emiliano/210 branch April 21, 2017 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants