The shader somehow mixes the image properties as you see in the difference of the two images.
[/quote]
I honestly don’t know what you mean by this. I look at the images, but I really don’t see what your problem is. Additionally, I assumed one of the images was made using your Method 1 (which uses DiffAlpha) so I’m not really sure what your problem with TerrainBlend is. (I haven’t yet played with the tri-planar stuff so I can’t comment on whatever issues you might have there.)
[quote]
Additionally, my terrain is produced literally on the fly so I have to create a system to convert BW heightmap, slope, and normal data plus thresholds to produce a RGB usable for TerraBlend. My other options is to grid the terrain then texture splat it but I will also have to use the heightmap, slope, and normal data plus thresholds.
It would be awesome to have the on the fly full procedural creation although with xml export and import.[/quote]
Well, if you really insist on having your terrain blending be determined by elevation then you can do something like this:
s=heightmap:GetPixel(x,y).r
dirt=Color(1,0,0,0)
grass=Color(0,1,0,0)
stone=Color(0,0,1,0)
cliff=Color(0,0,0,1)
if(s<0.5) then
blendcolor=dirt:Lerp(grass, s/0.5)
else
blendcolor=grass:Lerp(stone, (s-0.5)/0.5)
end
blend:SetPixel(x,y,blendcolor)
This performs a straight linear interpolation between dirt and grass below 0.5, and grass and stone above 0.5. Similar operations can be performed for your other operations. For instance, you can take the terrain normal at the point and dot it against vector3(0,1,0), and use the resulting value as the interpolant between blendcolor and cliff. (Note that this demonstrates a tiny limitation of the current TerrainBlend shader, which doesn’t use the alpha component of the blend texture for a fourth detail layer. This is a very minor change, however. I could post the hlsl and xml code to change it to 4 detail layers if you wish.).
By using the TerrainBlend shader, each of the blend layers can be controlled in relative isolation from the other layers, giving you fuller control over terrain placement.
If you would like I can write a demonstration program for you to show you how it works.