# Blending two procedural "reptile-scale" textures - at scale edges

I'm creating procedural creatures with procedural "dragon-skin" or "scales" textures (based on Voronoi texture nodes).

I want to blend multiple of these procedural textures together. However, I don't want a linear blend, instead I want the textures to end exactly where a scale of the first texture ends, so that it looks like these scales lie above the other texture.

Here's what I have so far:

As you can see, the two textures are blended (currently I use a vertex color to influence the blending and to control how the gradient flows along the body). However, instead of blending linearly within the (dragon-)scales of the texture, I want the darker scales to be fully opaque... until some threshold, at which they are fully transparent. This will lead to a "jagged" transition line (because some scales end earlier and some end later).

My idea is to replace the current gradient with a gradient-texture that gets the Voronoi's "position" vector as input. That gives me a grayscale texture where each of the scales has a different color. However, then this color does not increase/decrease in the same direction as my original gradient (i.e. the gradient will no longer be a controlled gradient across the side of the creature's body)...

Edit: This is roughly the effect I want:

Edit2: Here's an example .blend file:

Note that the gradient comes from a vertex attribute (vertex color) called "ring_pos". Visualizing this gradient gives you something like this ("ring_pos" encodes the position of the vertex within its "ring" of vertices, allowing me to have a different texture on the top than on the bottom. This is just a simple example, I want to add more complex patterns later, but in any case they should be encoding where I want one texture to show and where I want the other to show. There's no guarantee that these values will for a simple gradient later on.) When sampling (as suggested in the comments) a gradient texture with the Voronoi's position, I get something that I can use as a mask: However, this is in the wrong space, i.e. the wrong parts of the model are bright.

• You should do something with UVs. Scaling UVs in one side may help. working with textures most probably fails. Aug 4 at 20:51
• You could use the 'Position' of the Voronoi to look up the value of the gradient, and mask according to whether the looked up value passes a threshold.. it depends how your gradient is generated. Is the gradient procedural, or a UV texture? Aug 4 at 21:14
• Hello, interesting question. I think I need an additional angle to understand the mesh. Aug 4 at 21:41
• @RobinBetts Yes, that would be perfect. However, the gradient is created procedurally and stored on the mesh as vertex colors and I don't know how to combine that with the gradient texture (the voronoi and gradient is in another, arbitrary space). Even if I had UV coords, how would that help? Aug 5 at 10:58
• @Germanunkol are you using EEVEE? We need something, given P, will return the vertex color at P. Maybe via Shader to RGB? Or, would it be OK to bake the vertex color to a UV map? Aug 5 at 12:47