Effect Wanted: 'Pool' of light on the ground underneath a flare, on an otherwise dark night.
Despite playing with all the light and object parameters that seem relevant, my terrain remains stubbornly unlit. Only ambient light has an effect, but across the entire terrain
Sample code below. Is there a particular sequence of commands or other factor I am missing?
set display mode 1024, 768, 32
sync on:color backdrop 0
sync rate 0
autocam off
tex1 = find free image()
load image "textureandroads.jpg" , tex1 , 0
tex2 = find free image()
load image "detail.jpg" , tex2 , 0
global grTerrain
grTerrain = find free object()
make object terrain grTerrain
Set Terrain Scale grTerrain , 100 , 10 , 100
Set terrain heightmap grTerrain , "heightmaplevelled3.bmp"
`Set terrain split grTerrain , grTerrain.iSplit
`Set terrain tiling grTerrain ,grTerrain.iDetailTiling
Set terrain light grTerrain , 10 , 10 , 10 , 1.0 , 1.0 , 1.0 , 0.0
Set terrain texture grTerrain , tex1 , tex2
build terrain grTerrain
`set object smoothing grTerrain.obj, 50
set object grTerrain ,1,0,1
NightTime=1
if NightTime=1
`hide light 0
set ambient light 50
x# = 10.0
z# = 10.0
make light 1
set point light 1 , x#+1 , GroundHeight#( x#+1 , z# )+200 , z#
position light 1 , x#+1 , GroundHeight#( x#+1 , z# )+200 , z#
set light range 1 , 1000
color light 1 , RGB(255,128,0)
make light 2
set spot light 2 , 45 , 90
position light 2 , x# , GroundHeight#( x# , z# )+200 , z#
point light 2 , x# , 0 , z#
set light range 2 , 1000
color light 2 , RGB(255,128,0)
make light 3
set directional light 3 , 0 , 0 , 0
position light 3 , x#+3 , GroundHeight#( x#+3 , z# )+200 , z#
point light 3 , x#+3 , 0 , z#
set light range 3 , 1000
color light 3 , RGB(255,128,0)
set object light grTerrain , 1
set object ambient grTerrain , 1
set object diffuse grTerrain , RGB(255,255,255)
set normalization on
Endif
set camera range 0 , 1 , 6000
do
control camera using arrowkeys 0,1,1
X# = CAMERA POSITION X()
Z# = camera position Z()
position camera 0, X# , Groundheight#(X#,Z#)+5 , Z#
update terrain
sync
loop
function GroundHeight#(p_X#, p_Z#)
`-------------------------------------------------------------------------------------------------
Result#=get terrain ground height(grTerrain, p_X#, p_Z#)
endfunction Result#
**only need one of the light effects to work, not all three simultaneously !!
Design by Trial and eror...and errror...and errorr