I created an function to generate such alpha map... maybe can help you.
Sub GenerateWaterMask(waterstart As TV_2DVECTOR, waterend As TV_2DVECTOR, masksize As Long, altitude As Single, FileName As String)
Dim SizeX As Long
Dim SizeY As Long
Dim i As Long
Dim cur As Long
Dim X As Long
Dim y As Long
Dim transws As TV_2DVECTOR
Dim transwe As TV_2DVECTOR
Dim CurAlt As Single
Dim Color As Long
Dim Stage As Single
Dim MaxDeep As Single
Dim LandData() As Single
Dim TexData() As Long
Dim MinStage As Single
Dim TX As Long, TY As Long
MinStage = 0.4
MaxDeep = 10
'10 = 255
'0 = 0
cur = 0
transws.X = 0
transws.y = 0
transwe.X = waterend.X - waterstart.X
transwe.y = waterend.y - waterstart.y
SizeX = waterend.X - waterstart.X
SizeY = waterend.y - waterstart.y
If masksize = 0 Then masksize = CLng(SizeX * 0.25)
If masksize > 1024 Then masksize = 1024
For X = waterstart.X To waterend.X
For y = waterstart.y To waterend.y
cur = cur + 1
CurAlt = TVL.GetHeight(X, y)
If CurAlt < altitude Then
If (altitude - CurAlt) > MaxDeep Then
MaxDeep = (MaxDeep + (altitude - CurAlt)) / 2
End If
End If
Next
Next
cur = 0
i = TVT.CreateTexture(masksize, masksize)
TVT.LockTexture i
For X = waterstart.X To waterend.X
For y = waterstart.y To waterend.y
cur = cur + 1
CurAlt = TVL.GetHeight(X, y)
If X >= 0 And y >= 0 Then
If X <= WORLD.WorldSize And y <= WORLD.WorldSize Then
If CurAlt > altitude Then
Color = RGBA(MinStage, MinStage, MinStage, 1)
Else
If (altitude - CurAlt) > MaxDeep Then
Color = RGBA(1, 1, 1, 1)
Else
Stage = (((altitude - CurAlt) / MaxDeep) * (1 - MinStage)) + MinStage
If Stage < MinStage Then Stage = MinStage
Color = RGBA(Stage, Stage, Stage, 1)
End If
End If
Else
Color = RGBA(1, 1, 1, 1)
End If
Else
Color = RGBA(1, 1, 1, 1)
End If
TX = ((X - waterstart.X) / (transwe.X - transws.X)) * masksize
TY = ((y - waterstart.y) / (transwe.y - transws.y)) * masksize
If TX < masksize And TY < masksize Then TVT.SetPixel i, TX, TY, Color
Next
Next
TVT.UnlockTexture i
TVT.SaveTexture i, FileName, TV_IMAGE_DXT1
TVT.DeleteTexture i
End Sub
TVT is the object of TVTextureFactory.
TVL is the object of TVLandscape.
The parameters:
waterstart = X and Y where your water plane start
waterend = X and Y where your water plane ends
masksize = The texture size (max size = 1024 x 1024)
altitude = The altitude of your water plane
FileName = The texture filename (DDS)