let me make an example, this is the WHOLE shadowmapping code from evolved
`====================================================
` Depth Shadow Mapping
`====================================================
` By EVOLVED
` www.evolved-software.com
`====================================================
`Setup Display
load dll "user32.dll",1
Sw=call dll(1,"GetSystemMetrics",0)
Sh=call dll(1,"GetSystemMetrics",1)
delete dll 1
set display mode Sw,Sh,32,1
sync on : sync rate 0
hide mouse
`Set Text
set text font "Verdana"
set text size 15
set text to bold
ink rgb(200,200,0),0
`Setup Camera
backdrop on
color backdrop rgb(128,128,128)
autocam off
position camera 0,0,-150
set camera fov 85
xrotate camera 30
CamDis#=-100
`Load Textures
load image "Media/rockwall.dds",1 : image=1
load image "Media/rockwall_n.dds",2
load image "Media/spotlight.bmp",3
load image "Media/floor.dds",5
load image "Media/floor_n.dds",6
make camera 1
set camera to image 1,4,512,512
set camera fov 1,60
set camera aspect 1,1.1
backdrop off 1
`Create Object
load effect "FX/ShadowMapping.fx",1,0
load object "Media/t-pot.x",1 : object=1
scale object 1,4500,4500,4500
scale object texture 1,0,4,3
texture object 1,0,1
texture object 1,1,2
texture object 1,2,3
texture object 1,3,4
set object effect 1,1
`Create floor
make object box 2,500,1,500
position object 2,0,-65,0
texture object 2,0,5
texture object 2,1,6
texture object 2,2,3
texture object 2,3,4
scale object texture 2,0,5,5
set object effect 2,1
`Light vectors
LX#=-156:LY#=200:LZ#=-126
LaX#=56:LaY#=83:LaZ#=0
Null=make matrix4(1)
Null=make matrix4(2)
Null=make matrix4(3)
Null=make vector4(6)
`Start loop
do
`Control Camera
position camera 0,0,0
if mouseclick()=0
xrotate camera camera angle x()-mousemovey()*0.25
yrotate camera camera angle y()+mousemovex()*0.25
if camera angle x()>80 then xrotate camera 80
if camera angle x()<-60 then xrotate camera -60
endif
if mouseclick()>0 then CamDis#=CamDis#-mousemovey()*0.25
CamDis#=CamDis#+mousemovez()*0.25
if upkey()=1 then CamDis#=CamDis#+2.5
if downkey()=1 then CamDis#=CamDis#-2.5
if CamDis#>-20 then CamDis#=-20
if CamDis#<-300 then CamDis#=-300
move camera CamDis#
if camera position y()<-60 then position camera camera position x(),-60,camera position z()
mousemovex()=0
mousemovey()=0
`Rotate object
if KEYSTATE(19)=1 and rotate=1 and nopress=0 then rotate=0:nopress=1
if KEYSTATE(19)=1 and rotate=0 and nopress=0 then rotate=1:nopress=1
if rotate=0
rotate object 1,0,object angle y(1)+0.5,0
endif
`Change Texture
if KEYSTATE(20)=1 and nopress=0
delete image 1:delete image 2
inc image
if image>4 then image=1
if image=1 then load image "Media/rockwall.dds",1 :load image "Media/rockwall_n.dds",2
if image=2 then load image "Media/wall1.dds",1:load image "Media/wall1_n.dds",2
if image=3 then load image "Media/oldwall3.dds",1:load image "Media/oldwall3_n.dds",2
if image=4 then load image "Media/rock4_1.dds",1 :load image "Media/rock4_1_n.dds",2
texture object 1,0,1
texture object 1,1,2
nopress=1
endif
`Change Object
if Spacekey()=1 and nopress=0
delete object 1
inc object
if object>5 then object=1
if object=1 then load object "Media/t-pot.x",1:scale object 1,4500,4500,4500:scale object texture 1,0,4,3
if object=2 then load object "Media/Tosus.x",1:scale object texture 1,0,1.5,1
if object=3 then make object box 1,75,75,75
if object=4 then make object sphere 1,75,40,40:scale object texture 1,0,2,1
if object=5 then make object cylinder 1,75:scale object texture 1,0,3,1
texture object 1,0,1:texture object 1,1,2:texture object 1,2,3:texture object 1,3,4
set object effect 1,1
nopress=1
endif
if scancode()=0 then nopress=0
`Set spot Light to camera position
if Shiftkey()=1
LX#=camera position x():LY#=camera position y():LZ#=camera position z()
LaX#=camera angle x():LaY#=camera angle y():LaZ#=camera angle z()
endif
set vector4 6,LX#,LY#,LZ#,0
set effect constant vector 1,"LightPosition",6
`Text
center text sw/2,15,"1 - Show Depth Texture Shift - Set Spot Light To Camera Space - Change Object T - Change Texture R - Rotate Object"
center text sw/2,40,"FPS "+str$(screen fps())
`Set Shadow shader light projection Matrix
SET CURRENT CAMERA 1
position camera 1,LX#,LY#,LZ#
Rotate camera 1,LaX#,LaY#,LaZ#
view matrix4 1:projection matrix4 2
multiply matrix4 3,1,2
set effect constant matrix 1,"LightProjMatrix",3
SET CURRENT CAMERA 0
set effect technique 1,"DepthMap"
sync mask 2^1:fastsync
if KEYSTATE(2)=1 then paste image 4,0,0
`Main Scene
set effect technique 1,"ShadowMapping"
sync mask 2^0
`End loop
sync
loop
and this is the part i just take
`Load Textures
rem INFO: I have loaded the other images previously, because different of the evolved ones
rem I have also changed camera 1 to camera 3 because camera 1 and 2 are taken by the water shader
load image "Media/spotlight.bmp",3
make camera 3
set camera to image 3,4,512,512
set camera fov 3,60
set camera aspect 3,1.1
backdrop off 3
`Create Object
rem INFO: the only difference i made here is the object loaded which is a character i made
load effect "FX/ShadowMapping.fx",1,0
load object "Media/t-pot.x",1 : object=1
scale object 1,4500,4500,4500
scale object texture 1,0,4,3
texture object 1,0,1
texture object 1,1,2
texture object 1,2,3
texture object 1,3,4
set object effect 1,1
`Create floor
rem INFO: i tryed both to remove and add this part getting no results (unless getting dark pavement as well using it)
make object box 2,500,1,500
position object 2,0,-65,0
texture object 2,0,5
texture object 2,1,6
texture object 2,2,3
texture object 2,3,4
scale object texture 2,0,5,5
set object effect 2,1
`Light vectors
LX#=-156:LY#=200:LZ#=-126
LaX#=56:LaY#=83:LaZ#=0
Null=make matrix4(1)
Null=make matrix4(2)
Null=make matrix4(3)
Null=make vector4(6)
`Start loop
do
`Set spot Light to camera position
if Shiftkey()=1
LX#=camera position x():LY#=camera position y():LZ#=camera position z()
LaX#=camera angle x():LaY#=camera angle y():LaZ#=camera angle z()
endif
set vector4 6,LX#,LY#,LZ#,0
set effect constant vector 1,"LightPosition",6
`Set Shadow shader light projection Matrix
REM INFO: here i tryed both to keep sync mask 2^0 and tryed to do sync mask 2^3 with no results
SET CURRENT CAMERA 3
position camera 3,LX#,LY#,LZ#
Rotate camera 3,LaX#,LaY#,LaZ#
view matrix4 1:projection matrix4 2
multiply matrix4 3,1,2
set effect constant matrix 1,"LightProjMatrix",3
SET CURRENT CAMERA 0
set effect technique 1,"DepthMap"
sync mask 2^3:fastsync
`Main Scene
set effect technique 1,"ShadowMapping"
sync mask 2^0
`End loop
sync
loop
Obviously i have added the do loop part in my do loop one, and the other part before of it