Hey there. I've been working on setting up shaders in Dark Basic Pro for a couple days now, and so far, I only have managed to get my shaders to appear, but not change to moving light.
I set up a light and a cartoon shader on a sphere, then had the sphere rotate and the light move. Without the shader, it works normally and the light change on the sphere is noticeable. However, when I used the shader, the sphere's shading stuck at the initial position. It rotates and the light moves, but the shading doesn't change. Any advice?
Here's the code.
//set sync
sync on
sync rate 30
autocam off
position camera 5, -1, -4
point camera 0, 0, 0
//load shader images
load image "media\shade2.bmp", 1
load image "media\edge4.bmp", 2
//make object
make object sphere 1, 3
//enable shader
set cartoon shading on 1, 1, 2
lightpos = 30
// 1=up, 0=down
lightmov = 0
set ambient light 0
make light 1
show light 1
position light 1, lightpos, lightpos, lightpos
do
//rotate object
rotate object 1, object angle x(1)+1, object angle y(1)+.5, object angle z(1)+.75
//light movement
if lightmov = 1
lightpos = lightpos+1
if lightpos = 30
lightmov = 0
ENDIF
ENDIF
if lightmov = 0
lightpos = lightpos-1
if lightpos = -30
lightmov = 1
endif
ENDIF
position light 1, lightpos*2, lightpos*4, lightpos*2
text 0, 0, str$(lightpos)
sync
LOOP
Thanks for your time, all.