Comparing point position on Blend Shapes

Discussions about SOFTIMAGEs© Interactive Creative Environment©
Nick3d
Posts: 71
Joined: 10 Aug 2011, 12:16

Comparing point position on Blend Shapes

Post by Nick3d » 03 Dec 2014, 10:49

Hi all,

I'm having some difficulties with comparing two shapes using point position...let me explain.

Basically I have the base mesh and I created a couple of blend shapes via the shape manager.
The shapes are animated and driven externally.

I'm not so good with ICE and I may be saying bs, so bare with me :)
What I would like to do is to get the original mesh point position ( so an array of point position ) and compare those to all the blend shapes I have.
By doing this I will have an array of values which indicate the difference between them ( base mesh compared with first blend shape, base mesh compared to second blend shape, and so on ); I would like to reduce that list to a single value in order to output a value from 0 to 1 so that:
Base mesh point position: value is 0
First Blend Shape point position: value is 1

Basically ( if possible! ) I would like to check when the base shape point position are matching ( or how "close" they are to ) the first Blend Shape, exactly how the shape manager shape values are displayed when keyed manually.
The main point is to have the blend shape value ( again, 0 is the base mesh, 1 is the value when the first blend shape is match ) for each frame using the point position as my source.

Doable? I'm having context issues using point position and I don't know how I could transform the list of arrays into a single value in order to output and rescale that value to be 0 ( for the base mesh ) and 1 ( for the first blend shape )

Any help will be appreciated

User avatar
Mathaeus
Posts: 1778
Joined: 08 Jun 2009, 19:11
Location: Zagreb, Croatia

Re: Comparing point position on Blend Shapes

Post by Mathaeus » 03 Dec 2014, 11:35

hello,
Never heard for "blend shape" :) Ok now seriously
Point position and shape keys are not arrays in ICE. Practically this means, you can not use array nodes on point position or shape key attributes ( as long as there is no new array, especially built from them). Also, this means , you don't need array nodes, for tasks like plain comparison.
Shape keys are deltas relative to original (or, at least, Shape Manager creates them in delta way) , so difference should be a length of 3d vector. They are "3d vectors per point", in same ICE context as point position. For example, ICE way to apply a particular shape key, is get point position, get shape key attribute, add shape key to point position.

For getting the all shape keys into array for comparison or something else, if I understood correctly what you want to do, this could be ICE "build array" node, plug point position, then all shape keys as new members of array. Then you'll have 'per point position array' for each point.

Nick3d
Posts: 71
Joined: 10 Aug 2011, 12:16

Re: Comparing point position on Blend Shapes

Post by Nick3d » 03 Dec 2014, 14:05

Hi Matheaus,

Thanks for the tips!

Watching Paul Smith tutorial ( Vector and shapes ) I notice that I was wrong and yes, they're not considered arrays but vectors ( per point in my case ).

So giving this, if I compare the point position of the original mesh ( all of them are 0,0,0 ) to the...ehm..."blend shape" ( something different from 0,0,0 ) I can visually see the vectors pointing from the base mesh to the blend shape.
Thats ok, its building a shape manager from ICE, cool.

Consider now that my base mesh is animated ( by bones, not by the shape manager ), so what I did was to extract some of the shapes during the animation ( its a ball, shapes are stretch, squash, tilt to the left, tilt to the right ).

Now my base mesh as said is animated by bones, the animation is basically repeating a couple of times ( completely random ) the shapes mentioned above.
Lets say that previously I extracted one of the shape at frame 10 ( squashed ) and add it to the shape manager.
So now I have the situation that when the base mesh is at frame 10 my base mesh point position and the squashed shape point position are exactly the same, so in this case there is a 100% matching between them.
( If I had animated the squashed shape by hand I would have a value of 0 at frame 1 and a value of 1 at frame 10 )

What is difficult for me right now is be able to get the base mesh points position, set the amount of 3d vectors to be a precise custom value ( in my case 0 ), get the squashed shape points position, set the amount of 3d vectors to be 1, so that the values will go from 0 ( at frame 1 ) to 1 ( at frame 10 ), then in ICE:
- Get base mesh points position
- Get squashed shape points position
- Do a linear blend between them
- The blend value is the value which I set earlier given by the 3d vectors "conversion" to be a precise ( float during the animation ) value.

Not sure if it comes clear, but I just try to do an interpolation betwen shapes and let the blend value be driven by the difference in the points position.

Man, this is getting complicated :D