-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Basic Morph Syntax #210
Comments
Thanks @tparisi
|
I can't really answer fully this until I got preliminary support in the converter. |
I will try check OpenCOLLADA support wrt morphing this week and provide some time estimates. |
@fabrobinet post 1.0? |
yes post 1.0 |
agreed On Tue, Nov 25, 2014 at 9:42 AM, Fabrice Robinet [email protected]
Support the VR Revolution: check out my DIYVR Kickstarter at Tony Parisi [email protected] Read my books! Programming 3D Applications in HTML5 and |
@pjcozzi I assume morphs and non-linear interpolation are still after v1.0? the schema implies that; so, wondering why you removed the "post 1.0" tag.... |
Yes, still post 1.0. There is no post 1.0 tag anymore. Everything not 1.0 is post 1.0. We'll prioritize after we get the spec out. |
great. thanks On Tue, Sep 22, 2015 at 11:21 AM, Patrick Cozzi [email protected]
Tony Parisi [email protected] Read my books! Programming 3D Applications in HTML5 and |
Yes, always scalar. I think the assumption is that you may have multiple target geometries in the
A reference to one or many geometries that are blended with the base mesh in a weighted fashion, right?
I agree that supporting only the |
The only advantage I see in keeping the RELATIVE mode around is in more efficient transmission (displacement targets have lots of zeros so they compress well). |
A look from implementation side (WebGL 1.0 (ES 2.0) caps only): We've got 16 guaranteed vertex attributes. Positions, normals, tangents, UV_0&1 (could be packed), skin weights, skin joints - took at least 6 (if we calculate bi-tangents in shaders). Remaining 10 could be spent on 5 morph targets (positions + normals) with weights controlled by uniforms. So, runtime should bind needed morph targets (no more than 5), and animate/blend them via uniform updates. Is that correct? |
Yes, thank you for bringing up the implementation conversation. |
With no asset-provided shaders, we need to agree on one particular layout (e.g. 4/4) or introduce more parameters. |
There's more modern approach based on transform feedback. This should be supported with WebGL 2.0 (ES 3.0). Should we design morph targets with that in mind? Also, to use morph targets, we need to bind them with animations and that could be tricky, because each keyframe must contain either all possible targets (and engine will bind top 4-5 targets with non-zero weight), or explicitly bind each target each keyframe. One more option is to forbid mixing more than 4-5 targets in one animation channel. |
Yes, I believe we should design morph targets with more than one API in mind (WebGL1, 2 and more advanced APIs as well). |
Of course, we do. So, let's go through different morph workloads:
It seems to me that there could be a noticeable performance gap in handling complex morph/skin animations when running on different runtimes. |
Yes, performance and/or experience gap. |
First thoughts about glTF side, maybe not 100% correct. It should be clear how many morph targets a mesh has, what is the maximum value of active targets count. |
Why do we have Is it reasonable to use the same weight for all mesh primitives? Could only one primitive of the mesh have morph targets? Let's keep only RELATIVE mode. It implies fewer runtime computations. Transform feedback-based implementation would be also simpler than with NORMALIZED. On morph's self-containedness:
It looks like |
@pjcozzi re: "is target.name is truly valuable? ". I see little to no value in having specifying targets name for a run-time (not editing) format. So it makes sense for me to move it to an extension. Sounds good? |
Instead of moving |
@pjcozzi re: "blending vertex colors or UVs". I am checking with our artists what is their experience with morph targets blending UVs or vertex colors. I have none. I see how that can be useful. But I also see how this can make implementation (expecially on Webgl 1.0) much harder ( @lexaknyazev feel free to chime in). So, unless I hear something from our artists (or anyone objects), I suggest to only support POSITION and NORMALS for now. Sounds good? |
@lexaknyazev : The idea is to have
|
@lexaknyazev I am pleased we agreed on the RELATIVE mode only! |
@lexaknyazev I was thinking the same: extend the concept of mesh to make it include the case of morphable meshes. This is quite a change, I will spec it out and ping all of you for an additional pass. |
Yes, thanks! |
@tparisi @pjcozzi @lexaknyazev, here the update on morph targets. Please take a look and let me know what you think. Unfortunately we don't have many iteration cycles left before tomorrow. Morph TargetsMorph Targets are defined in glTF 2.0 as an extension to the Mesh concept. Here a sample JSON defining a morph target: {
"meshes": [
{
"primitives": [
{
"attributes": {
"NORMAL": 25,
"POSITION": 23,
"TEXCOORD_0": 27
},
"indices": 21,
"material": 3,
"mode": 4,
"targets": [
{
"NORMAL": 35,
"POSITION": 33,
},
{
"NORMAL": 45,
"POSITION": 43,
},
]
}
]
}
]
} Instantiating a morph on a node together with skinning: {
"mesh": 1,
"skeletons": [21],
"skin": 0,
"weights":[0.0 0.5],
"targets":[0 1]
} The (optional) Animating a morph. Sample of animation of both skin and morph: "animations": [
{
"name": "Animate all properties of one node with different samplers",
"channels": [
{
"sampler": 0,
"target": {
"id": 1,
"path": "rotation"
}
},
{
"sampler": 1,
"target": {
"id": 2,
"path": "translation"
}
},
{
"sampler": 2,
"target": {
"id": 1,
"path": "weights"
}
},
{
"sampler": 3,
"target": {
"id": 1,
"path": "activeTargets"
}
}
]
}] |
How tangent-space should be reconstructed for normal maps to work with morphed mesh? We must provide exact math there. Here's relevant excerpt from GPU Gems:
Maybe, clarify also that all primitives must have the same number of targets (do they?).
Since reading and sorting will be done on CPU, we can leave them
I understand that, but it's almost inevitable with WebGL 1.0 (three.js supports 8 targets if they contain only positions, no normals). With WebGL 2.0, engines could use iterative approach via Transform Feedback and apply targets in batches of 4 (e.g., 12 active targets need 3 passes). Only with OpenGL ES 3.1+ (no web equivalent yet), it will be possible to access buffer data directly from shader and apply any number of targets in one pass. |
@lexaknyazev agree on the first two points. regarding
That is ok, it is a little of work for the runtime though, since that prevents decoupling between animations and morph target (it can't blend the animation curves before it knows what morph target they are for). Anyway this simplifies a lot the format, I am on board with this. Considering these changes should I go ahead and make a pull request? |
@lexaknyazev I would like to leave tangent/binormal computation out of the draft and up for discussion. It seems like different shaders implementers use different techniques to compute them and I don't see a reason to pick the one above (aside from the fact that it was published on GPU gems). sounds good? |
I'm not following. glTF doesn't yet support any kind of animation blending. Could you provide an example of what we could lose?
I've used it just as an example. We haven't settled with tangent-space storage for non-morphed meshes yet.
That's fine. I think, we should provide "default" technique in spec appendix or at least give some hints. |
Great I agree on providing a "default" technique in the appendix. By decoupling I meant: the evaluation of the morph targets animation curves (linear or bezier in the future) requires knowledge of the destination Morph Target object (i.e. # of weights). Anyway this is a detail, I am not concerned about this. Let's roll out the draft! |
…escription.It loooks like the animation example is old (glTF1.0) I am leaving it as is to avoid conflicts
@lexaknyazev please take a look at |
Updated in #826 |
Here is an example of the basic morph syntax I am proposing.
First, the animation, consisting of a channel to drive the morph from TIME input and MORPH output parameters.
Now, the morph controller. NORMALIZED and RELATIVE methods are taken directly from the COLLADA spec. Do we need these? Default is NORMALIZED. In this example the single morph target has zero weight i.e. at resting position the geometry is un-morphed.
"morphs": {
"BallUV3-morph": {
“method” : “NORMALIZED”, // one of “NORMALIZED” or “RELATIVE”
“source”: "BallUV3_geometry",
"targets": [
"target-BallUV3Custom_Morph"
],
“weights”: [
0
]
}
},
Finally, the instance of the morph (will appear inside a node):
The text was updated successfully, but these errors were encountered: