PDA

View Full Version : Additive Morphing


spider853
04-09-2012, 12:04 PM
Hi, I need some hints, ideas or guides on how to make an additive morphing.
By additive morphing I mean the fallowing:
Having a mesh A.
Two duplicates of mesh A with some deformation B and C.
For example I need to deform the mesh A as A -> B + C
That mean that I need to deform A to B (this is easy its just the same B)
Then I need to add the C - A difference deformation to B.
In other words I need to make deformation C in B space (relative deformation of C to A, applied to B).

The first idea that I had is to somehow make a vertex space, and store the deformation B and C relative to same vertex index space.
then modifying to B, I recalculate the vertex space in B, and apply the difference vector (C - A) to B.
Sounds good but 3ds max doesn't have vertex space...
I saw that its have some pseudovertex space by using an Edge and a Normal to compute the vertex space. But because its depends on one edge, it may be modified in B deformation and resulting deformation may look incorrect. Because a small rotation on that edge will result in rotation of all vertex space without counting the other edges.
Another idea could be to use sum of all edges and normalize to get the vector for computing the vertex space.. but then another problem may arrive, 2 or more vectors can cancel each other resulting in a null vector or vector that doesn't count other edges, and by this making an undefined state.

So does anybody has some idea about this?

Thanks

denisT
04-09-2012, 01:53 PM
the morphing is always additive. your questions is not clear for me. try to explain it better...

when you set 100% for target B it means you add (B-A) to A
when you set 100% for target C after you set B that it means you add (C-A) to B.
the order doesn't matter. It will be any way A + (B-A) + (C-A).

denisT
04-09-2012, 02:09 PM
The first idea that I had is to somehow make a vertex space, and store the deformation B and C relative to same vertex index space.

what is vertex space? is it vertex normal based or deformation A->B direction?

spider853
04-09-2012, 02:14 PM
the morphing is always additive. your questions is not clear for me. try to explain it better...

when you set 100% for target B it means you add (B-A) to A
when you set 100% for target C after you set B that it means you add (C-A) to B.
the order doesn't matter. It will be any way A + (B-A) + (C-A).

Sorry, the example with B + (C-A) is not good, as it looks like you just add the difference.

To imagine easier, I will bring a 1D example along the normal.

Imagine you have a plane with normals pointing up. (obj A)
You clone that plane (obj C) and deform the vertecies along the normals to form a X bump.
You clone the obj A and apply a bend modifier with full 360* rotation. now the normals are pointing from the center out circular.

When you make de additive deformation they go in this order.
For each Ai, Ci vertex you get de distance along the Ai normal of the Ci vertex and store it (for example Li).
now you modify the A to B. It will be the same object as B.
Now when you add the C deformation, for each of the Bi vertex, vertex gets pushed towards normal at the distance Li.

Now you have a cilinder with a bumped X on it

So this is in 1D only around normal.
but I want to save the 3D relative position to the vertex space.
So bassicaly I have normal for up vector, and I need to find another vector to compute the vertex space. That vector needs to be consistent along deformations to perserve the right logical direction

denisT
04-09-2012, 02:39 PM
following this scenario it's not morphing. it sounds like displacement for me. maybe the right way will be use Projection modifier and its Project Mapping as a source data for Displace Modifier.

spider853
04-09-2012, 02:45 PM
No, displacement are along normals like the 1D example I wrote above,
More like vector displacement.
Btw, does vector displacement occurs in tangent space?

denisT
04-09-2012, 03:21 PM
No, displacement are along normals like the 1D example I wrote above,
More like vector displacement.
Btw, does vector displacement occurs in tangent space?
displacement in the mapping space. you can generate any mapping including the one based on direction of deformation.

spider853
04-09-2012, 04:53 PM
To be clear, I don't need/want to do any maps.
The thing that I need is somewhere similar to vector displacement map 3D (but not displacement map because its only on the normal of the vertex 1D) but without doing any mapping.
Also I didn't found any example of implementation of vector displacement on google and the question is still open.
What I need is a good way to know where is right-left, front-back of the vertex (up-down is normal) so I can save the relative position of deformation and restore it an a different vertex positions.

The way I'm doing it now is by using
MNMesh::GetVertexSpace ()

but I get wrong results on big deformations on the base object

denisT
04-09-2012, 05:03 PM
The thing that I need is somewhere similar to vector displacement map 3D (but not displacement map because its only on the normal of the vertex 1D) but without doing any mapping.

displacement is NOT along vertex normal. The direction of displacement depends on UV mapping. You can make any mapping to give the direction.

spider853
04-12-2012, 12:51 PM
I think I found a similar problem with solution here:
http://forums.cgsociety.org/showthread.php?t=765856

MatanH
04-15-2012, 05:33 AM
Hi, I don't know if you found a solution but here is an idea.
Let's mark the edges arround vertex i as ei1, ... , ein.
For every j between 1 and n lets calculate the following:
dij <- arccos(dot normalized(cross normi ei1) normalized(eij))
Now let's categorize the edges in the following 4 groups:

Group 1: -45 < dij <=45
Group 2: 45 < dij <= 135
Group 3: 135 < dij <= 180 or -180 <= dij <= -135
Group 4: -135 < dij <= -45

Now you can avarrage the vectors in group 1 - group 3,
to create v1, and avarrage the vectors in group 2 - group 4 to create v2.
define the normal as v3 and you have a base for the vertex i's space.

spider853
04-15-2012, 09:41 AM
Hi, I don't know if you found a solution but here is an idea.
Let's mark the edges arround vertex i as ei1, ... , ein.
For every j between 1 and n lets calculate the following:
dij <- arccos(dot normalized(cross normi ei1) normalized(eij))
Now let's categorize the edges in the following 4 groups:

Group 1: -45 < dij <=45
Group 2: 45 < dij <= 135
Group 3: 135 < dij <= 180 or -180 <= dij <= -135
Group 4: -135 < dij <= -45

Now you can avarrage the vectors in group 1 - group 3,
to create v1, and avarrage the vectors in group 2 - group 4 to create v2.
define the normal as v3 and you have a base for the vertex i's space.

That's interesting,
Thanks, I'll have a look

Looks like a nice solution as its using all the edges. One thing I see here is that the matrix will not be ortogonal. From some point of view this looks like a feature because when the geometry will be bended in, the deformation will be scaled down.

CGTalk Moderation
04-15-2012, 09:41 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.