Problem when using Texture2DArray to blend tiles on a proceduraly generated hexagon map.

Hello everyone,

I have been replicating CatLikeConding’s tutorial on how to generate a Hexagonal procedural map on Unreal Engine. (His tutorial is for Unity).

I am having a problem when it comes to blending textures together in between hexagons as is described here : Hex Map 14

The way he does it is by having blend regions between hexagons as shown in his image:


Each pair of yellow hexagons is linked by a green rectangle with 4 vertices. Vertices 1 and 2 should be associated with the texture of the left hexagon and vertices 3 and 4 to the texture of the one to the right.

To blend the textures I need to give the Material some information, I use vertex colors (1,2 are red and 3, 4 are blue for example) as the blend factor. I then need to pass on to the material what texture should each vertex be. For this I follow what CatLikeCoding did and used UV1 and UV2 to associate a float with each vertex each corresponding to a texture (0 is sand, 2 is grass, 3 is rock etc…).

Here is the material I have tested :

But this results in an incorrect texture (if I set the tile to grass and the neighbor to sand), it seems to go through all of the textures with no gradient:


What is weird is if I replace my TexCoord[1] and TexCoord[2] by Vectors2 i get the correct blending. I checked the values passed on to UV1 and UV2 in the Construction Script and they are correct (i.e. float vectors between 0 and 5). So I have no idea where the problem lies. Would anyone have a suggestion on what to try ?

Here is the texture I am using if it is needed :

1 Like