WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-14-2004, 12:01 PM
bailenson bailenson is offline
Member
 
Join Date: May 2004
Posts: 35
changing the texture of an avatars shirt/body

Hello, do you happen to have some sample code on how one might change the texture that is on an avatar's shirt or skin? thanks!

Jeremy
Reply With Quote
  #2  
Old 09-14-2004, 01:32 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi Jeremy,

The image that contains the shirt texture also contains the texture for the rest of the avatars body. So you would have to modify the original texture in order to change the shirt. However, the current textures belong to Anacapa Sciences, and they do not allow you to modify their texture.
Reply With Quote
  #3  
Old 09-14-2004, 01:53 PM
bailenson bailenson is offline
Member
 
Join Date: May 2004
Posts: 35
I had heard that, without having to make real changes to the texture itself, you could use the 'getchild' command to grab part of the avatar and retexture it in Vizard. In other words, you can't do fine-tuning of the uvw map of the texture, but you can stick a general texture on an arm or a chest, etc. So far, I haven't been able to make this work. Have you seen this be successful?

thanks for your time,
jb
Reply With Quote
  #4  
Old 09-14-2004, 02:03 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi Jeremy,

Here's some sample code that will apply a texture to the male's torso. The problem is creating the shirt texture so that it aligns perfectly onto the avatar. If you just want to change the shirt to a solid color, then you can just create a texture of a solid color and apply it to the avatars torso.
Code:
shirt = viz.add('shirt.jpg')
male.texture(shirt,'m_torso_LS.cmx')
To make this work for the female you will need to change m_torso_LS.cmx to m_torso.cmx.
Reply With Quote
  #5  
Old 09-14-2004, 02:08 PM
bailenson bailenson is offline
Member
 
Join Date: May 2004
Posts: 35
great...also, how do you get the breakdown of the parts of the body as they map to specific cmx files? thanx, j
Reply With Quote
  #6  
Old 09-14-2004, 02:28 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi Jeremy,

You can open up male.cfg or female.cfg in the Vizard20/resources directory. You can apply textures to all the mesh files. You can also perform other functions, like changing color. Basically, most node3d commands that accept a subchild as an optional argument, you can pass it the name of the mesh. However, you can't use the name of the mesh when calling getchild.
Reply With Quote
  #7  
Old 09-14-2004, 03:56 PM
bailenson bailenson is offline
Member
 
Join Date: May 2004
Posts: 35
heya...i tried the code you used above but nothing changes when I apply a texture...can you confirm that it does work on your end?

thanx
Reply With Quote
  #8  
Old 09-14-2004, 04:12 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi Jeremy,

Yeah, it works here. I just noticed that the name of the torso mesh is different from the version you have. Change it to male_torso_LS.cmx
Reply With Quote
  #9  
Old 09-15-2004, 07:05 PM
bailenson bailenson is offline
Member
 
Join Date: May 2004
Posts: 35
works now, thanks much, jb
Reply With Quote
  #10  
Old 09-20-2004, 04:49 PM
vadrian vadrian is offline
Member
 
Join Date: Sep 2004
Posts: 32
Question foreign clothing

I have a related question regarding clothing texturing.

I need to change the textures of avatars to resemble foreign clothing. However, most cultures do NOT all wear tight shirts and even tighter pants

How can I "texture" things like full-body fabrics, dresses, head-pieces, rags, etc?

(my project is to make a VE of a 3rd world village)

-adrian
Reply With Quote
  #11  
Old 09-20-2004, 05:00 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Changing the texture will only affect the surface appearance of an obect. To simulate different types of outfits you would have to actually model them using Character Studio.

For things like head-pieces you can use a separate model and attach it to the head of the avatar. Vizard comes with a sample script showing how to do this. Look in the [Vizard20]/examples/avatar directory for a script called linkbones.py.

Let me know if you need any more help.
Reply With Quote
  #12  
Old 05-01-2006, 07:17 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
Problem mapping mesh names to actual meshes

Hi,

I need to change the texture of a specific mesh of a home-made cal3d avatar. The problem is that vizard doesn't seem to map the mesh names right. Hypothetically I use a .cfg file that looks like this (this is in fact only a fragment of the real .cfg I'm using):

----------
skeleton = avatar_skel.CSF

mesh = head.CMF
mesh = torso.CMF
mesh = pants.CMF
mesh = rhand.CMF
mesh = lhand.CMF
etc.

material = head.CRF
material = shirt.CRF
material = pants.CRF
material = rhand.CRF
material = lhand.CRF
etc.

--------------

Now, let's say I want to change the texture of the shirt to shirt.jpg. I would do the following, right?

Code:
avatar = viz.add('avatar.cfg')
shirt = viz.add('shirt.jpg')
avatar.texture(shirt, 'shirt.CMF')
This doesn't work. It changes a texture alright, but not of the shirt (depending on the order of the meshes in the .cfg file it changes the texture of another mesh, and actually it looks kinda cool to have a red eye-ball ).

Anyway, what am I doing wrong? (I'm using vizard 2.53f)

Regards,

Ron
Reply With Quote
  #13  
Old 05-01-2006, 03:59 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I believe this is related to a known bug in 2.53. If you specify a mesh name that is invalid then Vizard will use the first mesh file instead. This has been fixed in 3.0. In the meantime, make sure the mesh name you are specifying is correct. In your sample code you specify shirt.CMF but it is not in your mesh list. However there is a shirt.CRF in your material list. Are you sure you are not mixing up meshes with materials?
Reply With Quote
  #14  
Old 05-02-2006, 05:13 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
Hi,

Sorry, I screwed up in my example: it should have been avatar.texture(shirt, 'torso.CMF'). In my real program I do use the correct mesh names (I have to use the mesh names, right? Not materials), I've checked twice, but it still seems to select the wrong mesh.

What exactly is the bug in this version about?

By the way, a totally unrelated question: do you know whether there exists a Cal3d exporter for Maya 7 for the Cal3d version Vizard uses? And an OSG exporter?

Ron

Last edited by rdotsch; 05-02-2006 at 05:17 AM.
Reply With Quote
  #15  
Old 05-02-2006, 03:52 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

If you remove torso.cmf from your cfg file does the torso mesh disappear?

I know there is an exporter for maya 6, but I haven't seen one for maya 7. If you provide me with the proper SDK files for Maya, I can attempt to compile an exporter for it.
Reply With Quote
  #16  
Old 05-03-2006, 06:05 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
Yes, the torso mesh disappears.

I should have the Maya 7 sdk here. How can I get them to you? Do you have an ftp server I can upload to?

Regards,

Ron
Reply With Quote
  #17  
Old 05-03-2006, 06:19 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
I think I figured out a pattern: when I try to change the texture of a mesh, it changes the texture of the mesh that is one step above the target mesh in the vizard resources list. In that list the meshes are sorted in alphabetical order (independent of the order in the .cfg file). Bad luck for me, the mesh I need is the one that is the lowest in alphabetical order, so I can't just use the mesh below it.

I could change the names of the meshes and change them in the cfg file, that's not a big problem. But I'd prefer to use the right names for the meshes, it would make reading the code less of a problem for others.

Kind regards,

Ron
Reply With Quote
  #18  
Old 05-03-2006, 04:07 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Well, I'm out of ideas. It would be easier for me to debug whats going on if you sent me your avatar files. You can also send me the Maya SDK. My email address is lashkari@worldviz.com
Reply With Quote
  #19  
Old 05-04-2006, 04:47 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
I figured out the problem: the meshes have to be sorted alphabetically in the .cfg for this to work right. If not, vizard seems to sort the meshes alphabetically in memory, selects the right mesh, takes the position of that mesh in the ordered list, and then uses that position to change texture for the mesh that's sitting on that position in the .cfg file.

Solution: sort the meshes in the .cfg file alphabetically.

Regards,

Ron
Reply With Quote
  #20  
Old 05-04-2006, 10:00 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Glad to hear you found a solution. Which version of Vizard are you using? I still can't replicate your problem. I even ordered all the meshes in reverse alphabetical order and it still worked fine.
Reply With Quote
Reply

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


All times are GMT -7. The time now is 01:56 AM.


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