I've got a problem using darklights on an advanced terrain object.
I mix some sample code (the terrain demo) and the quality demo coming from the darklights addon and the result is a completely black surface
I've tried to save the terrain generated with the save object statement and then load the file but with the same result.
You can fine the complete code and a picture with the result; one with the advanced terrain surface non included in the LM Objects (on the left) and the other one with the LM on the terrain !
Where is my fault ?
rem set the light map quality here,
Quality# = 1.0
rem render setup
sync on
sync rate 0
set camera range 1,1000
randomize timer()
autocam off
color backdrop 0
set normalization on
set text font "Verdana" : set text size 14
LM Start
rem load base and detail texture
load image "terrain-texture.jpg", 1
load image "terrain-detailmap.tga", 2
make object terrain 1
set terrain heightmap 1, "terrain-heightmap.bmp"
set terrain scale 1, 3, 0.6, 3
set terrain split 1, 16
set terrain tiling 1, 4
set terrain light 1, 1, -0.25, 0, 1, 1, 0.78, 0.5
set terrain texture 1, 1, 2
build terrain 1
rem make sphere to cast a shadow onto it
make object sphere 2,10
make object cube 3,10
make object cone 4,10
position object 2,100,get terrain ground height(1,100,90)+5,90
position object 3,110,get terrain ground height(1,110,110)+5,110
position object 4,90,get terrain ground height(1,90,100)+5,100
rem add level as collision objects to cast shadows
LM Add Collision Object 1
LM Add Collision Object 2
LM Add Collision Object 3
LM Add Collision Object 4
LM Build collision Data
rem add level as a light map object to receive lightmaps
LM Add Light Map Object 1
LM Add Light Map Object 2
LM Add Light Map Object 3
LM Add Light Map Object 4
LM Add Point Light 130,get terrain ground height(1,130,80)+40,80,300,1.0,0.6,0.7
make object sphere 101,1
position object 101,130,get terrain ground height(1,130,80)+40,80
LM Add Point Light 80,get terrain ground height(1,80,150)+40,150,300,0.4,0.9,0.6
make object sphere 102,1
position object 102,80,get terrain ground height(1,80,150)+40,150
LM Add Point Light 70,get terrain ground height(1,70,70)+40,70,300,1.0,1.0,0.6
make object sphere 103,1
position object 103,70,get terrain ground height(1,70,70)+40,70
rem start the light mapping thread
starttimer=timer()
LM Build Light Maps Thread 1024,Quality#,1
load dll "Kernel32.dll",1
sync off
rem get current status and display whilst running
while LM Get Complete()=0
rem make DBPro wait before trying again
call dll 1,"Sleep",100
cls
set cursor 0,0
print LM Get Status( );" ";int(LM Get Percent());"%"
endwhile
sync on
endtimer = timer()
rem light mapping complete remove all collision and light map objects and lights.
LM Reset
rem position camera and reset mouse movement
position camera 130,get terrain ground height(1,130,130)+20,130
point camera 0,0,0
null = mousemovex()
null = mousemovey()
do
if ( keystate(59)=1 and f1Timer<timer() )
f1Timer = timer()+300
F1Pressed=1-F1Pressed
endif
rem display the build time
set cursor 0,0
if F1Pressed=0
center text screen width()/2.0,20,"-- Press F1 For Help --"
else
print "Use Arrows Keys to Move, Hold Shift For Slower Movement"
print
print "FPS: ";screen fps()
print "Quality: ";Quality#
print "Build Time: ";(endtimer - starttimer)/1000.0;"s"
endif
rem control the speed of the camera
if shiftkey()=1 then speed# = 0.2*(60.0/screen fps()) else speed#=2.0*(60.0/screen fps())
rem move and rotate the camera
angy# = camera angle y()
angx# = camera angle x()
if upkey()=1 then move camera speed#
if downkey()=1 then move camera -speed#
xrotate camera 0
if leftkey()=1 then yrotate camera angy#-90 : move camera speed# : yrotate camera angy#
if rightkey()=1 then yrotate camera angy#+90 : move camera speed# : yrotate camera angy#
yrotate camera angy#+mousemovex()/3.0
xrotate camera angx#+mousemovey()/3.0
sync
loop
end