I've been going at getting the cubic shadow shader to work with my project but I cannot for the life of me get it to work...
Here is the source to the shadow example. Could someone tell me what bits and pieces I need to take from this to get the effect working in my game?
`====================================================
` Cubic 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
make camera 1
set camera to image 1,3,512,512
color backdrop 1,rgb(255,255,255)
Make Dynamic Cube Map 1,512
load image "Media/Floor.dds",4 : image=1
load image "Media/Floor_n.dds",5
`Create Object
load effect "FX/CubicShadowMapping.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
Apply Cube Map To Object 1,2,1
set object effect 1,1
`Create floor
make object box 2,500,1,500
position object 2,0,-65,0
texture object 2,0,4
texture object 2,1,5
Apply Cube Map To Object 2,2,1
scale object texture 2,0,5,5
set object effect 2,1
`Light Flare
load image "Media/Flare.JPG",20
make object plain 20,50,50
texture object 20,20
ghost object on 20
set object ambient 20,0
vec=make vector4(1)
`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
`Move Light
if KEYSTATE(38)=1 and MoveLight=1 and nopress=0 then MoveLight=0:nopress=1
if KEYSTATE(38)=1 and MoveLight=0 and nopress=0 then MoveLight=1:nopress=1
if MoveLight=0
ang#=wrapvalue(ang#+0.25)
position object 20,cos(ang#)*90,80+cos(ang#)*25,sin(ang#)*90
set vector4 1,object position x(20),object position y(20),object position z(20),0
set effect constant vector 1,"LightPosition",1
endif
point object 20,camera position x(),camera position y(),camera position z()
`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:Apply Cube Map To Object 1,2,1:texture object 1,3,3
set object effect 1,1
nopress=1
endif
if scancode()=0 then nopress=0
`Text
center text sw/2,15,"T - Change Texture Space - Change Object R - Rotate Object L - Move Light"
center text sw/2,40,"FPS "+str$(screen fps())
`Render shadiow map
set effect technique 1,"DepthMap"
Render Dynamic Cube Map 1,1,object position x(20),object position y(20),object position z(20)
`Main Scene
set effect technique 1,"ShadowMapping"
sync mask 2^0
`End loop
sync
loop
AMD FX 6300 hex-core processor 3.5 GHZ
16 GB DDR3 ram, Geforce 660 Ti 2GB ram