View Full Version : How to simply texture an avatar's head with a jpeg graphic?

10-22-2004, 11:50 AM
Hi there,

So in regards to a previous post, we tried adding a "happy" or "angry" head as a morph target to the "neutral" head to no avail -- so we've come up with a 'hackish' solution.

We're taking the neutral texture graphic that's already applied to the neutral .vzf head....and then we're changing minor things around within that texture graphic, and we want to paste that texture onto the current .vzf head.

What's the code to simply overwrite the current texture graphic on the current .vzf head (without swapping .vzf files)?


10-22-2004, 11:59 AM

Just add the texture and apply it to the head:
neutral = viz.add('neutral.jpg')
happy = viz.add('happy.jpg')
head = viz.add('head.vzf')

head.texture(happy,'name of the geom you want to apply graphic to')
head.texture(neutral,'name of the geom you want to apply graphic to')
Did swapping the vzf heads not work either?

10-25-2004, 07:22 PM
When I did what you suggested (adding a new function to my person class to texture the head with jpegs)

def changehead(self, texture):

newtexture = viz.add(texture)
self.head.texture(newtexture, 'geom_0')

And I called the function using some arbitrary key:


The head in the world turns black...the texture doesn't look like it's been applied to the head...am I doing something wrong?

10-26-2004, 10:44 AM

I believe your head model is using repeating texture coordinates, so you'll probably need to set the texture to repeat mode also. After you add the texture try the following:newtexture.wrap(viz.WRAP_S,viz.REPEAT)