#1
|
|||
|
|||
How to make avatar's eyes to blink when speaking
I'am looking for a way to make my avatar's eyes to blink when speaking
just as natural .If anybody has ever done it, I would like to know how. thanks. |
#2
|
|||
|
|||
The avatars that comes with Vizard don't contain any blinking animations or morph targets. If you created your own avatar using 3dsmax then you could add a blink morph to the avatar and control this within your script. Here is some sample code that shows how to make an avatar blink using a morph target:
Code:
avatar = viz.add('avatar.cfg') #Blink morph ID of avatar BLINK_MORPH = 1 #Action that will animate blink closing close_eye = vizact.morph(BLINK_MORPH,1,0.1) #Action that will animate blink opening open_eye = vizact.morph(BLINK_MORPH,0,0.1) #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, close_eye, open_eye, viz.FOREVER ) #Add blink action to avatar avatar.addAction(blinkAction) |
#3
|
|||
|
|||
Hi
I'm using vizard 3.0 which comes with the 'biohead_all_morph.vzf'. This vzf contains a blinkR & blinkL morph. Is there no way to make this avatar blink? hopefully yours |
#4
|
|||
|
|||
The code I posted above also applies to vzf objects. Just set the BLINK_MORPH variable to the name or id of the faces blink morph.
|
#5
|
|||
|
|||
I've tried to adapt your code, but failed.
So again here is the code I used -------------------------- import viz viz.go() avatar = viz.add('female.cfg', pos=(0,0,1), euler=(180,0,0)) avatar.face('biohead_all_morph.vzf') #Blink morph ID of avatar BLINK_MORPH = blinkL #NameError: name 'blinkL' is not defined BLINK_MORPH = 4 #nothing happens the parts omited here are equal to yours. -------------------------------------------- What did I wrong? |
#6
|
|||
|
|||
The blink name must be a string, and you must apply the action to the face object. Here is a sample script:
Code:
import viz viz.go() face = viz.add('biohead_all_morph.vzf') avatar = viz.add('female.cfg', pos=(0,0,1), euler=(180,0,0)) avatar.setFace(face) #Blink morph ID of avatar BLINK_MORPHL = 'blinkL' BLINK_MORPHR = 'blinkR' #Action that will animate blink closing close_eyeL = vizact.morph(BLINK_MORPHL,1,0.1) close_eyeR = vizact.morph(BLINK_MORPHR,1,0.1) #Action that will animate blink opening open_eyeL = vizact.morph(BLINK_MORPHL,0,0.1) open_eyeR = vizact.morph(BLINK_MORPHR,0,0.1) #Action that will wait 1-5 seconds wait_blink = vizact.waittime(vizact.randfloat(1,5)) #Action to close/open both eyes close_eyes = vizact.parallel(close_eyeL,close_eyeR) open_eyes = vizact.parallel(open_eyeL,open_eyeR) #Action that will blink indefinitely blinkAction = vizact.sequence( wait_blink, close_eyes, open_eyes, viz.FOREVER ) #Add blink action to face face.addAction(blinkAction) |
#7
|
|||
|
|||
... how awkward.
Works great. Thanks for your patient support. |
#8
|
|||
|
|||
Constant blink with other actions
I have read through michelcm3's post but still have some questions about how to make an avatar's eyes blink during other actions (e.g., smiling, talking, waving, when info boxes appear and disappear, while gathering user input, etc.).
I first made the following code, which used .vzf files from Jeremy Bailenson. When the code is run, you must click the mouse once and then both avatar faces will start blinking every 1-2 seconds. The code seemed very simple and worked well, but I've run into problems trying to use it in other ways. Code:
import viz viz.go() #*********************************************************************** #Now for the Male(M-0327) #*********************************************************************** male1 = viz.add('male.cfg') male1.translate(0,0,2) male1.rotate(0,1,0,180) male1.state(1) #Neutral state of the male avatar face1 = male1.face('M-0327.vzf')#Add a face to the avatar male1.setFace(face1) #*********************************************************************** #Now for the Male(M-0456) #*********************************************************************** male2 = viz.add('male.cfg') male2.translate(0.75,0,2) male2.rotate(0,1,0,180) male2.state(1) #Neutral state of the male avatar face2 = male2.face('M-0456.vzf')#Add a face to the avatar male2.setFace(face2) #***************************************************************** #Blinking of the eyes #***************************************************************** close_eye = vizact.morph("blink",1,0.1) #Action that will animate blink closing open_eye = vizact.morph("blink",0,0.1) #Action that will animate blink opening wait_blink = vizact.waittime(vizact.randfloat(1,2)) #Action that will wait 1-2 seconds blinkAction = vizact.sequence(wait_blink, close_eye, open_eye, viz.FOREVER) #Blink indefinitely #Add blink action to face, different avatars will have a slightly different blink rate face1.addAction(blinkAction) face2.addAction(blinkAction) #*********************************************************** #Adding a Room3 #*********************************************************** room = viz.add('panorama.ive') # Load VRML object room.scale(1,1,1) # scale actual room.translate(0,0,0) ## position in the world For the purposes of posting a more general example to the forum, I applied the blinkAction to biohead_talk.vzf. When the following code is run, you don't have to click the mouse to make the avatar body wave and its face blink. However, if line 26 is commented out (removing the wave action), the blinkAction does not occur at all. Why does adding an action to the avatar body effect an action on the avatar face? Why is blinkAction not working on its own on biohead_talk.vzf? Code:
import viz import viztask viz.go() male1 = viz.add('male.cfg') #Add an avatar male1.translate(0,0,1) male1.rotate(0,1,0,180) male1.state(1) #Start in neutral state animation face1 = male1.face('biohead_talk.vzf') #add a face to the avatar male1.setFace(face1) #***************************************************************** #Blinking of the eyes #**************************************************************** close_eyeL = vizact.morph("blinkL",1,0.1) #Action that will animate left blink closing close_eyeR = vizact.morph("blinkR",1,0.1) #Action that will animate right blink closing open_eyeL = vizact.morph("blinkL",0,0.1) #Action that will animate blink opening open_eyeR = vizact.morph("blinkR",0,0.1) #Action that will animate blink opening wait_blink = vizact.waittime(vizact.randfloat(1,2)) #Action that will wait 1-2 seconds close_eyes = vizact.parallel(close_eyeL,close_eyeR) #Action to close both eyes open_eyes = vizact.parallel(open_eyeL,open_eyeR) #Action to open both eyes blinkAction = vizact.sequence(wait_blink, close_eyes, open_eyes, viz.FOREVER) #Blink indefinitely face1.addAction(blinkAction) #Add blink action to face male1.state(5) #*********************************************************** #Adding a world #*********************************************************** room = viz.add('panorama.ive') room.scale(1,1,1) # scale actual room.translate(0,0,0) # position in the world More importantly, what I really want to do is use the blinkAction in a program that runs multiple actions on multiple avatars, based on time and user events, with interactive info boxes, etc. I want all avatars in the scene to blink every 1-2 seconds no matter what else is going on (e.g., if an avatar is smiling, talking, or waving; when info boxes appear and disappear; while user input is gathered, etc.). The following code uses a scheduler to run a series of actions. While these actions are going on, I want the avatar to blink. Adding blinkAction to an avatar (line 25) alone did not work. So I added a function to execute blinkAction when the spacebar was pressed. However, once the StartAnimation function is started, you have to keep pressing the spacebar for the blinkAction to continue. Is there a way to add blinkAction to an avatar face without hitting the spacebar (line 30 and 49 did not work)? Also, I have seen that blinkAction can get stuck in the eye lid down position while the wave sequence (line 53) is completing, so the avatar waves with his eyes closed and opens them after the wave is completed and a user hits the spacebar again. Can multiple avatars constantly blink their eyes while other functions are running actions on the avatar bodies and faces? Code:
import viz import viztask viz.go() male1 = viz.add('male.cfg') #Add an avatar male1.translate(0,0,1) male1.rotate(0,1,0,180) male1.state(1) #Start in neutral state animation face1 = male1.face('biohead_talk.vzf') #add a face to the avatar male1.setFace(face1) #***************************************************************** #Blinking of the eyes #**************************************************************** close_eyeL = vizact.morph("blinkL",1,0.1) #Action that will animate left blink closing close_eyeR = vizact.morph("blinkR",1,0.1) #Action that will animate right blink closing open_eyeL = vizact.morph("blinkL",0,0.1) #Action that will animate blink opening open_eyeR = vizact.morph("blinkR",0,0.1) #Action that will animate blink opening wait_blink = vizact.waittime(vizact.randfloat(1,2)) #Action that will wait 1-2 seconds close_eyes = vizact.parallel(close_eyeL,close_eyeR) #Action to close both eyes open_eyes = vizact.parallel(open_eyeL,open_eyeR) #Action to open both eyes blinkAction = vizact.sequence(wait_blink, close_eyes, open_eyes, viz.FOREVER) #Blink indefinitely #face1.addAction(blinkAction) #Add blink action to face def BlinkAct(): print "in blink function" face1.addAction(blinkAction) #Add blink action to face vizact.onkeydown(" ", BlinkAct) #vizact.call(BlinkAct) #Add Avatar Face Morphs*************************************************** smile = vizact.morph(0,2,0.5) #Smiling face of biohead_talk.vzf open = vizact.morph(5,0.5,0.5) #mouth open morph of biohead_talk.vzf #Add Avatar Body Animations************************************************ wave = vizact.animation(5) #Waving for male.cfg smile_friendly = vizact.parallel(smile, open) #connect to face1 (face, not body) #Create an action sequence to introduce avatar intro = vizact.sequence(wave, 2) def StartAnimation(): #Set variables count = 0 while count<4: #Run a few times # yield BlinkAct() # vizact.call(BlinkAct) # viztask.addAction(face1, blinkAction) yield viztask.runAction(face1, smile_friendly) yield viztask.runAction(male1, intro) yield viztask.waitTime(2) #Wait 2 seconds count += 1 viztask.schedule( StartAnimation() ) #*********************************************************** #Adding a world #*********************************************************** room = viz.add('panorama.ive') room.scale(1,1,1) # scale actual room.translate(0,0,0) # position in the world Karla |
#9
|
|||
|
|||
I ran your second script with line 26 commented out, and the blink action still worked. If you want the blink action to run in parallel with other actions, then simply add the blink action to another action pool. The documentation should explain how action pools work. The following code will add the blink action to pool 250 (this number is arbitrary and can be any value):
Code:
face1.addAction(blinkAction,pool=250) #Add blink action to face |
#10
|
|||
|
|||
for making avatar i worked with Video Avatar from geovid.com/Video_Avatar.
its very simple and comfy...first i worked with trialware and it was nice too coz its have no timelimit. i advice to try it! gluck! |
#11
|
|||
|
|||
The avatars discussed in this forum are 3 dimensional avatars which are used for interaction, typically in a 3D environment.
VideoAvatar seems to be a tool for creating 2-dimensional animated 'avatar' gifs out of Video. This might be a nice gadget for webpages etc. The VideoAvatar tool seems of minimal use to anybody who wants to create 3D interactive avatars. |
#12
|
|||
|
|||
Video UserPic
i used VideoAvatar its very cool tool,but for more difficult work i find another good tool its visifly.com/Video_UserPic its have demo too and no timelimit too...
|
#13
|
|||
|
|||
again, this is a tool to make an animated gif out of a video. while this might be interesting for web sites etc., it has nothing to do with the interactive avatars discussed in this forum.
|
|
|