Texturing vertex groups?

Hello,

I am having troubles applying a texture to only certain parts of my geometry, which was created in blender. I thought the right way to do this was to create Vertex Groups in blender and then assigning those Vertex Groups textures in panda. But panda cannot locate the vertex groups in my egg file.

I am trying to do it like this :

myModel = loader.loadModel('models/Humanoid.egg')
myTexture = loader.loadTexture("models/blue.bmp")
part = myModel.find('**/Armature/joint_texture')
part.setTexture(myTexture, 1)

(here, ‘Armature’ is the model and ‘joint_texture’ is the Vertex Group)

Can anyone tell me how I can do this?

Thanks in advance

I don’t know what a ‘vertex group’ is, but if it’s blender’s way of assigning multiple textures within a given node, you’ll probably need to split that geometry into separate nodes to allow you to retexture it independently once it gets into Panda.

Basically, Panda’s scene graph controls are designed to operate on a per-node level. Anything that you want to modify independently of other geometry has to be in its own node.

David

Vertex groups will not work for this, and they are only used for animation. However, Blender also has the ability to assign multiple materials to a single mesh, using the interface adjacent to the vertex groups interface. Chicken actually exports a separate node for every material assigned like this, so you can grab them and make the change. (I can’t remember the naming scheme right this minute however - its in the manual somewhere.)

Ok thanks for the help. Now I have split the geometry into separate parts and they show up as separate nodes within the egg file.

However, I am still not able to access the part with Panda. The part I’m trying to access is part of a fully rigged model. So although the node is separate, it is located within the Armature group of the model in the egg file. (I guess you would call it a subgroup of the Armature group)

So when I do the following command:

part = myModel.find('**/Armature/Humanoid_joints')

The geometry node (called Humanoid_joints) cannot be found. (Although it can find the Armature group node fine)

Does this have to do with the fact that the geometry is within the Armature group? How can I find the geometry node so that I can then assign it a new texture?

Thanks again!

I’m not sure what your asking entirely - calling a group ‘Armature’ seems a bit silly to me, as they are a separate concept and nothing to do with texture replacement. Armatures themselves are in no way related to the feature we are discussing, which can be used on animated or static geometry in exactly the same way.

My advice would be to run python on the command line, load the model and then use the .ls() command to view the hierarchy - that way you will be able to see what is happening.

An additional note is that if you optimise the model in any way - either a call to a flatten method or running egg-optchar, the group could be optimised away and no longer exist.

Animated models have all parts optimized away by default, but you can preserve them with the -flag option to egg-optchar.

David

Yes, the egg-optchar is the answer. If the model is animated (ie. has an Armature) then it will be combined within the Armature node.

In order for the geometry in question to be separated from the Armature node, it must be flagged using egg-optchar.

Thank you for the help.