Quote: "This make me constrained to use the "make light" command too."
No it doesn't. Light 0 is the default light and exists by default. It is initially set to a directional light but your command:
set point light 0,0,light_pos_Y#,0
changes it to a point light and sets its position.
I'm not sure what your problem is. What exactly goes wrong with your original snippet when you add a suitable
set light range value?
For a sun object you don't really need a positional light - the default directional light should be sufficient. All you need to do is set the light's direction correctly. For example, something like the following should work:
sync on : sync rate 60 : sync
autocam off
position camera 0, 50, -300
point camera 0, 0, 0
null = make vector3(1)
null = make vector3(2)
null = make vector3(3)
` make a sun object off in the far distance to the right somewhere
make object sphere 1, 50
position object 1, 1000, 500, 500
` calculate the light's direction to your scene
set vector3 2, 0.0, 0.0, 0.0 ` fill this vector with (X,Y,Z) values near the centre of your scene (world origin used here)
set vector3 1, object position x(1), object position y(1), object position z(1) ` this vector is the sun's position
subtract vector3 3, 2, 1 ` the direction vector of the light is the difference between these two position vectors
normalize vector3 3, 3 ` normalizes the direction vector so it can be used for lighting calculations
set directional light 0, x vector3(3), y vector3(3), z vector3(3)
make object sphere 2, 50 ` an object in your scene
make object plain 3, 1000, 1000 ` a ground object
xrotate object 3, 270
repeat
sync
until spacekey()
end
For shadows I think you need to do something similar but using light 1 (and probably hiding light 0). I'll post back with another demo soon.
Edit Simple demo with shadows. I get annoying self-shadowing on the sphere - and the shadow on the plain is too light in my opinion. But you do have shadows
sync on : sync rate 60 : sync
autocam off
position camera 0, 50, -300
point camera 0, 0, 0
` make a sun object up in the sky to the right somewhere
make object sphere 1, 50
position object 1, 1000, 1000, 100
` for DBPro shadows you need to use one of lights 1 to 8 not the default light 0
make light 1
set point light 1, object position x(1), object position y(1), object position z(1)
set light range 1, 5000
` you also probably need to hide light 0
hide light 0
make object sphere 2, 50 ` an object in your scene which will cast shadows
position object 2, 0, 50, 0
make object plain 3, 1000, 1000 ` a ground object (which will receive shadows automatically)
xrotate object 3, 270
` set up the shadows
set shadow shading on 2, -1, 300, 0 ` the sphere object casts shadows
set shadow position 1, object position x(1), object position y(1), object position z(1)
repeat
sync
until spacekey()
end