Terrain seems OK now. I've deleted the diffuse component of the terrain object (why did you add that?).
I replaced this line
convert object FVF obj, 0x002 || 0x010 || 0x040 || 0x200
with this
convert object FVF obj, 0x002 || 0x010 || 0x200 ` diffuse removed
See attached screenshot.
I'll look at the problems with the sky and the foreground later. (I suspect the foreground problem is a result of the camera position - not sure till I check).
Edit
Just tested the sky object on its own without a shader and it seems as if (1) it is upside down and (2) the "sky" and "ground" images (i.e. "6.bmp" and "5.bmp") have been swapped. Also, its UV coords are rather strange - the negative values in the X file have been clamped to 0 by the shader. I've tried using your sky images (converted to *.png files) with the "skybox2.x" model from my demo (I think that came from the DBPro Advanced Terrain Example1 demo - but I've probably fiddled with it) and things look much better. I also raised the camera position and tweaked a few other things. I've marked the important changes. Screenshot in next post. There are still some problems with the terrain - there are black holes in it. Here's the code I used:
set display mode 1280,1024,32
sync on ` GG addition
sync rate 0
autocam off ` GG addition
position camera 0, 200, 0 ` GG addition
set spot light 0,0,90
position light 0,10000,1000,-10000
point light 0,-10000,0,10000
set light range 0,1000000000
set normalization on
set camera range .1,7000000000
color backdrop 0
null = make vector4(1)
null = make vector4(2)
gosub prepareShaders
rem load landscape
#constant LANDSCAPE = 1
load image "texture.tga",1
load image "detail.jpg",2
load image "average fog.png",3
load image "magic clouds.png",4
load object "map.x",LANDSCAPE+1
make mesh from object 100,LANDSCAPE+1
delete object LANDSCAPE+1
make object LANDSCAPE,100,1
scale object LANDSCAPE,100000,100000,100000
set object smoothing LANDSCAPE,100
set object specular LANDSCAPE,0
set object texture LANDSCAPE,0,2
set object ambient 1,1
set object light 1,1
detail_Terrain(LANDSCAPE,2,40)
texture object LANDSCAPE, 2, 3
texture object LANDSCAPE, 3, 4
set object effect LANDSCAPE, 2
#constant OBJ_SKY = 5
` load object "partlycloudy\cielo.x",OBJ_SKY
load object "partlycloudy\skybox2.x",OBJ_SKY
` set object light OBJ_SKY, 0
` set object texture OBJ_SKY, 2, 1
scale object OBJ_SKY,16000,16000,16000
position object OBJ_SKY,0,0,0
set object effect OBJ_SKY, 4
texture object OBJ_SKY, 1, 3
texture object OBJ_SKY, 2, 4
do
set cursor 0,0
print "FPS: ";screen fps()
print "Use the arrow keys. :D"
control camera using arrowkeys 0,1,1
sync
loop
prepareShaders:
set vector4 2, 0.5, 0.5, 0.5, 1.0 ` fog colour
` load shader for standard bump mapped objects
load effect "GG Misty Smoky Fog V3.fx", 1, 0
set effect technique 1, "fogBump"
set effect constant vector 1, "fogColour", 2
` load second shader for use with Advanced Terrain object
load effect "GG Misty Smoky Fog For AT V3.fx", 2, 0
set effect technique 2, "fogDiffuse"
set effect constant vector 2, "fogColour", 2
` load third shader for use with sea
load effect "GG Misty Smoky Fog V3.fx", 3, 0
set effect technique 3, "fogDiffuse"
set effect constant vector 3, "fogColour", 2
` load fourth shader for use with sky object
load effect "GG Misty Smoky Fog V3.fx", 4, 0
set effect technique 4, "fogSky"
set vector4 1, 0.8, 0.8, 0.8, 1.0
set effect constant vector 4, "ambiColor", 1
set effect constant float 4, "skyDist", 1000.0
set effect constant vector 4, "fogColour", 2
fogMaxHeight# = 200.0
fogMinHeight# = 0.0
fogScale# = 0.004
fogIntensity# = 0.5
noiseMix# = 0.5
fogBaseScrollX# = 0.0001
fogBaseScrollY# = 0.0001
fogTotalScrollX# = 0.0
fogTotalScrollY# = 0.0
for e = 1 to 4
if (e <> 3)
set effect constant float e, "fogMaxHeight", fogMaxHeight#
set effect constant float e, "fogMinHeight", fogMinHeight#
set effect constant float e, "fogScale", fogScale#
set effect constant float e, "fogIntensity", fogIntensity#
set vector4 1, fogTotalScrollX# + camAngleY#/90.0,fogTotalScrollY# + camAngleX#/90.0, 0.0, 0.0
set effect constant vector e, "fogNoiseScroll", 1
set effect constant float e, "noiseMix", noiseMix#
endif
next e
return
function detail_Terrain(obj,img,scale)
` set blend mapping on obj, 1, img, 11, 6 ` GG deletion
` convert object FVF obj, 0x002 || 0x010 || 0x040 || 0x200
convert object FVF obj, 0x002 || 0x010 || 0x200 ` diffuse removed
lock vertexdata for limb obj, 0
for i = 1 to get vertexdata vertex count()
set vertexdata UV i , 1, get vertexdata U( i, 0 ) * scale, get vertexdata V( i, 0 ) * scale
next
unlock vertexdata
endfunction