tS Morpher 1.0

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

tS Morpher 1.0 // Interactive Artwork

1  2  3  |  

Post by Jack Edwards // Apr 9, 2007, 10:33pm

Jack Edwards
Total Posts: 4062
pic
Unified the versions into just the 7.1 compatible version.

***New version 8x 1.02 available for download***


tsMorpher 8x allows you to link up a base mesh and up to 8 morph targets.

tsMorpher 4x -- removed -- if you guys want the smaller one continued as well let me know.


Here is a screen capture of the current version:

5323


The script is intended to be used to facilitate facial animation, but can be used for a variety of morphing needs. The major limitation is that in order for the script to work all meshes must have the same geometry.


I'd like to get some testing done ASAP so I can hammer out any issues that arise.


Feel free to post any questions or comments about tsMorpher in this thread.


Enjoy!


-Jack.

Post by Jack Edwards // Apr 9, 2007, 11:36pm

Jack Edwards
Total Posts: 4062
pic
Added the 7.11 version.


I had to add more robust mesh checking, but should be working fine in 7.11 now.


Again let me know if there are any problems.


-Jack.

Post by jayr // Apr 10, 2007, 12:38am

jayr
Total Posts: 1074
pic
thanks jack, i wish i knew more about coding but it drives me mad, even html and flash used to have me tearing my hair out! I'll have to wait for the 7.5 to use it though. When you say 8x do you mean 8 morph targets? is it much of a limitation if the share the same mesh? i don't understand that part.

Post by Délé // Apr 10, 2007, 12:38am

Délé
Total Posts: 1374
pic
Very Cool Jack! Thanks! :D :banana: :banana:


The script works pretty good. I did notice that the updating is a tad quirky. It doesn't always seem to morph all the way from one shape to the next. Sometimes I have to bring the slider back a hair and forward again, then it will update properly. Not really a big issue though, it's easy enough to work around. I also changed the sliders to scrubbers. I like scrubbers better because you can set the step amount. So I set it to 0.001 to have very fine control over the influence.


This works really great though. I was even able to create morphs of morphs. :D


I haven't gotten into messing with the actual meshes in script yet. I'll have to look at how you did that. :)

Post by Jack Edwards // Apr 10, 2007, 1:54am

Jack Edwards
Total Posts: 4062
pic
Thanks guys for the feedback guys! :D


@ Dele:


Good idea about the scrubbers, added both scrubbers and text boxes.

Also added an on/off button so you can turn it off while linking or messing with stuff.


Glad to hear that you can chain the morphs. I'm not sure how resource friendly it is, so watch your file sizes and ram usage. ;)


If you can think of anything else that'll make it cooler, just let me know.


I've got to run out for a bit so the 8x version will have to wait until I get back.


@ Jayr:


Yup 8x will be 8 morph targets. They don't exactly have to share the same mesh per-se. It just has to have the same geometry. For doing animation it's not a serious limitation, your're likely not changing the mesh geometry at that point anyway. ;)


Btw, this is the first bit of real programming that I've done in about 10 years. So it feels pretty cool to get back into it, but yeah I was tearing my hair out there for a while too. I think that's part of what makes programing fun... it's the camaraderie of knowing that you are in the company of other bald minds.....


-Jack.

Post by mrbones // Apr 10, 2007, 2:13am

mrbones
Total Posts: 1280
pic
Thanks Jack, Checking it out now.


Cheers!


Thanks guys for the feedback guys! :D


@ Dele:


Good idea about the scrubbers, added both scrubbers and text boxes.

Also added an on/off button so you can turn it off while linking or messing with stuff.


Glad to hear that you can chain the morphs. I'm not sure how resource friendly it is, so watch your file sizes and ram usage. ;)


If you can think of anything else that'll make it cooler, just let me know.


I've got to run out for a bit so the 8x version will have to wait until I get back.


@ Jayr:


Yup 8x will be 8 morph targets. They don't exactly have to share the same mesh per-se. It just has to have the same geometry. For doing animation it's not a serious limitation, your're likely not changing the mesh geometry at that point anyway. ;)


Btw, this is the first bit of real programming that I've done in about 10 years. So it feels pretty cool to get back into it, but yeah I was tearing my hair out there for a while too. I think that's part of what makes programing fun... it's the camaraderie of knowing that you are in the company of other bald minds.....


-Jack.

Post by Humdinger // Apr 10, 2007, 3:08am

Humdinger
Total Posts: 319
pic
:jumpy:



Jack, Dele, Mr. Bones, Tomas and the rest!!! - thank you for all you are doing!


Any chance we can get a few screen shots and or videos of all this in action when ready ...?


I know this TS 6.6 user would be moved by more than a few feet into the purchase corner if I saw something that I think I could work with.



PS


I am also hoping that a novice could look through the scripting and add as many morphs as they want..? ( though no 'coder' I have been working in HTML/java and Flash Action Script for years)


lol.. at this point I dare not ask for anything more! ;)


Jack a special :) to you my man for running with this!

Post by Jack Edwards // Apr 10, 2007, 6:34am

Jack Edwards
Total Posts: 4062
pic
Thanks Humdinger :)


I'm hoping the community will be able to find it useful.


Nope, no coding necessary. Just drop it in your LE, link up the Meshes, turn it on, and you should be able to move the sliders around to morph your stuff.


I'm planning to do a quick tutorial but I'm not going to be able to get to that today. I also have a demo video idea that I'm going to do that shows off the morphing better than the one I posted earlier. LOL maybe I can even enter it in the animation contest and win something.


Here's a screen capture of the ts Morpher 8x brick in LE:

5289


Again let me know if you guys notice any problems or come up with any ideas for extra functionality.


-Jack.

Post by Humdinger // Apr 10, 2007, 7:02am

Humdinger
Total Posts: 319
pic
Thanks Jack for the image !


Usefull...? Lol are you kidding..? Awesome!


and this will also work on a mesh that is already skinned to an animated bone rig ...?

Post by frank // Apr 10, 2007, 7:19am

frank
Total Posts: 709
pic
and this will also work on a mesh that is already skinned to an animated bone rig ...?


Was wondering that myself.


I imagine it could be done as long as the vertex keys are handled properly. ie. not stored in the actual mesh's vertex info, which may conflict with how the bones store the vertex keys, but rather saved within the plugin/script so that they are handled in realtime, applied after the bone deformation is done.


Here's another way of putting it: For any vertex blender/morph plugin to work with bones, one of the two has to 'know' that vertex manipulation is being done by the other. So the blender plugin for instance would say "Hey, I'll apply these morphs AFTER the bones have done their thing to the mesh.", as opposed to just overriding the vertex info.


UPDATE: ... and I think care has to be taken so that the vertices move along their normals based on the position of the bone (dynamic as opposed to static locations) such that if the head is turned, for instance, the morph targets are applied to the head at that state (taking into consideration what the bone has done to the head part of the mesh), and not based on a front-facing-only pose.


Guys, please let me know if this doesn't sound right or make much sense. :)

Post by Jack Edwards // Apr 10, 2007, 8:11am

Jack Edwards
Total Posts: 4062
pic
Hi Frank,


Thanks for the post. I used a simpler approach to implementing the animation that I think should allow the morphing script work on top of bones animation since it doesn't keyframe the mesh at all.


I have a "filter" script that I need to post to help you guys out. It allows me to hook up a value, scale it and range limit it. So I'd hook up the matrix values from a "control" object that I dropped in the scene to the filter script, then hooked that up to the morph sliders.


So to animate a mouth opening and closing, by linking to the z value of say a box, I could open and close the mouth by raising and lower the box. Just add key frames for the box position. :D Animating an "O" mouth shape might be cool to do as scaling a sphere.


Basically it's sort of like making your own widgets without all the work. ;)


You could do this in 7.1 if you set up the keyframes for the control objects on model side. Just be careful not to right click on the Morpher object because that will break the morpher. (It adds a shape node -- effectively a snapshot of the morphed geometry -- and unlinks the Morpher script. The script can be re hooked up though but you need to know what your doing.)


If I get a chance tomorrow, I'll see if I can rig an arm and use the Morpher to handle the muscle deformations. My guess is that as long as both the base and target meshes are rigged and animated identically with the skeletal animation it shouldn't be a problem. I haven't had a chance to look at the new bone system yet, but I'm guessing that with the LE there should be a way to link them so that the different sets of bones can drive each other. (Of course once I mess with them, I can't tell you guys what I find out because of NDA, so the cool thing about not knowing is that I can still speculate with you guys. :p )


Something to keep in mind is that the deformation using the morpher script is already local so it's not affected by the position, scale, or rotation of the mesh.


In any case the proof as always is in the doing as opposed to the talk...


-Jack.

Post by Jack Edwards // Apr 10, 2007, 9:19am

Jack Edwards
Total Posts: 4062
pic
Here's the filter script:


// OnComputeOutputs

// Called to compute values of all output connectors

function OnComputeOutputs(params)

{

input = params.conValue('input');

MinVal = params.conValue('MinVal');

MaxVal = params.conValue('MaxVal');

offset = params.conValue('offset');

Multiplier = params.conValue('Multiplier');


// TODO: put your computation here

Value = (input - offset)/Multiplier;

if (Value > MaxVal) Value = MaxVal;

if (Value < MinVal) Value = MinVal;


params.ConValue('Output') = Value;

}



Object is also attached.


Basically to use:


1. Select object you want to use as your control object.

2. Right click on it's ObjMatrix and choose expand.

3. Pick a field and drag it to link it to the input field of the Filter script.

4. Type the current input value into the offset box.

5. Make sure MinVal and MaxVal are set to what you want (0.0 and 1.0 for interfacing with the morpher script)

6. Set the multiplier to a reasonable value. Larger means the values change slower, smaller = faster.

7. Link your the output from the filter up to the parameter you wanted to control on the other object. (A morpher slider for example.)


-Jack.

Post by frank // Apr 10, 2007, 11:07am

frank
Total Posts: 709
pic
I'll be following this one closely, Mr. Edwards!


Thanks!



P.S. What type of morphing are you doing? Basic additive or some type of weight algorithm?

Post by jayr // Apr 10, 2007, 11:15am

jayr
Total Posts: 1074
pic
this just keeps getting better and better jack, this'll keep me busy for hours when 7.5 arrives!

Post by Jack Edwards // Apr 10, 2007, 11:59am

Jack Edwards
Total Posts: 4062
pic
:D

@Humdinger,

I missed your question about extending the code to more links. I've set the code up so that it shouldn't be too hard to modify the code to handle more more links. But it's pretty easy to just daisy chain the morphers so even with just 4 of the 4x morphers and one 4x to link those that's already 16 different morphs on one mesh. And there's nothing to stop you from tying in the 8x ones into the 4x ones. So that would be a quick 32x morphs. ;)

Post by Humdinger // Apr 10, 2007, 1:41pm

Humdinger
Total Posts: 319
pic
Jack..thanks for the upadte !!



and Frank thanks for dropping by and hopefully trying out what you can over on your end, this is sounding like very cool stuff right now.

:banana:

Post by Jack Edwards // Apr 10, 2007, 8:43pm

Jack Edwards
Total Posts: 4062
pic
I'll be following this one closely, Mr. Edwards!

Thanks!


P.S. What type of morphing are you doing? Basic additive or some type of weight algorithm?

You guys are certainly welcome!

Unless you guys can think of any changes, I think the script part for this project is pretty much done. Just need to make a tutorial and demo.

I've got a UV copy script (thanks to ProfessorKhaos's help! :D ) that I'm hoping to get released soon as I can get some info from the devs that will help me solve a problem with it's implementation. If I can get that one solved the way I want to, it will open the door to all kind of cool stuff, like a spherize script, face flattening, various automatic UV mappings and layout arrangers, etc.

The algorithm used for the morpher is a weighting algorithm it compares the morphed meshes with the base mesh then simply adds the weighted deltas.

My first attempt didn't work because a straight averaging solution didn't account for the fact that the unchanged areas on the additional meshes would reduce the expression of the changed areas on other meshes. The weighted delta approach solves that problem. I was mostly to the solution but was trying to make it more complicated than it needed to be because I thought the overlapping areas would have to be weighted differently but suprisingly they don't. So when Tom pointed the solution out to me, I only had to delete one line of code for the x,y,z computations and bammo working morpher. ;-)

I'm still scratching my head a little bit since it seems logically to me that the solution doesn't account for the overlapping areas, but I guess if that proves to be a problem, I'll refine the algorithm to compensate.

-Jack.

Post by Jack Edwards // Apr 10, 2007, 8:54pm

Jack Edwards
Total Posts: 4062
pic
Okay I ran a test and the additive solution doesn't account for the overlapping areas like I suspected and over shoots. I think the additive mode is a good idea, so I'll leave that as a checkbox option, but I need to see if I can solve this to take into account the averaged deltas added by each of the meshes without losing full expression.


Expect a new version later today if I can get it solved.


-Jack.

Post by frank // Apr 11, 2007, 2:35am

frank
Total Posts: 709
pic
My first attempt didn't work because a straight averaging solution didn't account for the fact that the unchanged areas on the additional meshes would reduce the expression of the changed areas on other meshes.


That's what I was wondering.


Okay I ran a test and the additive solution doesn't account for the overlapping areas like I suspected and over shoots. I think the additive mode is a good idea, so I'll leave that as a checkbox option, but I need to see if I can solve this to take into account the averaged deltas added by each of the meshes without losing full expression.


Eager to see what you come up with! This is fantastic.

Post by ProfessorKhaos // Apr 11, 2007, 4:17am

ProfessorKhaos
Total Posts: 622
pic
Jack, you are doing very great work here! :)


I'll be watching with very interested eyes. Quite innovative approach to use other control objects to keyframe your morphs!


Glen

Post by Humdinger // Apr 11, 2007, 6:04am

Humdinger
Total Posts: 319
pic
WooWho -- Love that dam cat !!


PK so cool to see you here !


Jack you got some real good folks looking at this in here and hopefully others as part the Pro Team, but even still - good people.


:banana:


So drooling not being able to test / help in anyway on my end as this feature/concept was/is very high on my list..in particular if we are talking about morphing a boned mesh !!!


Even just a simple fighting game...but when you smack a dude in the face..his face gets all mushy and distorted...?


You can do 99% of the animation with a very basic rig..but all the neat face squishing and maybe big dents in the belly as they get kicked..?


Ah..morph me baby!!!




Also...


As creator of the 'Vinny Method' we must award Jack some similar honor upon completion of something that actually works and is useful, if not just plain fun.



No name as descritptive as the one awared myself comes to mind just yet..


but something will make itself know :)

Post by Humdinger // Apr 11, 2007, 6:29am

Humdinger
Total Posts: 319
pic
PS


If you have ever seen the anime- 'Fist of the North Star'


Damn straight you know what I'm talkin' about !


;)

Post by Burnart // Apr 11, 2007, 12:48pm

Burnart
Total Posts: 839
pic
Sounds FAB what you are doing - would love to know how to try it!


I'm glad there was mention of a tutorial - I can't be the only one reading this thread who finds the whole LE node based stuff something of an unintelligable nightmare - nothing I've tried to do with it seems to work. So when it comes to a tutorial I hope you keep in mind the need to assume every step needs explanation because some of us really are incredibly dim.


BTW does this operate in 7.1 or is it a 7.5 beta thing at the moment?

Post by Asem // Apr 11, 2007, 1:35pm

Asem
Total Posts: 255
This is awesome and pretty simple to use though the blending seems to be a little weird when I made some test facial expressions. I wouldn't doubt that it could work along side ts bones.


BTW does this operate in 7.1 or is it a 7.5 beta thing at the moment?


John made this for both versions though he seemed to have moved the 7.5 version because it's not out yet.

Post by Jack Edwards // Apr 11, 2007, 11:45pm

Jack Edwards
Total Posts: 4062
pic
Thanks guys the community support!! :banana: :banana:

7.5 version is gone for the moment. Once I was able to get the code working in both 7.1 and 7.5, I didn't want to have to maintain two separate versions -- at least not until I'm sure everything is working and the controls laid out the way you guys need it. Same reason I've ditched the 4x version for the moment.

There's a new version posted in the first post: ts Morpher 8x version 1.02

I've fixed the math so that it should morph more as expected. But I've kept the old "additive" method as a checkbox option. I think it might be useful for landscapes and certain kinds of animations where you want the morphs to stack instead of blend.

Suprisingly the new formula turned out to be:
vertex delta = (sum of morph deltas*weight^2)/(sum of weights)

Not quite what I was expecting but it appears to be correct and working.

I need you guys to test it out and make sure it's doing what your looking for in a morpher. From my testing it looks like it's completely working. Only issue that I've noticed is that the script object seems to cache the meshes, so it will continue to use morph targets even if they have been unlinked. I don't think it's a problem, which is a good thing because I'm not sure there's anything I can do about that.

Hope you guys enjoy this latest release! :D :D :D

-Jack.

Post by Jack Edwards // Apr 11, 2007, 11:55pm

Jack Edwards
Total Posts: 4062
pic
@ Humdinger:


Fist of the North Star eh?


Did you see this new tool listed in the new features:

"Soft Shape Paint"


Pair that with the morpher and.... :D :D :D


-Jack.

Post by Jack Edwards // Apr 12, 2007, 12:19am

Jack Edwards
Total Posts: 4062
pic
I'm glad there was mention of a tutorial - I can't be the only one reading this thread who finds the whole LE node based stuff something of an unintelligable nightmare - nothing I've tried to do with it seems to work. So when it comes to a tutorial I hope you keep in mind the need to assume every step needs explanation because some of us really are incredibly dim.


BTW does this operate in 7.1 or is it a 7.5 beta thing at the moment?


Yes works in 7.1 ;)


Yeah, I got pretty upset after 7.1 was released and every time I asked for a feature it seemed the response was "you can do already that in the link editor"... I think that's all fine and good but not all of us have the time or *want* to be programmers. Sometimes it's nice to just have a button to click.


So I'll definitely keep that in mind while writing the tutorial. I may also make an "easy to use" version that further encapsulate the morpher script into a 3D mixer control object so that all you have to do is link up your meshes, translation matrix, and just move the 3D slider objects up and down. ;)


-Jack.

Post by Humdinger // Apr 12, 2007, 2:19am

Humdinger
Total Posts: 319
pic
@ Humdinger:


Fist of the North Star eh?


Did you see this new tool listed in the new features:

"Soft Shape Paint"


Pair that with the morpher and.... :D :D :D


-Jack.


Muahahahahahahahahahahah!


Mr. Kenshiro awaits!

Post by Burnart // Apr 12, 2007, 12:47pm

Burnart
Total Posts: 839
pic
Yes works in 7.1 ;)


.... I'll definitely keep that in mind while writing the tutorial. I may also make an "easy to use" version that further encapsulate the morpher script into a 3D mixer control object so that all you have to do is link up your meshes, translation matrix, and just move the 3D slider objects up and down. ;)


-Jack.


Good on you Jack. I look forward to the results - and I'll keep playing with it at my end anyway - who knows I might figure it out!

Post by Saul // Apr 13, 2007, 3:11am

Saul
Total Posts: 32
Here's the filter script:


[CODE]


Object is also attached.



Hi Jack

Good work! Where is the Filter object? I get a sort of elongated cube from the download.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn