WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Adding Morphs to the Face of Avatar (https://forum.worldviz.com/showthread.php?t=5089)

pradeep 07-01-2014 11:08 PM

Adding Morphs to the Face of Avatar
 
As i have seen from previous many discussions i did well for my blink actions in my face which is created my self using peoplemaker tool.

I have designed my own face using faceGen software and i added lot of expression into the people maker and i added all my morphs

the morphs added are

leftblink
rightblink
angry
smile_1
smile_2
eyesclosed
fear
simple_smile
sad
sad1
lookleft(eyes)
lookright(eyes)
etc.

could you please help me out by giving some idea about how to make all this morphs to be added into my code as an actions of avatar face. I tried with blink its working good but for other morphs i dont know exactly

pradeep 07-01-2014 11:10 PM

face=avatar.face('pradeephead.vzf')
BLINK_MORPH_LEFT = 0
BLINK_MORPH_RIGHT = 1
ANGRY='smile1'
#Action that will animate blink closing
close_eye_left = vizact.morph(BLINK_MORPH_LEFT,1,0.1)
close_eye_right = vizact.morph(BLINK_MORPH_RIGHT,1,0.1)
closing_eyes = vizact.parallel(close_eye_left, close_eye_right)
#Action that will animate blink opening
open_eye_right = vizact.morph(BLINK_MORPH_RIGHT,0,0.1)
open_eye_left = vizact.morph(BLINK_MORPH_LEFT,0,0.1)
opening_eyes = vizact.parallel(open_eye_left, open_eye_right)
#Action that will wait 1-5 seconds
wait_blink = vizact.waittime(vizact.randfloat(1,5))
#Action that will blink indefinitely
blinkAction = vizact.sequence( wait_blink, closing_eyes, opening_eyes, viz.FOREVER )
#Add blink action to avatar
face.addAction(blinkAction,0)

This action of eye blinks are working well



This action of angry is not working can you tell where my code went wrong please

angry=vizact.morph(ANGRY,1,0.1)
neutral=vizact.morph(ANGRY,0,0.1)
action=vizact.sequence(wait_blink,angry,viz.FOREVE R)
face.addAction(action)

Frank Verberne 07-02-2014 12:52 AM

Quote:

Originally Posted by pradeep
This action of angry is not working can you tell where my code went wrong please

angry=vizact.morph(ANGRY,1,0.1)
neutral=vizact.morph(ANGRY,0,0.1)
action=vizact.sequence(wait_blink,angry,viz.FOREVE R)
face.addAction(action)

Two mistakes:
- The value of ANGRY is 'smile1', which is not a valid morph for your face, 'smile_1' however is. You can also use index numbers, in which case your angry morph target has index 2, and your smile morph target index 3 (based on the list you provided in your first post).
- the sequence should include both morphs, so action=vizact.sequence(wait_blink,angry,neutral,vi z.FOREVER). You probably need to change the parameter 0.1 to a higher value, to decrease the speed of the change (this speed is good for eye-blinking, but may not be suited for other morphs.

For more information, read http://docs.worldviz.com/vizard/p_us..._in_vizard.htm and http://docs.worldviz.com/vizard/comm...ct/morphTo.htm.

pradeep 07-02-2014 01:43 AM

Hi,
Thanks a lot and i got my morphs working good but can i add all the morphs in my face in sequence. Because when i add blink action my angry morph is not working and vice-versa. Could you plz tell me how to add many morphs in a single play.

Frank Verberne 07-02-2014 02:03 AM

I do not understand your problem fully. Providing sample code helps to clarify the problem greatly. Please use the code tags (click the # symbol while writing your message) to preserve indentation in your code as well.

As far as I know, you can put as many actions as you want in a vizact.sequence. Therefore,
Code:

vizact.sequence( wait_blink, closing_eyes, opening_eyes, angry, neutral, viz.FOREVER )
should result in a sequence of wait, blinking eyes, and angry.

See http://docs.worldviz.com/vizard/comm...t/sequence.htm for more information.

pradeep 07-02-2014 04:02 AM

Hi,
Thank you for your kind and patience reply. I really feel helpful with the knowledge what you provide

Here i included my code and problem i face,
face=avatar.face('pradeephead_black.vzf')
BLINK_MORPH_LEFT = 0
BLINK_MORPH_RIGHT = 1
ANGRY=3

#Action that will animate blink closing
close_eye_left = vizact.morph(BLINK_MORPH_LEFT,1,0.1)
close_eye_right = vizact.morph(BLINK_MORPH_RIGHT,1,0.1)
closing_eyes = vizact.parallel(close_eye_left, close_eye_right)
#Action that will animate blink opening
open_eye_right = vizact.morph(BLINK_MORPH_RIGHT,0,0.1)
open_eye_left = vizact.morph(BLINK_MORPH_LEFT,0,0.1)
opening_eyes = vizact.parallel(open_eye_left, open_eye_right)
#Action that will wait 1-5 seconds
wait_blink = vizact.waittime(vizact.randfloat(1,5))
#Action that will blink indefinitely
blinkAction = vizact.sequence( wait_blink, closing_eyes, opening_eyes, viz.FOREVER )
#Add blink action to avatar
face.addAction(blinkAction,0)

ANGRY=3
angry=vizact.morph(ANGRY,1,0.8)
neutral=vizact.morph(ANGRY,0,0.8)
wait=vizact.waittime(vizact.randfloat(1,5))
action=vizact.sequence(wait,angry,neutral,viz.FORE VER)
face.addAction(action)
This is my code where i need the avatar blink action for the entire session. while i can add some other morphs in-between when ever i need in my code in some functions.

Thank you,
Regards,
Pradeep Raj

Frank Verberne 07-02-2014 05:03 AM

Again, your question is not completely clear to me. If you want to have multiple action at the same time, add them to separate pools. Now, you add the blink action to pool 0, and for your angry action, you don't specify a pool. Because the default is pool 0, both actions are added to the same pool. This should do it:
Code:

face.addAction(action,1)
For more information about actions, see: http://docs.worldviz.com/vizard/Acti...troduction.htm.

pradeep 07-02-2014 11:57 PM

Ya i got my mistake, actually i dint used the pool vales. That is the problem i faced. Thank you for your answer.

Regards,
Pradeep Raj


All times are GMT -7. The time now is 03:30 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC