Hello everybody
I needs some help with the ambient light in this little project.
I just can't get the licht working.
Maybe someone can help me
` Exercise with height map with face
` Array to store height values.
dim Height_Array#(255) as float
` Get current desktop resolutions.
Desktop_Width = desktop width()
Desktop_Height = desktop height()
set display mode Desktop_Width,Desktop_Height,32
sync on
sync rate 60
` autocam off
`make camera Cam_Nr
` backdrop on `Cam_Nr
color backdrop rgb(50,50,70)
set ambient light 40
color ambient light rgb(100,100,255)
remstart
make light 100
set spot light 100,0,360
color light 100,200,100,100
position light 100,0,300,-10
point light 100,0,0,0
set light range 100,500
remend
`------------------------------------------------------------------------------
` Get height values from data blok.
restore Height_Data
for Read_Loop = 0 to 255
read Height_Array#( Read_Loop )
next Read_Loop
`------------------------------------------------------------------------------
` Build Matrix.
make matrix 1,100,100,80,80
position matrix 1,0,0,0
` Make a dummy texture.
ink rgb(100,100,200),0
box 0,0,100,100
get image 3,0,0,100,100
` prepare matrix texture 1,3,1,1
load image "Face_Test001.jpg", 2
paste image 2, 0, 0
`Scan the gray picture and build the matrix.
for X_Loop = 0 to 80
for Y_Loop = 0 to 80
Gray_Scale = rgbr( point( X_Loop, Y_Loop ) )
set matrix height 1, X_Loop, Y_Loop, Height_Array#( Gray_Scale )
next Y_Loop
next X_Loop
update matrix 1
` set matrix wireframe off 1
do
`------[ Walk and look arround. ]--------------------------------------------------
control camera using arrowkeys 0,2,2
Cam_Y# = Cam_Y# + mousemovex() * 0.3 ` Use mouse for look.
Cam_X# = Cam_X# + mousemovey() * 0.3
if Cam_X# > 90 then Cam_X# = 90 ` Down.
if Cam_X# < -90 then Cam_X# = -90 ` Up.
yrotate camera Cam_Y# ` Update camera.
xrotate camera Cam_X#
`----------------------------------------------------------------------------------
paste image 2,20,40
sync
loop
if matrix exist(1)=1 then delete matrix 1
end
` 256 height values.
Height_Data:
data -2, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1, -0.9, -0.8, -0.7, -0.6
data -0.5, -0.4, -0.3, -0.2, -0.1, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9
data 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.4, 3.5
data 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5
data 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6, 6.1, 6.2, 6.3, 6.4, 6.5
data 6.6, 6.7, 6.8, 6.9, 7, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8
data 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9, 9.1, 9.2, 9.3, 9.4, 9.5
data 9.6, 9.7, 9.8, 9.9, 10, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11
data 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12, 12.1, 12.2, 12.3, 12.4, 12.5
data 12.6, 12.7, 12.8, 12.9, 13, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14
data 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15, 15.1, 15.2, 15.3, 15.4, 15.5
data 15.6, 15.7, 15.8, 15.9, 16, 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8, 16.9, 17
data 17.1, 17.2, 17.3, 17.4, 17.5, 17.6, 17.7, 17.8, 17.9, 18, 18.1, 18.2, 18.3, 18.4, 18.5
data 18.6, 18.7, 18.8, 18.9, 19, 19.1, 19.2, 19.3, 19.4, 19.5, 19.6, 19.7, 19.8, 19.9, 20
data 20.1, 20.2, 20.3, 20.4, 20.5, 20.6, 20.7, 20.8, 20.9, 21, 21.1, 21.2, 21.3, 21.4, 21.5
data 21.6, 21.7, 21.8, 21.9, 22, 22.1, 22.2, 22.3, 22.4, 22.5, 22.6, 22.7, 22.8, 22.9, 23
data 23.1, 23.2, 23.3, 23.4, 23.5, 23.6, 23.7, 23.8, 23.9, 24, 24.1, 24.2, 24.3, 24.4, 24.5
data 24.6
I must be missing something.
I have added the picture I use for this little project.
I hope someone can help me with this
Thanks in advance.
Cheers Ron.
Programming is learning