Improving the terrain texture blending
by Lukas Joergensen · in Torque 3D Professional · 07/20/2013 (12:10 pm) · 63 replies
Hey guys, I looked into this myself but it seems the terrain texture uses procedural shaders for blending textures and thats wayy too complex for me atm so I thought I would post it here and hope that someone have a better understanding of the procedural shader system and might be able to implement this.
I read this article on Gamasutra and found it very interesting.
It goes through a set of algorithms to go from this kind of blending which is the one it seems T3D has:

To this much more accurate and natural blending:

(All images is from the article linked above)
Using this algorithm that seems simple enough:
This seems like something that could improve the terrain detail of T3D alot, so whats your thoughts? Would this be possible to do? And it would be awesome if anyone had a good enough understanding of the shader system to actually implement this.
Lastly what do you think about having to have a depth map? obviously it would be best if that could be omitted if desired, using a default depthmap or just a grayscale image.
I read this article on Gamasutra and found it very interesting.
It goes through a set of algorithms to go from this kind of blending which is the one it seems T3D has:

To this much more accurate and natural blending:

(All images is from the article linked above)
Using this algorithm that seems simple enough:
float3 blend(float4 texture1, float a1, float4 texture2, float a2)
{
float depth = 0.2;
float ma = max(texture1.a + a1, texture2.a + a2) - depth;
float b1 = max(texture1.a + a1 - ma, 0);
float b2 = max(texture2.a + a2 - ma, 0);
return (texture1.rgb * b1 + texture2.rgb * b2) / (b1 + b2);
}Where a1 and a2 is the opacity of the respectively texture1 and texture2 and the alpha channel of texture1 and texture2 is a depth map.This seems like something that could improve the terrain detail of T3D alot, so whats your thoughts? Would this be possible to do? And it would be awesome if anyone had a good enough understanding of the shader system to actually implement this.
Lastly what do you think about having to have a depth map? obviously it would be best if that could be omitted if desired, using a default depthmap or just a grayscale image.
About the author
IPS Bundle available at: https://www.winterleafentertainment.com/Products/IPS.aspx
#62
06/25/2014 (3:55 pm)
Nice work Lukas, this will be a welcome addition when you are finished.
#63
But good job with it Lukas. :) Glad you had better sight on the matter than I did and actually released it. lol
06/26/2014 (2:56 pm)
Huh.. I had no idea this would've been so sought after, apologize community.. hahah. I actually already did this very same thing myself a few years ago. I didn't need the effect though so I just trashed the code. It was really just an experiment. Didn't think anyone else would've even wanted it. Ooops..But good job with it Lukas. :) Glad you had better sight on the matter than I did and actually released it. lol
Torque Owner Lukas Joergensen
WinterLeaf Entertainment
Can you see how the sand fills the cracks in the stone?