Multiple labels on polygons

Hey there,
I’m searching for an idea to label the polygons of my mesh with different multiple labels.
So far I’m using vertex groups, putting all the vertices belonging to polygons that share a label into one vertex group.

But storing that information in vertices is not bidirectional, because as you can see in this Image, all 3 vertices got the information they belong to the yellow and the blue label and in the end the mid polygon is blue and yellow instead of only blue.

Can this be achieved with materials? Afaik there is only one material_index per polygon.
Is it possible to store more than one material to a polygon? (I don’t care which one is displayed as long as I can read it via python)

you can have up to 256 material per object!

so just assign faces to one material !


Yeah I know that, but I asked for multiple materials on one face/polygon, not one object!

for material i don’t think it is possible
one material is assign per face but you can have more then one texture
color might be control with texture on the face!

but there is the vertex color
let say for one face each vertex on the face can be assign a vert color

unless you use UV map and change the UV map for each face!


there are not only shared vertices, but per-face “vertices” = loops. UVs, vertex colors etc. are stored per loop.

I’ll have a try saving the label information in an uv layer.
It seems to be a float array with 2 items, so each item should hold 64bit => I can store 128bit in each loop.


Maybe polygon_layers. Haven’t used these myself, the following produces a string layer with a value for every poly in the mesh. The layers are saved with the file. I’m “assuming” that the indexes match those of the polygons in the mesh.

An int ( as boolean) layer for each material would be one way to utilise polygon layers to store multiple material indexes per poly.

>> mesh =
>>> mesh.polygon
>>> stringlayer ="PolyCode")
>>>[0].value = b'ABCD'

Yep, the polygon_layer is working nice, since my labels are strings I just write them all in the string layer.
Sadly there’s no vertex_layers, would love to see that added.
Thanks a lot.

thsi seems to be a new feature for Bmesh
can you give a working example for this the polygon_layer

can someone elaborate a little on what it does

what these vars do or contains is it an image or what datas?



Its just a list with the same length as the polygon count in the mesh.
Every list item is associated with a polygon.
So you can store strings, ints or floats to every polygon.

Thats how I’m using it, reduced to an example.

def create_triangle_layer(context):
        #save triangle index in the polygon_layers_int
        me = context.selected_objects[0]"triangle")
        for idx,poly in enumerate(
  ["triangle"].data[idx].value = idx