PDA

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


vr_boyko
10-22-2004, 12:50 PM
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)?

Thanks!

farshizzo
10-22-2004, 12:59 PM
Hi,

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?

vr_boyko
10-25-2004, 08: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:

person1.changehead('disgust.jpg')

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?

farshizzo
10-26-2004, 11:44 AM
Hi,

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)
newtexture.wrap(viz.WRAP_T,viz.REPEAT)