This is the code I use to make the terrain:
rem crea isola
make object terrain 2
set terrain heightmap 2, "TextureExtract\TerrenoIsolaZombie.bmp"
set terrain scale 2,80,5,80
set terrain split 2, 4
set terrain tiling 2, 4
build terrain 2
position object 2,0,-100,0
calculate object bounds 2
width#=object size x(2): depth#=object size z(2)
texture object 2,0,126
texture object 2,1,159
texture object 2,2,106
texture object 2,3,255
texture object 2,4,137
texture object 2,5,160
texture object 2,6,135
texture object 2,7,256
scale object texture 2,10,10
` ** fiddle with Advanced Terrain structure
` next two lines seem to be necessary
convert object fvf 2, 530 ` XYZ+NORMAL+TEX2
set object normals 2 ` this method gives visible seams
contrast# = 4.0
vertScale# = 2.0/object size y(2,1)
set effect constant float 10, "contrast", contrast#
set effect constant float 10, "vertScale", vertScale#
set vector4 11, 8, 8, 0, 0
set effect constant vector 10, "UVTiling", 11
set object effect 2,10
Sx = -10000 : Sy = 9000 : Sz = 16000
Wx = 0 : Wy = 0 : Wz = 0
rem null = make vector4(11)
` the next line creates a vector pointing in the desired light direction
set vector4 11, Wx - Sx, Wy - Sy, Wz - Sz, 0.0 ` final entry must be zero here although shader doesn't use it
` the next line normalizes the vector so it is a valid direction vector (might not be essential if shader normalizes it anyway)
normalize vector4 11, 11
set effect constant vector 10, "lightDir", 11
set effect technique 10, "t1"
also, even if is off topic, I have requested in another post how to add fog in a shader (the evolved normal map exactly), do you know how to do that GG?
I know that his Relief Map shader use it and having the fog it makes objects on distance look smoother, I wish to have the fog on the normal map shader as well