WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 37 votes, 5.00 average. Display Modes
  #1  
Old 09-06-2007, 06:03 AM
michelcm3 michelcm3 is offline
Member
 
Join Date: Jul 2007
Posts: 13
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.
Reply With Quote
  #2  
Old 09-06-2007, 11:00 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Reply With Quote
  #3  
Old 09-20-2007, 07:31 AM
carmoe carmoe is offline
Member
 
Join Date: Aug 2007
Posts: 4
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
Reply With Quote
  #4  
Old 09-20-2007, 10:01 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #5  
Old 09-25-2007, 02:49 AM
carmoe carmoe is offline
Member
 
Join Date: Aug 2007
Posts: 4
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?
Reply With Quote
  #6  
Old 09-25-2007, 09:41 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Reply With Quote
  #7  
Old 09-26-2007, 05:03 AM
carmoe carmoe is offline
Member
 
Join Date: Aug 2007
Posts: 4
... how awkward.
Works great. Thanks for your patient support.
Reply With Quote
  #8  
Old 01-02-2008, 12:48 PM
Karla Karla is offline
Member
 
Join Date: May 2007
Posts: 12
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
Thanks for any input!

Karla
Reply With Quote
  #9  
Old 01-04-2008, 10:03 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #10  
Old 01-09-2008, 03:24 AM
killa killa is offline
Member
 
Join Date: Jan 2008
Posts: 1
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!
Reply With Quote
  #11  
Old 01-09-2008, 04:46 AM
mspusch mspusch is offline
WorldViz Team Member
 
Join Date: Feb 2003
Posts: 223
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.
Reply With Quote
  #12  
Old 01-15-2008, 03:57 AM
Kran007 Kran007 is offline
Member
 
Join Date: Jan 2008
Posts: 1
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...
Reply With Quote
  #13  
Old 01-15-2008, 08:48 AM
mspusch mspusch is offline
WorldViz Team Member
 
Join Date: Feb 2003
Posts: 223
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:22 AM.


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