Ok. I resolved the lighting issue with the other objects, but the problem with BT still exists.
The X and Z coordinates of the lighting are flipped.
Here's a quick code snippet to show the problem. Watch how things light up just ahead of the light, but on the wrong side of the hills.
//Setup
set display mode desktop width(), desktop height(), 32, 0
set window off
sync on : sync rate 0 : sync
center text screen width()/2,screen height()/2,"Loading..." : sync : cls
set camera range 0, 0.1, 100000
//Load media
global g_HeightmapImgID : global g_TextureImgID : global g_DetailmapImgID
g_HeightmapImgID=1 : g_TextureImgID=2 : g_DetailmapImgID=3
load image "..\Media\heightmap.bmp",g_HeightmapImgID
load image "..\Media\texture.jpg",g_TextureImgID
load image "..\Media\detail.tga",g_DetailmapImgID
//Create terrain
//Make the terrain
global g_TerrainID
g_TerrainID=BT MakeTerrain()
//Set images
BT SetTerrainHeightmap g_TerrainID,g_HeightmapImgID
BT SetTerrainTexture g_TerrainID,g_TextureImgID
BT SetTerrainDetail g_TerrainID,g_DetailmapImgID
//Set some other values
BT SetTerrainScale g_TerrainID,12.0
BT SetTerrainYScale g_TerrainID,2.0
BT SetTerrainSplit g_TerrainID,8
BT SetTerrainDetailTile g_TerrainID,3.0
BT SetTerrainLOD g_TerrainID, 3
BT SetTerrainLODDistance g_TerrainID, 1, 4000.0
BT SetTerrainLODDistance g_TerrainID, 2, 8000.0
BT SetTerrainSmoothing g_TerrainID, 1
BT SetTerrainQuadRotation g_TerrainID, 1
//Build
global g_TerrainObjectID
g_TerrainObjectID=1
//This command processes the heightmap and creates all the internal structures for the terrain
BT BuildTerrain g_TerrainID,g_TerrainObjectID
//This command sets the number of sectors get created every call to 'BT ContinueBuild'.
//As we dont need a loading bar, I set this to 0 which makes it create the whole terrain at once
BT SetBuildStep 0
repeat
//This command generates the sectors. It returns the percentage of how much of the terrain it has generated.
//When it has generated the whole terrain it will return -1
progress=BT ContinueBuild()
until progress=-1
//Setup camera
set camera range 1, 100000
position camera 0 -1300, 3400, 1400
point camera 0, 1000, 0, 1000
hide mouse
//Main loop
make object sphere 1000, 100
set object light 1000, 0
set point light 0, 0, 500, 0
set light range 0, 20000
StartTime=timer()
do
// Light Movement
a# = wrapvalue(a# + 0.05)
position light 0, 1500 + (sin(a#) * 1000), 1000, 1500 + (cos(a#) * 1000)
position object 1000, light position x(0), light position y(0), light position z(0)
//Camera movement
Elapsedtime#=(timer()-StartTime)/3000.0+Elapsedtime#*0.7
StartTime=timer()
cx#=camera angle x()+mousemovey()/4.0
if cx#>90.0 then cx#=90.0
if cx#<-90.0 then cx#=-90.0
rotate camera cx#,camera angle y()+mousemovex()/4.0,0.0
if upkey() then move camera 1000.0*Elapsedtime#
if downkey() then move camera -1000.0*Elapsedtime#
` gheight#=BT GetGroundHeight(g_TerrainID,camera position x(),camera position z())
` if camera position y()-40<gheight# then position camera camera position x(),gheight#+40,camera position z()
//Wireframe
if keystate(59) then set object wireframe g_TerrainObjectID,1
if keystate(60) then set object wireframe g_TerrainObjectID,0
//Render the terrain
BT SetCurrentCamera 0 //Set current camera to 0 (if the camera has moved/rotated since this command was last called, you must call it again!)
BT UpdateTerrainCull g_TerrainID //Update frustum culling
BT RenderTerrain g_TerrainID //Render the terrain
//FPS
text 10,10,str$(screen fps())
text 10,30, "X: "+str$(camera position x(0), 2)+" Y: "+str$(camera position y(0), 2)+" Z: "+str$(camera position z(0), 2)
//Position mouse
position mouse screen width()/2,screen height()/2
//Update screen
sync
loop
If you save this as a project in the same directory as one of the BT examples it will find the needed media.