WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
  #1  
Old 08-22-2008, 09:00 AM
Karla Karla is offline
Member
 
Join Date: May 2007
Posts: 12
Avatar's face blacked out

Thanks for the suggestion. It works for quad objects but not for the avatar's face.

The avatar's face becomes blacked out when the texture is applied. There seems to be a difference between applying a texture to an avatar's face and applying it to other objects. I am having a similar problem as in post
http://www.worldviz.com/forum/showthread.php?t=776

Using 'texture.wrap(viz.WRAP_S,viz.REPEAT), texture.wrap(viz.WRAP_T,viz.REPEAT),' applies the texture correctly to the avatar's face. Therefore, it is not blacked out when using 'wrap.'

How can I incorporate 'wrap' with the random texture application? An error message said "'ActionData' object has no attribute 'wrap'."

Thanks,
Karla

[/CODE]

Code:
#August 22nd, 2008
import viz
viz.go()

#Orient view to look at avatar
mv_x = 0; mv_y = 1.78; mv_z = -1.0; viz.MainView.setPosition(mv_x,mv_y,mv_z)
mv_euler_x = 180; mv_euler_y = 0; mv_euler_z = 0; viz.MainView.setEuler(mv_euler_x,mv_euler_y,mv_euler_z)

#Create avatar for displaying texture
character1 = viz.add('male.cfg'); character1.translate(0,0,-1.4572); character1.rotate(0,1,0,0); character1.state(1) #Neutral state of avatar 
face1 = character1.face('M-0327.vzf')	#add a face to the avatar
eyes_center = viz.add('M-0327_eyes_Center.jpg'); face1.texture(eyes_center); eyes_center.wrap(viz.WRAP_S,viz.REPEAT); eyes_center.wrap(viz.WRAP_T,viz.REPEAT)

#TRYING TO DEFINE A SEQUENCE THAT RANDOMLY CHANGES THE TEXTURE ON THE AVATAR'S FACE
#Intention: Make a Sequence that Waits 2-6sec., Randomly changes gaze, Repeats
#Use 4 positions (Left, Right, Center, and Up) to create different Eye Contact 

#List of texture filenames
files = ['M-0327_eyes_Left.jpg','M-0327_eyes_Right.jpg','M-0327_eyes_Center.jpg','M-0327_eyes_Up.jpg']

#List of texture objects
textures = [ viz.addTexture(f) for f in files ]

#Create action that randomly waits between 2-6 seconds
waitTime = vizact.waittime( vizact.randfloat(2.0,6.0) )

#Create action that randomly applies texture from list above
randomTexture = vizact.texture_node( vizact.choice(textures,vizact.RANDOM) )


#Create sequence that repeats above actions indefinitely
my_action = vizact.sequence( waitTime, randomTexture, viz.FOREVER )

#Add action to avatar
face1.addAction(my_action)

#ERROR: Avatar's face is Blacked-out; need to set texture to repeating mode 

#Try setting texture to repeating mode
#files = ['M-0327_eyes_Left.jpg','M-0327_eyes_Right.jpg','M-0327_eyes_Center.jpg','M-0327_eyes_Up.jpg']
#textures = [ viz.addTexture(f) for f in files ]
#waitTime = vizact.waittime( vizact.randfloat(2.0,6.0) )
#randomTexture = vizact.texture_node( vizact.choice(textures,vizact.RANDOM) )
#my_action = vizact.sequence( waitTime, randomTexture, randomTexture.wrap(viz.WRAP_S,viz.REPEAT), randomTexture.wrap(viz.WRAP_T,viz.REPEAT), viz.FOREVER )
#face1.addAction(my_action)
#ERROR: Message says 'ActionData' object has no attribute 'wrap'
Reply With Quote
  #2  
Old 08-22-2008, 09:39 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Then set the the textures to repeat mode when you add them:
Code:
textures = [ viz.addTexture(f,wrap=viz.REPEAT) for f in files ]
Reply With Quote
  #3  
Old 08-22-2008, 12:14 PM
Karla Karla is offline
Member
 
Join Date: May 2007
Posts: 12
THANK YOU! THANK YOU! That code solves what I want.
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 04:47 PM.


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