WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-14-2008, 12:31 PM
Karla Karla is offline
Member
 
Join Date: May 2007
Posts: 12
bailenson suggested a texture solution.
I made the below arbitrary example (edited .jpg file attached) after following this thread:
<http://www.worldviz.com/forum/showthread.php?t=776&highlight=texture+avatar>

I see now how different textures can be put on the avatars to look like the eyes are moving (if the .jpg on the head has eyes that are looking left/right/etc. from edits using image software like Paint/Photoshop/etc.).

If anyone has answers to may first post above, I welcome them.

Thanks,
Karla

Code:
#March 14th, 2008
import viz
import vizinfo	#For info box
import viztask 	#For wait time

viz.go()

#Add a female face
female = viz.add('female.cfg')
female.translate(0,0,2)
female.rotate(0,1,0,180)
female.state(1) #Neutral state of the female avatar 
#To control the eyes, the name of the left and right eyes are geom_0 and geom_1
face = female.face('biohead_eyes.vzf')
l_eye = face.getchild('geom_0')
r_eye = face.getchild('geom_1')

#Add a male face
male1 = viz.add('male.cfg')
male1.translate(-0.65,0,2)
male1.rotate(0,1,0,180)
male1.state(1) #Neutral state of the female avatar 
Mface1 = male1.face('biohead_talk.vzf')#Add a face to the avatar
texture1 = viz.add('bioexample_0.jpg')	#regular face, eyes front and center
texture2 = viz.add('bioexample_0_changeEyes.jpg') #modified face, 'eyes' to left


#We have control of the eyes we need to have them look at something.
#Add a ball that moves around.
ball = viz.add('ball.wrl')
ball.translate(0.5,1.7,1.5) 
ball.scale(0.2,0.2,0.2)

#Simply create an infinite timer that updates the rotation of the eyes
#so that they are looking at the balls position.
def mytimer(num):
  pos = ball.get(viz.POSITION)
  r_eye.lookat(pos,0,viz.ABSOLUTE_WORLD)
  l_eye.lookat(pos,0,viz.ABSOLUTE_WORLD)
 
viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.01,viz.FOREVER)

def moveBall():
	yield viztask.waitTime(3)		#Wait 3 seconds
	ball.translate(-0.5,1.7,1.5) 
	ball.scale(0.2,0.2,0.2)
	Mface1.texture(texture2)
	texture2.wrap(viz.WRAP_S,viz.REPEAT)
	texture2.wrap(viz.WRAP_T,viz.REPEAT)
	yield viztask.waitTime(3)		#Wait 3 seconds
	ball.translate(-0.5,1.5,1.5) 
	ball.scale(0.2,0.2,0.2)
	Mface1.texture(texture1)
	texture1.wrap(viz.WRAP_S,viz.REPEAT)
	texture1.wrap(viz.WRAP_T,viz.REPEAT)
	yield viztask.waitTime(5)		#Wait 5 seconds
	ball.translate(0,1.5,1.25) 
	ball.scale(0.2,0.2,0.2)
	Mface1.texture(texture2)
	texture2.wrap(viz.WRAP_S,viz.REPEAT)
	texture2.wrap(viz.WRAP_T,viz.REPEAT)
		
viztask.schedule( moveBall() )
Attached Thumbnails
Click image for larger version

Name:	bioexample_0_changeEyes.JPG
Views:	6910
Size:	42.6 KB
ID:	226  
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with 3DMeNow Avatar Heads kim_swinth Vizard 9 11-19-2003 03:14 PM


All times are GMT -7. The time now is 01:51 PM.


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