How to create "expressions"?

Technical questions, etc..
Post Reply
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

How to create "expressions"?

Post by Draise »

I need to somehow create a script that can read the matrix value of a joint and feed it to a morph shape with linear or bezier interpolation - with Javascript (I tried with the LE, but expanding the matrix of a joint makes it unmoveable with dynapose) - then I could create some muscles/corrective shapes like a charm - or even squash and stretch controls - or driver controls for different morph targets or other object's matrix values.

How would one do that?


Clue 1) I know in the SDK that one can read matrix values, but I am not sure how it is done in practical example. Does anyone know of that?
Clue 2) Use the expanded matrix of an IK handle to drive the morph in the LE?

What is the basic markup to get the matrix value of any selected/named object to then drive the matrix/morph/color/attribute target of any selected/named object?
User avatar
clintonman
Captain
Posts: 5429
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: How to create "expressions"?

Post by clintonman »

Maybe you can get some ideas from this. Modified piston rig file to randomly drive a morph. It only works if the skeleton is open in the link editor.
Attachments
pistonRigMorph.zip
(136.04 KiB) Downloaded 179 times
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: How to create "expressions"?

Post by Draise »

Thanks Clinton! Impressive piston work you got there. Always wondered how to make pistons.

Concerning the morph.. hmm....

Considering that I can only read World Matrix values from joints or handles - I am not sure I can accurately use them as controls.

But I do see what you did with this rig, any change in movement will control the morph with increments over time, that also could work for some features. .

I also found one can expand the matrix values of joints, and play with the attributes to drive the shape - using min/max and other math operations. That was one way of doing it through the LE, quite fast really - but the only problem was the world Matrix values (rotate the rig, and you break it).

Now seeing the limitations of trueSpace, considering everything moves in world Matrix values - joints never working on local Matrix - I may have to.... scrap the idea of using a rig to drive anything - unless it's a static rig with a fixed camera in a fixed space.

Actually, that could work, have two rigs in the character - one has it's own orthographic camera that can be toggled/created with a click of a button. Once it's created the rig will be locked in place and will drive different morphs.

I won't be able to use it to drive any joint rotation/translation though, as it's..... world Matrix. Boo.



Now, the question is reading the matrix of a joint/handle to then drive a morph without having to link it in the LE (which overrides the record button - not good) via script. I don't mind it not being realtime, and preferably I'd have it without the need of having the LE open, maybe compensating with an "apply morphs" button.

@Clinton, Why did the piston only work when the skeleton/actor was open in LE?


Hmm.. maybe I should get my goals set - considering the reality of the possibilities
Goals:
-Create a morph target keyset easy to access in the Keying Panel.
-Drive such morphs either through the LE color selectors/sliders, with a static rig/camera setup that can be called by button (create new screen, set camera), or with static object nulls.
-Have the drivers either update the morphs realtime, or with an "apply" button

I currently have the system with my Minlis rig with sliders and color selectors in the LE driving morphs, but to dig into the rig to find the RGB color parts to drive things is a bit tricky.

I guess I'm just trying to find shortcuts, as animating and switching keysets - or not having a good autokeyframer.. hmm. I have to research more. Thanks for the ideas Clinton!
User avatar
clintonman
Captain
Posts: 5429
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: How to create "expressions"?

Post by clintonman »

I don't know why the LE has to be open. I posted the piston rig here some time ago and it didn't need the LE open until I added the morph part.

This sample is from the bind pose for fbx code that will convert world to local matrix given the parent and child world matrices.
theMatrix is the child nodes world matrix
parentMatrix is the parent nodes world matrix
The child is multiplied by the parents inverse matrix giving the local matrix.

Code: Select all

theMatrix = Node.Value(bindgroup + "/" + subNode, "WldMatrix");
parentMatrix = Node.Value(bindParent, "WldMatrix");
parInvert = parentMatrix.Invert();
theMatrix.Mult(parInvert);
//now theMatrix contains local instead of world
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: How to create "expressions"?

Post by Draise »

Handy! So I need the a parent that will move around in the world matrix, and the child will then get a local matrix? This will be useful. I will try do some experiments.

Actually, I could use objects with their Object Matrix, which would be local relative to the parent - and use those as controls.. hmm.
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: How to create "expressions"?

Post by Draise »

Ok, found out that indeed, I can use objects that have Obj Matrices (local) glued to bones to drive shape controls. They are easy to animate, and I just have to animate their matrices. So each objects translation, rotation and scale can be hooked up to a number of morphs. Awesome.

So I can create a very advanced facial rig that way, using "nulls" and hide them upon "render".
Post Reply