setMaterial() -only 1 material possible for node?

I used to make materials in Blender, and then I could have more than 1 material on 1 mesh, by selecting the vertices I wanted and assigning them to the material I wanted.
Now Im working with “proceduraly generated” models, and I see that assigning a material is done by setMaterial(), but I dont see any way of assigning more than one material to a nodepath, like i could with making and assigning the materials in Blender.

Try this… get a reference to an underlying GeomNode and…

geomnode = ???
mymat = Material()

… set up the material properties

geomnode.setAttrib(MaterialAttrib.make(mymat))

If that works you would just need to have a separate GeomNode for each material you want.

Go ahead and create a different NodePath for each material. If you want to have only one node at the end, just use flattenStrong() to collapse them together.

This is essentially what the egg loader is doing automatically.

David

Hm, what about vertex doubles?

You can’t render a single vertex with two different materials. If you have two different materials that share a vertex, the egg loader has to replicate the vertex anyway. And so will you if you create the geometry by hand.

David

That means the egg loader also recalculates normals, right?
I guess this means i will have to recalculate normals myself?

Right.