+1 vote

I'm trying to separate a given hexagonal tile into 18 congruent kite/deltoid shaped polygons (split the hex into sixths along each radius to outer vertex, and then each sub-triangle again into congruent thirds)
So imagine 6 sets of this triangle, arranged in a hexagon (I've highlighted the vertices): If I know the precise location of each vertex (they can be calculated based on any hexagon of a given radius via known ratios), how would I go about creating a mesh with unique materials for each of the polygonal triangle components?

My current debug script (pastebin) produces this (I apologize for the names of the points in advance): when I expected an equilateral triangle composed of 3 congruent polygons with different materials (that differ only in their `albedo_color`), essentially matching the prior example image.

I've checked some of the other questions on here about creating meshes at runtime and they haven't made it clearer for me. I think my issue is in misunderstanding either/both:
a) the way meshes are constructed out of primitives
b) the way SurfaceTool applies colors to meshes, specifically how `commit()` overwrites surfaces that have already been committed (the green in my output screenshot is the final color I try to assign to a polygon, I tried 3 others before it in the program flow)

EDIT: as an addendum, I know the Vector3 values I've provided for the points are accurate since I constructed an example mesh in Blender and transferred the coordinate values (and determined the ratios, which will always be correct) from there.

in Engine

I tried constructing a simpler version of the problem: 2 congruent right angle triangles, which together make a square, one blue, one red. Here is the code: https://pastebin.com/pdj7DE1W

This just constructs a single red triangle, in the opposite position I would expect. I've tried messing with the surface tool, trying 1 instead of 2, etc and I'm still stumped.

EDIT: Point order matters, clearly. I modified the order in which some of them are added
to the surface tool and I got a full blue square now. 