Hexagon mapping with Vertex Group as Mask

Hello everyone,

I’m hoping someone can help me with something I’m trying to do with a shader.

First, some credit where credit is due.

I’m using a node group for Hexagon mapping provided by Robin Betts from this Blender Stack Exchange post, which I was referred to by somoene on the Blender Community Discord:

The node group provides these outputs:

On to the good stuff:

I have a default cube, each face subdivided 5x, for extra geometry. The center edge-loop is added to a Vertex Group named “Panel Edges”, which is exported via Geometry Nodes, to be addressed by the shader:

The shader is able to increase or decrease the density of darkened hexagons in the pattern by way of adjusting the Color output through a Color Ramp. The Hex Mapping node group provides several outputs, such as Center Distance, Edge Distance, Radial Angle, and Position.

I want to use the Vertex Group data (Pink) to influence the area in which either white or dark hexagons appear, based on the Center of each hexagon, so that the produced pattern is jagged, and formed from the shapes of the hexagon tiles themselves, rather than being cut off by the mask (as they are currently).

The end goal:
This will be used as a sci-fi “heat tiles” shader, reminiscent of the heat tiles on the bottom of the Space Shuttle. Notice in this shot that the newest tiles are the ones which are closest to the panel cuts (landing gear covers, edges of wings, etc etc.

EDIT: I forgot, here’s a screenshot of how far I’ve gotten on my own with the shader I want to make. You can see that the vertex group mask cuts some of the cells in half. What I want to do is make sure that any cell which intersects the vertex group data is whole, rather than being clipped at the edges.

My problem is:
I have no idea what I’m doing, and I don’t know where to start, to be able to make this pattern be influenced by the Vertex Group.

Can anyone point me in the right direction? Thanks in advance for your help!

In this situation, using vertex groups directly won’t be of much use. Even VertexColors aren’t appropriate for this effect as you cannot get their value from a custom coordinate…

The best option is to have a low resolution image, in the same texture space of your hexagon shader (UV), and use the position output of that shader as the vector for the image.

As a pre-step, you can bake a VertexColor layer into an lowres image, or do some painting by hand.
(trying to bake a VertexGroup is not fully supported atm, and it would require that you use a bit of python for passing values from the VertexGroup.Weight into an VertexColor)


To make sure I understand you correctly:

You are advocating to have a small Texture with an alpha channel, in which the opaque area is a hexagon shape, and then to attempt to tile that based on the Position output of the Hex Node?

I must be missing something, because in my mind’s-eye that just produces another hexagon pattern which is not influenecd by the Vertex Group. :thinking:

Afaik, you can’t access a VertexGroup directly in the shader (maybe in a near future). But a VertexColor layer is of no use also, unless you bake it into an image texture.
This is because you can peek a color from an image at any coordinate, but you can’t do it with a VertexColor.

Here’s a simple example how whould that work:

(in this example, I’m using a voronoi, but the hexagonShader does the same!)

I see - so you’re proposing I use the image texture to define where the panel cuts are, rather than the vertex group?

I get what you’re saying, but I also think that this should be possible the way I am doing it, because the Vertex Group vector output just produces RGB data the same way a texture map would, in this case.

You can see the output here - as this is just RGB data, I effectively already have the image map you’re talking about.

I have been fucking around with these nodes for the last bit, and I think I am on to something - but I just don’t know enough about the back-end of how this stuff works to make it effective.

It’s like…50% the way there. You can see some of the cells on the edges are intact.

I did this by feeding the normalized Vector output from the Attribute node into the Factor of the math nodes, but it’s not 100% perfect.

If you can plug a vector input so you get the color from another coordinate that’s not the coordinate of the sample being render, than you’re clear to go!
But… The AttributeNode doesn’t have any input for a coordinate vector. And that’s the road block on your reasoning!




Is there any way I can use Edge Crease / Sharp Edges to influence this?

The same problem happens with EdgeCrease/SharpEdges (or whatever information that cannot be referenced from another sample).

Imagine just one Hexagon… You want the color (or whatever) to be defined by the information that is present in the center of the hexagon, to be applied to the whole area of the hexagon!
You need to be able to get that information (on the center point) from all points in the surface of the hexagon, even if the information at those points is something else.

If you cannot access that information from anywhere else, then there’s not much you can do.

Using an image Texture allows you to do this, because you can access any pixel you want from that texture by just plugging a different coordinate vector. But geometry attributes cannot be accessed in the same way.

Of course, if you bake whatever attribute you want into a texture, it will be fairly easy to do this.

1 Like

I’m trying that approach right now, but I’m running into the problem that I don’t know what I’m doing.

I selected the faces I want as the mask, and then painted them with an easy to see color.

I saved that texture map and am now using that in the way you outlined above, but it seems… not lining up properly?

Can you try to replace the HexagonNode with a 2D VoronoiNode just for testing?

I don’t know what exactly is the output of the ‘Position’ socket of that NodeGroup… If it’s outputting the coordinate of the Hexagons’ centers in the same CoordinateSpace used as input vector, it whould work without a problem.

edit: and also, are you using multiple UVmaps? (if so you need to use the same UVmap in the baked texture and the Hexagon)

Hmm, this seems to produce no result? :thinking:

I’ve gotta have something screwed up in the mapping somehow? :thinking:

EDIT: It’s only one UV map

It looks that some hexagons are there…

Which makes me believe that most of the Hexagons’ centers are ‘falling’ outside your ‘white areas’ in your texture, and being colored by the ‘black areas’… (maybe they are too thin?!?)

Can you confirm it?

I’m not really sure.

I’ve created a second specific UV map for only these panel edges, which have been selected.

“Panel Edges UV Map” You can see that this is also aligning with the texture paint I made using those faces as the mask.

Oops I had to adjust the scale on that Voronoi texture.

So the result ends up being something weird with this hex mapping about the position it’s supplying?

Ah ha - a different node group makes the pattern.

If that’s what it looks like with the HexagonShader, then its ‘Position’ output must be wrong somehow…
Where did you get that nodegroup?

edit: AhhAh!! There’s the culprit! :slight_smile:

1 Like

Yeahhh…I just gotta adjust my workflow and the node groups I’m using.

Thank you!

Figured it out - I needed an additional Mapping node

It fuckin’ works!

Thank you @Secrop!

1 Like