Seamless gradient between different textures in the same material.

Hey!

I’m trying to create a seamless gradient between multiple different textures, inside the same material.

I want to have a seamless transition between multiple rock textures.

This is an example I’ve made, but it doesn’t have the best results as far as tansition between the textures themselves, because they are mixing together, yes… but not in a linear fashion… like from A to B… I want A to be 100% texture 1 and B, 100% texture 2… And the in between to be a gradual and seamless transition from one to another.

I would also like to have more than 2 texture doing the gradient, at least 6 rock textures to gradually transition one to another, if possible.

If anyone has any tips, I would really appreciate.
Thanks for your time!

1 Like

Not sure if I understand correctly what you are trying to achieve, but you are lerping with a fixed alpha of 0.5. Are you maybe looking for a linear gradient (WTF Is? Material: Linear Gradient in Unreal Engine 4 ( UE4 ) - YouTube) that you connect to your alpha instead?

1 Like

Hey! Thanks for the quick reply!

This is what I was missing completly…

Made just that, and the results are exactly what I wanted to achieve.

Dude, I was facepalming for 30 min because of this…

Anyhow… This is exactly what I needed, thanks so much for your time!

As shown previously, I was able to successfully make a gradient between 2 textures.

What about 8 textures?

I would like to have 8 textures with gradients in between each other.

I set it up like this:

But an issue occurs when I basically “fuse” the multiple gradients… Because, he mixes the in-between gradients, on top of each other, and it’s not exactly what it’s intended.

This is how it looks in a smaller scale so that it fits the screen:

In a longer mesh, you can actually still see some of the rock layers, almost at the bottom of the mesh, on top of multiple diferent textures…

What I would like is to only have gradient between each texture transition into another, more like this:

  • The white gradients between the colored layers are exactly how and were I’m picturing the gradients separating textures in the material.

Hope its clear enough, hit me up for any more info.
Thanks everyone for your time!


Code
if (z < 0.2) return lerp(a, b, z * 5);
if (z < 0.4) return lerp(b, c, (z-0.2) * 5);
if (z < 0.6) return lerp(c, d, (z-0.4) * 5);
return d;

You get the idea.

1 Like

Thank you!!!
That is extremely helpful!

I’ll apply it on my project as soon as possible.

Thanks for your time, you rock!

if (z < 0.125) return lerp(a, b, (z-0.000) * 8);
if (z < 0.250) return lerp(b, c, (z-0.125) * 8);
if (z < 0.375) return lerp(c, d, (z-0.250) * 8);
if (z < 0.500) return lerp(d, e, (z-0.375) * 8);
if (z < 0.625) return lerp(e, f, (z-0.500) * 8);
if (z < 0.750) return lerp(f, g, (z-0.625) * 8);
if (z < 0.875) return lerp(g, h, (z-0.750) * 8);
return h;

2 Likes

You’re a genious!
Thanks so much!!!

This is it!
You’re the best.