Blend Shapes and intermediate position.

   7709   34   0
User Avatar
Member
22 posts
Joined: Oct. 2018
Offline
Thank your Aizatulin. This works. It's not as usueful as I expected and I have to understand how this result works. But at least it works.

And thank you McNistor for your suggestion. May be one day I could make a RFE, when I'm goog enough in Houdini. I'm sure procedural method is a very powerfull idea but it's not forbiden to get inspirations and good ideas from another softs. And with the shapekeys, Blender get a very easy to use effect that Houdini could inspire.
User Avatar
Member
475 posts
Joined: July 2005
Offline
After I've looked into the blender manual, I think I am understanding a bit more what you want. The shapekeys in blender are using a source and one or more targets (target 1, target 2 …). The interpolated value goes from source over target 1 to target 2 etc.., but not necessarily on a straight line. It can be a curve (like catmull-rom, b-spline interpolation). But the important thing is, that you can modify the initial target values (how much it is away from the source - in blender called weight). Vex is supporting catmull rom (I not sure if b-spline (NURBS)). But for 2 targets you can use cubic bezier aswell.
It is also possible to use weights for the bezier curve, which gives you control over influence of each point. But this is only a special case (using 2 or 3 targets). For more targets ->(catmull/NURBS should to the interpolation).
By the way Sequence Blend gives similar results, if you are using two blend shapes before.

Attachments:
blend_visualizeY.hipnc (112.6 KB)

User Avatar
Member
1755 posts
Joined: March 2014
Offline
@Aizatulin Very nice setup. With your permission I'll do tests on the creature that I'm currently working on.
I will also give Sequence Blend a shot, but if my understanding of its workings is correct, you need two intermediary shapes (four with the “ends”) in order for the Cubic and Subdivision interpolation to work properly and there's less control over the interpolation curve than in your setup.
User Avatar
Member
475 posts
Joined: July 2005
Offline
McNistor
Very nice setup. With your permission I'll do tests on the creature that I'm currently working on.

Thanks
You can use and modify it.

McNistor
I will also give Sequence Blend a shot, but if my understanding of its workings is correct, you need two intermediary shapes (four with the “ends”) in order for the Cubic and Subdivision interpolation to work properly and there's less control over the interpolation curve than in your setup.

I'm not sure how sequence blend works, but it looks like they use something like b-splines (maybe cubic if there are 4 shapes or more). But probably they reduce the degree automatically, if there are only 3 shapes.
In my example I've used a cubic bezier curve for 3 shapes, so I've placed the midpoint “A” at the second and the third position. A cubic bezier can be used for 4 points aswell, but not for 5 points or more. For this can be used catmull-rom or b-spline (which are supported in VEX) but without weights afaik. But sequence blend should handle the b-spline case.

P.S. : For 2 targets it might be better to use a quadratic bezier. If the weight for the first target increases the speed will slow down, but this can be compensated by a ramp.
Edited by Aizatulin - March 21, 2019 01:30:43

Attachments:
blend_visualizeZ.hipnc (129.3 KB)

User Avatar
Member
22 posts
Joined: Oct. 2018
Offline
Thank your Aizatulin for your last file. I can use it but if I understand the logic, I have to learn more about how to you link the variables to the object…


Shape key in blender Is a kind of morphing of shape. The same idea that animation but out of the timeline.
Mix of Shape keys is a shape keys of shape key.

Shape key has to be build in edit mode and you can use is in both edit and object mode.

But as soon as you create hundred of shape key, if you want to change the cube used for this with a sphere or an helicopter or… , you have to start again your project. This is why I think procedural logic is the future of 3D because of its capability.

Anyway, it seems Houdini still needs a lot of complexity to reach what blender can do with shape keys without one line of code. Very easy. The complexity must be somewhere is Houdini but I think there are ways to improve simplicity in Houdini without loosing the capability.

Here an example of Blender shape keys. MoveX, MoveY and MIxMoveXY can work together.

Attachments:
ShapeKeys.blend (603.1 KB)

User Avatar
Member
475 posts
Joined: July 2005
Offline
I've just installed blender to figure out how your example works. There are two different modes fpr shape keys (the relative and the absolute). The absolute seems to work similar like sequence blend and it can uses different types of interpolation curves. Some of them are even supported in VEX.
The relative mode works different. It seems to take the delta from shape to base. There is no interpolation at all. All difference vectors seems to be added separately.
I've tried to rebuild this behaviour, but I used a ramp to get control over all shapes. The box example is in the left upper corner. In the lower ramp (“Relative”) you can control the shapes. If you have 3 targets for example the ramp values (0, 0.5, 1) will influence the result.

Attachments:
blend_multiple.hipnc (298.1 KB)

User Avatar
Member
22 posts
Joined: Oct. 2018
Offline
Thanks again. I have to see your file because I even can't use it. I must spend more time to understand how it works.

I'll answer to you with a longer email soon but, yes the blender “morphing” has no interpolation but you can adjust MoveAllX and MoveAllY, even after you used MoveAllXY. It's a way to control the way of the morphing.

Attachments:
ShapeKeysMoveAll.blend (607.7 KB)

User Avatar
Member
475 posts
Joined: July 2005
Offline
Maybe using a multiparm block instead of a ramp is more intuitive. This example is more related to your last file.
Edited by Aizatulin - March 23, 2019 03:01:44

Attachments:
blend_multipleZ.hipnc (85.5 KB)

User Avatar
Member
22 posts
Joined: Oct. 2018
Offline
Thank you Aizatulin. I can match how the two softs get more or less the same result.

Anyway, my last file was only to show you how simple is blender with shapekey to get this result.

My main goal is to get (and understand, that is not yet…) how to blend a shape with intermediaire positions. Your previous files show how to do that but I need to learn how your code works…
User Avatar
Member
475 posts
Joined: July 2005
Offline
There is a technique called spline interpolation, which is nothing else than a generalisation of the two point (straight line) interpolation “lerp”. The difference is, that you can have more than two points -> you have a list or an array of points. The other thing is, that the line is usually not straight but a curve. The math behind this technique is a bit more complex. If you are interested in the math, you can search for something like “b-spline interpolation” or “NURBS” or “catmull-rom” etc… . You will find some very technically papers.
I think it is less important to understand every aspect of the mathematical definition. I think it is more important to understand the idea behind. So even if you don't understand the math, you can understand the idea and can get a feeling how the thing works.
So the idea is just picking one point from each target, which corresponds to the same point number as the source point (@ptnum). Putting these points into a list. Putting the list and an u parameter into the spline function. The result is a point following the curve depending of u (0 ~ start, 1 ~ end).
Since you will do this for each point, each point will follow its own curve. So every point will be moved on a curve from source to target1 to target2 … until targetn is reached.
This is the main idea behind. In my experimental example I've calculated two different curves (bspline and catmull-rom). A ramp can be used to blend between these two curves. Ignore this part for the beginning (set the ramp to zero).
User Avatar
Member
22 posts
Joined: Oct. 2018
Offline
In fact, I studied mathematical. So I'm pretty familiar with bezier, bspline and nurbs. But I have to focus on Vex and the nodes logic.

Until now, I understood the multiparm block, the chramp and things like these. But I have to go further and to understand you preview answers, I mean the code and the nodes.

I realize that what I would like is a kind of animation with multiples key frames, but using ramp in place of key frames to keep them for future use. But it's much more intuitive with key frames.
Edited by Chrisd - March 29, 2019 12:35:06
User Avatar
Member
475 posts
Joined: July 2005
Offline
So which part is not clear? How the wrangle is getting the points from the merged node?

The main idea of a point wrangle is looping over all points of the first input. The second(third,fourth aswell) input is only auxiliary input. In my case I merged the different states together. For a fixed point of the first input geometry I have multiple points of the merged geometry, which corresponds this fixed point. So if my geometry has 10 points at all and the pointnumber is 7, I will take the points 7,17,27,… from the second input to create an array and push all points into it to apply the spline function on this array.

If you want to understand VEX, I'll recommend you to look at easier examples first (like my first one). But the main idea is the same. Just try easy things in VEX first and if you have the feeling the source code is doing what you want it to do then you can try the more complex problems. It is just my personal opinion of course, but if you already know this amount of stuff it shouldn't be a big deal.
User Avatar
Member
1737 posts
Joined: May 2006
Offline
Surprised someone from sidefx hasn't chimed in yet.

This really should be built into the blendshape sop. Its a pretty common feature for rigging these days to do intermediate blendshapes to approximate curved paths, like eyelids rolling over a curved eyeball, jaw opens etc.

Goldfarb? Is this worth an RFE flash mob?
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
1755 posts
Joined: March 2014
Offline
Sequence Blend node has a Linear/Cubic interpolation method, but no custom curve. And, together with Blendshapes node and due to a lack of a built-in way of masking with Paint nodes, makes for a convoluted workflow I found.
User Avatar
Member
475 posts
Joined: July 2005
Offline
For the (in blender called) “absolute” mode the sequence blend node should do the job. You have three options for the interpolation mode in the sequence blend.
1. Linear matches the VEX function spline parameter “linear”.
2. Cubic seems to match the “cpline” parameter (two additional points for Start/End are needed, which influence the curve near the Start/End points).
3. Subdivision matches the “bspline” parameter.

I have no idea, how you can archive the same effect for the (in blender called) “relative” mode, using sequence blend, but this wasn't primarly the question.

Going back to the “absolute” mode, with an additional minimalistic wrangle you can create a workaround, to blend between two sequence blends using a ramp. In blender it looks like, that you have something like an inbuild function, where you can define the interpolation for each target, which blends between the different types along the path.

Adding the “linear” case in the sequence blend using another ramp won't be a big thing (in my opinion not necessary since the “cspline” is moving close to the targets).

But I have no idea if the interpolation parameter can be normalized to (0,1). If you call a parameter from outside you always have to multiply it with the number of inputs minus one, so if you are changing the number of inputs you have to change the muliplier aswell.
Edited by Aizatulin - March 30, 2019 10:41:27

Attachments:
sequence_blend_comparison.hipnc (107.0 KB)

  • Quick Links