muscle problem

   Views 10890   Replies 9   Subscribers 2
User Avatar
Member
114 posts
Joined: 7月 2005
Offline
I'm trying to implement a muscle system for my skeleton. It should work this way: I have a base and end (insertion point) nulls. I want to create an elipsoid between them because it's easy to compute its volume and than parent the nulls to the bones.
I dont know how to measure the distance between 2 objects and if its possible to compure in realtime the volume of the elipsoid.

mant thx.

calin
User Avatar
Member
941 posts
Joined: 7月 2005
Offline
calin_casian
I dont know how to measure the distance between 2 objects and if its possible to compure in realtime the volume of the elipsoid.

Hi Calin,

To find the distance between two objects (Nulls in your case), check out the expression functions origin(), vorigin(), and vtorigin(). See their respective helps by typing “exhelp origin()”, etc. in the houdini textport. One of those should do the trick.

As far as the volume goes, it's all pretty much meaningless without a reference (or “rest”) volume. In that sense, you're probably better off using the volume of the enclosing cube instead of the actual ellipsoid. Either way, the current voulme would need to be expressed in terms of the difference between the current distance between the two Nulls and your chosen “rest” length. i.e: even though the raw volume of an ellipsoid is given by (4*PI*a*b*c) / 3 (where a, b, and c are the major, mean, and minor axes respectively), you wouldn't use this directly in your calculations.

Cheers!
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
7909 posts
Joined: 7月 2005
Online
No need to really do true volume preservation. Inverse square root is generally good enough.
User Avatar
Member
114 posts
Joined: 7月 2005
Offline
hi,

thanks for your reply. In the mean time I found out that there is a expression called distance() witch gives you the distance between 2 points in space, exactly what I needed, but my problem is that if I parent the null to the bone(geometry) and move the parent, the tx, ty, tz coordinates of the null will not change. I could do a ch reference of the parent to the null instead of parenting but still the problem remains one step up when I parent the bone(geometry) to the bone.
The other problem regarding the volume, I was thinking to have a reference object, like in a neutral pose.
What I'm trying to achive is a muscle OTL that takes 2 nulls as imputs and one reference obj (usualy an elipsoid), or better, just the two nulls, make inside a elipsoid, use it as a reference and output the deformed muscle (elipsoid). It would meen so much to me if you can help me out because than I'm one step forward in my character developement(until now I have a good skeleton, bouth anatomicaly and cartoony way).

Cheers!
User Avatar
Member
7909 posts
Joined: 7月 2005
Online
Mario already mentioned vtorigin(). That's what you want to use. Use something like vlength(vtorigin(“../null1”, “../null2”))
User Avatar
Member
941 posts
Joined: 7月 2005
Offline
Yes; use vtorigin()

The reason is that the origin functions deal with objects, which have transformation matrices associated with them, whereas the distance() and length() functions deal with points which, by definition, have no transform stack associated with them. In other words: origin() (and its relatives) take into consideration all transformations in the parent hierarchy, whereas distance(), length(), and their variants, don't.

The expression in Edward's example then, gives you the length of the line connecting the two nulls – i.e: the distance between them.

Regarding the ellipsoid/volume issue; again, all you really need to control the size/shape/volume of the thing, is the difference between the current distance between the two nulls (the result of Edward's expression), and some arbitrary “rest” length (some constant value that is meaningful in your context). This difference (or “delta”) then drives the muscle size, shape, whatever.

For example; let's say the current length is Lc, and the rest length is Lr, then the “stretch” factor (i.e: how much it scales along its length) is Ks = Lc/Lr, and the width and height scaling factors (the ones that preserve volume) are both Kv = 1.0 / sqrt(Ks). Or, to be more precise, Kv = 1.0 / sqrt(max(abs(Ks),1e-5)) to avoid division by zero and root of a negative number – both undefined.

Again, this preserves the volume of the enclosing cube, but the ellipsoid's volume just varies proportionally to that, meaning it's just some fraction of its bounding cube (just another scaling factor) namely CubeToEllipsoid = 4*PI*(0.5^3)/3, i.e: the ratio of the volume of a sphere of radius 0.5, to that of a unit-cube.

Given the above, and assuming you're doing this at the object level (as opposed to doing it in SOPs, where you'd have to deal with orienting the muscle object yourself), then you don't need a reference muscle object per se; just a reference length, and the scaling factors I mentioned above.

Does that make sense?
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
252 posts
Joined: 7月 2005
Offline
Also, don't forget the boneangle() function. Depending on which joint you are creating muscles for, it could simplify things.

-Craig
User Avatar
Member
114 posts
Joined: 7月 2005
Offline
thank you very much for your replies, I think it solve the problem
User Avatar
Member
154 posts
Joined: 7月 2005
Online
Hey Guys,

Go check this out www.cgmuscle.com

It's for Maya, but there is already source posted that has an implementation of a fusiform and multibelly model that will give you a pretty good idea on how to go about doing what you mentioned above. There's also a lot of awesome info there as well.

Cool, enjoy!

later
Judd (friend of aracid)
User Avatar
Member
7909 posts
Joined: 7月 2005
Online
I haven't looked in a while but I believe the arm example file that comes with Houdini has a muscle otl in it that proved very effective.
  • Quick Links