LWJGL - Fade Textures into eachother

Hello there, I’m new to this forum (But not too much to LWJGL ;)) and I was looking for a way to fade 2 textures into eachother. But no time based fade, more like a Quad, that has the one texture on the one side, and the other texture on the other side, and fades between those two. I tried using 2 quads that faded into nothing, but that made the other one that faded the other texture in the other direction disappear. I haven’t found any other way, and don’t find anything on the webs. Any ideas?
Thanks for your time.

I would be very interested in something like this, too!

Cheers :smiley:

Well, I found a way by displacing the second quad just a tiny bit, that of course is a really dirty method, but seems to be the only way.

without shaders:
render a quad two times. The first one should be rendered just as always. but the second one is a bit more tricky, the quad needs vertex color attributes, where on one side it has an alpha of 1 and on the other 0. then you have to render the second quad with depth-testing to equal and alpha-blending enabled.

with shaders:
everything is easier^^. just create a shader who reads 2 textures and blend them together depending on a vertex attribute.

some simple blending I did some time ago, based on the idea found in this blog post http://www.m4x0r.com/blog/2010/05/blending-terrain-textures/

https://lh4.googleusercontent.com/516uxvzxU0xLQpCAQ-M2IsdiFW-WFQc3hbd63i0sfVeVxFoYvCsgjei6rg0gL586BS_z9pQFkcNkn9pig_GWcNqXnld9vg-AxAXr51B194RLdAO0v1wKbLinWA

Thanks! I was missing the glDepthFunc(GL_EQUAL) call! Thank you really much :smiley:

Using shaders is very simple and much more flexible. Full code here.

Textures:

Mask: (alpha)

Result: