Hi Digao
As already mentioned there are different ways to tackle this issue, many ways to cook the same dish as it were.
The previous posts should show you how to achieve what you want; but for further information; observe the example below which demonstrates the use of the Set Global Shadow Color function found in the Game FX section of the documentation.
Set Global Shadow Color [red], [gree], [blue], [alpha]
The alpha parameter, like the colour parameters, is a byte range from 0 - 255
Also note that you can use FX shaders. For static shadows you could use DLLs such as Dark Lights or a map editor with light mapping facilities to draw the shadows onto your textures; which obviously eases the runtime system load although you may not want static shadows.
Here is some code to get you started
rem Create 3 shapes and colour them differently. Position each shape apart
make object cube 1, 1 : color object 1, rgb( 255,0,0 )
make object sphere 2, 1 : move object left 2, 3 : color object 2, rgb( 0,255,255 )
make object cone 3, 1 : move object right 3, 3 : color object 3, rgb( 0,0,255 )
rem Create a sphere to represent our light; and a plane to represent the floor
make object sphere 4, 0.2 : color object 4, rgb( 255,255,200 )
make object plain 5, 500, 500 : xrotate object 5, 90 : move object 5, 0.5 : color object 5, rgb( 128,150,128 )
rem Add shadow mapping to our objects with no mesh, a shadow range of 3 with a shader
Set Shadow Shading On 1, -1, 3, 1
Set Shadow Shading On 2, -1, 3, 1
Set Shadow Shading On 3, -1, 3, 1
rem Set up the rest of the scene
sync on : sync rate 60
make light 1
set point light 1, 0, 0, 0
rem Set up the camera in a fixed position
position camera -10, 5, -10
point camera 0,0,0
rem Declare some variables
alpha# = 50
xv# = 0
dist# = 20
do
rem Allow the user to adjust the shadow alpha and light distance
rem bmLimit is a function which limits the result to a given range
alpha# = bmLimit( alpha# + upkey() - downkey(), 0, 255 )
dist# = bmLimit( dist# + rightkey() - leftkey(), 0, 500 )
rem Display useful information
Set Cursor 0, 0
print "Shadow alpha: "; alpha#
print "Light distance: "; dist#
print "Press [up] or [down] to adjust alpha"
print "Press [left] or [right] to adjust light distance"
rem *** Set the global shadow color AND its alpha. This is a GameFX function shipped with DBPRO
Set Global Shadow Color 10, 10, 10, alpha#
rem Update the light
position object 4, sin(xv#)*dist#,10, cos(xv#)*dist# ` Orbit the light around the centre
xv# = wrapvalue( xv# + 0.2 )
position light 1, object position x( 4 ), object position y( 4 ), object position z( 4 )
rem We are manually setting the global shadow position to the light position, based on the position of object 4
rem You may need to adjust this to your sun position, or to a room light, or to what ever light you require
Set Shadow Position 1, object position x( 4 ), object position y( 4 ), object position z( 4 )
sync
loop
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
function bmLimit( value#, min#, max# )
if value# < min# then value# = min#
if value# > max# then value# = max#
endfunction value#
` binarymodular.com