View Full Version : Smart SKin in 3ds Script Research
Heya!
Discovered a kewl thread on www.discreet.com/support
about "Maintaining Volume in Deformations".
The thread/files is enclosed as attatchment in separate posts below. Since maxīs angle deformers only work properly in one axis, having this "smart skin" system work in all axis and through IK sounds awesome. Unfortuanetely i do not fully grasp the fairly simple script wich uses a morph target triggered by a script controller. Anyone up for trying to disect this thread/script some with me?!
Anyway, i am trying to disect the script example by Guru Kees;
-(((($Bone01.transform.rotation - $Bone02.transform.rotation) as eulerangles).x + 12))
wich then was improved upon by master Paul N to handle rotations through IK chains properly:
rot = ($Bone02.transform * (inverse $Bone01.transform)) as eulerangles
-rot.z - 10.9641
Now to my questions;
1. This "-rot.z - 10.9641" value... where does this come from? Checked everything in the scene there were not a single bone or object with this starting rotational value. Maybe the scene file i had downloaded was somehow changed and didnīt match up i donīt know. Though it is supposed to state the initial rotational value of Bone02 though right? The bone driving the deformation or am i wrong here?
2. Float scripts requires... float integers right? How on earth do i get the float value out of the rotational values of bones and such? I only find digits like 12.122 not 12.1223 if you know what i mean. Sorry for being such a max/math noob here.... And how do you extract these values?
3. How does this script understand at what rotational value it is supposed to morph to 100 percent? In Guru Kees example, he apereantly uses some kind of devisor (12), but what is considered to be a 100 percent rotation in this case? And how does 3ds know this?
And why arent there a divisor in masta Paulīs example?
Please someone check the enclosed files and thread and letīs see what we can do with this stuff!
PatrikF
|
|
Here is the thread zipped up!
PatrikF
And here come a final max file to complete the files in the original thread, this file was setup by the poster of the original thread testing stuff out not completetly necessary to dl just want to upp it all completely
PatrikF
gaggle
06-24-2003, 11:41 AM
Sounds positivly interesting. I'm sorry I can't be of direct assistance regarding your question, I do have a question of my own though: is the test.max supposed to work? I loaded it up and the morpher-modifier seems to make no difference to the bending. Maybe I missed the point, that it's not working and you want help to fix it, idunno.
Anyway, I hope someone will provide the answers you're looking for.
Hey thanx for replying!
Hmmm yes itīs supposed to work, though the included file, if you read through the thread, is setup by Kees WITHOUT special care taken to that the deformation runs through an IK chain (the test.max) so that file isnīt fixed to handle deformations through IK at that stage. It was just meant to be a quick and dirty example.
That file (test.max) flips out easily, stops working if you change the swivel angle etc but if you just move the IK chain up slightly, go into the morpher modifier, you will see the morpher value has changed.
Paul Nealy then posted an improvement to the script in this file
rot = ($Bone02.transform * (inverse $Bone01.transform)) as eulerangles
-rot.z - 10.9641
wich is not included in any of the files i have posted (and a fully working example isnīt posted in that thread either). And it is this script i am having trouble understanding. Please see my original questions above.
However i tried, by opening the file "test.max" clean, updating the script controller in track view (itīs on the modified-->morpher object in there) with Paul Nealyīs posted script, and then the file seems to work a lot better. Through the IK.
Thank you for your time and patience
Patrik
gaggle
06-24-2003, 01:01 PM
Ah, right, I didn't explain myself very precisely. Indeed the morpher-procentage is keyed into the angle of the bones, that part is cool and I can see its uses. Especially if it could be made to work on all angles, as you describe. The morpher doesn't have any visual feedback though as far as I can tell, and that's the part I'm unsure if it's intentional or not. The morph-target simple doesn't change anything, I can disable the modifier, and the result is exactly the same as with it turned on. Just curious if I'm missing something there.
I know this type of angle/morph driven deformation is a usual way of doing it in Maya, it wouldn't suck getting a decent way of doing it in MAX either :).
Sorry sorry someone seem to have messed with the last file test.max i uploaded as an attatchment.... maybe even yours trouly sorry sorry sorry this is messy enough without happy campers like myself messing thing up further...
Here is the real original file "test.max" from the thread!
Patrik
the test file has an error in it
the morph target in the file would appear to be a bent version of the "arm"
however the morph target should be a straight version of the arm
otherwise you will get double transformations which would be incorrect (since the skinning should be bending the arm and the morph modifier simply puffing out the midsection of the arm)
so in order to get that file to work i had to re-do the morph target into a straight arm version and then puffed out the mid-section.
I made the changes applied to the morph obvious. However, if the morph changes are extreme do note that you may have to adjust the envelopes in the skin modifier to make sure that they pick up the morph changes
I also changed the script controller to:
rot = ($Bone02.transform * (inverse $Bone01.transform)) as eulerangles
-rot.z - 1.24232
hope this helps
Hey!
Thanx for joining the thread!
So you got it to work properly?!
Then you are da_man i tell you da_man respect :)!
Do you mind trying to answer my questions then? It seems you sure got the skills down for it.... would forever be in debt to you... I need extreme character deformations here! And the Max community need working smart skins!
1. This "-rot.z - 10.9641" value... you have changed to -rot.z - 1.24232
where does this come from? Checked everything in the scene there were not a single bone or object with this starting rotational value. Maybe the scene file i had downloaded was somehow changed and didnīt match up i donīt know. Though it is supposed to state the initial rotational value of Bone02 though right? The bone driving the deformation or am i wrong here?
2. Float scripts requires... float integers right? How on earth do i get the float value out of the rotational values of bones and such? I only find digits like 12.122 not 12.1223 if you know what i mean. Sorry for being such a max/math noob here.... And how do you extract these values?
3. How does this script understand at what rotational value it is supposed to morph to 100 percent? In Guru Kees example, he apereantly uses some kind of devisor (12), but what is considered to be a 100 percent rotation in this case? And how does 3ds know this?
And why arent there a divisor in masta Paulīs example?
Thanks for replying!
Patrik
Schnupps
06-24-2003, 10:46 PM
I actually havenīt tried this method, but I built my own setup, which is adjusting morph targets by bone rotation. Itīs not depended on skin, works with physique too.
If you are interested, thatīs how i did it:
Created a morph modifier below skin/physique. Now an example for doing the shoulder-arm connection. Create a copy of the character and start adjusting the vertices how you want them while your arm is hanging down at your body. After being happy with this, disable physique go back to original character and pick the modified one as morph target.
Go to track view and assign and expression float to that morph target. In the expression make two variables one for shoulder bone y (i think) and one arm bone y rotation.
Now do ((-shoulderY-armY)+the offset where you donīt want any morphing)*the amount to archive 100 as the arm hangs down.
Always keep the debug window open, to get the right values.
Then you can go on repeating the procedure for z rotation to get another morph as the arm is pointed forward.
This method works well with bones, not with biped, since biped doesnīt have any euler rotaion. However you can do it as well with an animated align script with the biped.
Hope someday I find a script/PlugIn, which can read out loacl rotations of linked objects for wiring/exprssion...
If anybody is doing it similar like this and has any improvements or suggestions, go on...
Schnupps
I was a little sloppy with the correction to the expression i posted earlier, it should read
rot = ($Bone02.transform * (inverse $Bone01.transform)) as eulerangles
-rot.z - 1.25768
answer to 1) basically you evaluate the expression without the offset to find out what the offset should be to zero out the expression. So, when you evaluate
rot = ($Bone02.transform * (inverse $Bone01.transform)) as eulerangles
-rot.z
you get 1.25768 at frame 0 (where the joint has no bend in it), so you subtract that value to get rid of the starting rotation that the joint has in relation to its parent
answer to 2) not sure what problem you are having, both 12.112 and 12.1223 are float values, just to different levels of decimal precision. A floatscript can handle any number you send it as a float. Internally, it will handle it to 6 decimal digits of precision, but the ui display only shows 2 decimal digits of precision. If you want to see that value you can use the "print" command to print a variable directly in the listener window. (e.g. "print $Bone01.transform.rotation.x")
answer to 3) it looks to me that the rotation value of the joint drives the morph directly, so that when the joint is at 100 degrees rotation, the morph is at 100 percent. It would not be hard to adjust this, if you want the morph to be at 100 percent when the joint angle is at 135 degrees then you divide the whole expression by 135 (to make it evaluate to 0 to 1 between 0 and 135 degrees, aka normalizing the value) and then multiply it by 100 to give a value between 0 and 100.
erilaz
06-25-2003, 03:45 AM
Sounds interesting! Can we get this thread moved to the maxscript section moderators?:D
Sam, thanx a lot for your time and patience. Your support has been like 10-fold that of the Discreet webboard. Things start to get a lot clearer here now! All the respect in the world for helping out! Thanx! Hope more noobīs get into these issues. Itīs all in max, itīs just so undocumented!
Another smart skin related experiment i just done, is using Character Studio 4 and the Reactor controller.
Got this to work out of the box!
ie i am driving a morph target with the reactor controller, about same setup as above, no scripting tho.
Seems CS has always had these bulge feature, some even used for some joint creasing improvements round shoulders etc, and THOSE always worked in all axis properly. So, dunno what math CS is using, but now with CS4 and the slightly improved integration w 3ds own controllers etc, i just tried/experimented with this and it just works! Through the bipedīs IK and all!?
Can anyone confirm this!?
(I am still unable to use a bipedīs limbs to drive another for instance... there are still a lot of limitations with bipedīs anyway)
PatrikF
Schnupps: expression can work with biped, I tested this a few ago with CS3.4, and a displace modifier, should work with a morpher
Put a modifier Displace on the mesh, below Physique, controller Expression in the "Strenght" track of the Displace
(abs((quattoeuler ($index1.transform.rotationpart-$Hand.transform.rotationpart)).x))*1
index1 = name of the finger
hand = name of the hand
Pff I think I did an error in the scene I have posted on webboard, first target was just a bulge of the biceps, but second one, was a snapshot of the arm already bended by the biped+ deformation at the mesh level that what cause the double transformation, thanks to Schnupps
I test and post back a result
Done, in fact it works exactly the way the morp has been to be set with Skin and the MorphAngle deformer
Rotate the arm of the biped, put an edit mesh below physique, move the vertices with the stack activated than in the morpher use the Current state to record the traget, and remove the edit mesh,now reactor act has it should.
One thing that seems important, since this method allow precise deformation, you should do it with a physique roughly applied, in my character I already have complex vertex assignement, xeigth, enveloppe, tension in the link..... that counter act the complete effect of the morph Driven system, but it works.
Hourra..........;
Wahhooooo!
(Itīs Patrice right?)
Kinda happy here :):):)
Need to test more myself too tho, havenīt had time today.
Can you also confirm it works through the bipedīs IK?
And do you also have this fallof issue with the reactor controller? Like.. you need to set some extreme poses at zero in reaction state here and there to make sure your deformations only occur where they are supposed to/where you want them to be?
Thank you for your time and experimentation very very appreciated!!!
Patrik
what do you mean, work trough the biped Ik?
for the reactor I select my character at frame 0, equal to position in figure mode, play with the influence parameters seems to work well, but i do a harsh test on an old character
Ballo
06-27-2003, 01:21 AM
Hi , Are you trying to create a morpher to active it in realtime with the ikbones moves?
Is a good option but i canīt understand how that works. iīll be reading your answers...
somebody know the Steve Stahlberg tutorial?
Blendshapes (http://www.androidblues.com/rigtut.html)
http://www.androidblues.com/rigtut7.jpg
http://www.androidblues.com/rigtut9.jpg
I assume that we need to create some expresion, to active the morpher when the helper of the Ik moves, is it?
If you want I can share wiht all a leg model to make tests.
Patrice!
Sorry for the deley.
About Ik... the reactor controller and wiring is supposed to work through FK.
Only the sec we apply IK, transforms etc takes on a new game of math completely.
Thatīs why "inverse $Bone01.transform" isntīt just "$Bone01.transform" for instance, in the script controller example.
Though CS seem to be using a completely different underlying architecture... for instance.. the bulge angles works properly i all axis out of the box, suspected reactor controllers/wiring would work now in CS4 with the slightly better improved (well... ) integration w 3ds max.
Patrik
CGTalk Moderation
01-15-2006, 11:00 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.