Posted: 25th Jun 2007 5:56
i was wondering how many "Lights" i can have/use in DBPro?

i can't remember where but i read somewhere it was 5 max (might have been for something else)

also i did some testing with shadow casting & it dosn't seem to work

i set up a cube, then a bigger cube behind it & positioned the light in front of the 2 to see if it would cast a shadow, & it didn't (the light will just shine right through the cube)

i tried 1 or 2 basic shadow commands & haven't looked into it yet (not quite reached that far yet)

is it possible to have dynamic shadowing (like the player shadow) without using textured plains

thanx in advance
Posted: 25th Jun 2007 6:19
Shadows are a bit buggy on non Nvidia/ATI cards. Never mind not working, they make my laptop crash

If you have the above two maybe you are doing something odd like having a very large world or objects so the shadow never reaches them. There is a casting distance limit now to speed things up a bit.
Posted: 25th Jun 2007 6:33
ok thats kool, my "game world" is set so the player is around 54 units high, 6.4ft = 64 units so its not stupidly large or small, and i can set the camera range to just behind the skybox and speed things up a bit

with shadows i am setting it so its "fool proof", if someones graphics card dosn't support it, it will detect this and set them to off.

the same as any "missing" textures won't cause the game to exit, but instead show a default texture, all of the game is set up as to not crash, and if it does it will go into a sort of "safe mode/lowest settings mode"

my graphics card is a NVidia GeForce 8800 1.2GB video RAM so it should support shadows
Posted: 25th Jun 2007 6:41
Wow it should work no problem on that game card.

My only other guess is that you havn't set the undocumented command.

SET SHADOW POSITION -1,0,500,0

don't let it fool you you are not setting the shadow position you are setting the position of the light!

My graphics card says it support hardware shadows with shader 2.0 so detection doesn't help in my case
Posted: 25th Jun 2007 11:44
Shadows do work but you have to use all the right commands, specially the undocumented ones.

Here is a little snippet I knocked up ages ago that shows how to use them properly.

+ Code Snippet
sync on : sync rate 60 : autocam off

` 0 = use cpu (slow and innacurate), 1 = gpu shader (fast and accurate)
shader=1

` make a texture
ink rgb(255,0,0),0
box 0,0,16,16
get image 1,0,0,16,16

` hide main light
hide light 0
set ambient light 30

` make ground
make matrix 1,1000,1000,64,64
prepare matrix texture 1,1,1,1
position matrix 1,-250,0,-250

` make some objects to cast shadows
o=1
for f=0 to 340 step 20
   inc o
   make object box o,5,40,5
   texture object o,1

   set shadow shading on o,-1,1000,shader
   ` object, mesh, range, shader
   ` object=quite obvious really
   ` mesh=-1 means use objects mesh, but gives option of using lower res mesh
   ` range=how far to cast shadow - useful as shadows cast on multiple objects through solid objects. Grrrrr
   ` shader=0=cpu,1=gpu

   position object o,100*sin(f),20,100*cos(f)
next f

` make light object to show where light is
inc o
make object sphere o,-10

` make new light and set shadow position
make light 1
set point light 1,0,0,0
set light range 1,1000

lightmode=1
` set shadow mode to 'light' mode,ie shadows will be cast from selected light number
` in this case is 1 (x, y and z values will be ignored)
` you can also use value of -1 which means you can force position of shadows
set shadow position lightmode,0,0,0

position camera -20,8,-150
point camera 0,0,0

ink rgb(255,255,255),0
a#=0
do
   control camera using arrowkeys 0,2,2
   gosub movelight
   text 0,0,"cursors to move around"
   text 0,20,"FPS="+str$(screen fps())
   sync
loop

movelight:
a#=wrapvalue(a#+0.2)
x#=newxvalue(0,a#,150)
y#=50+(50.0*sin(a#*2.0))
z#=newzvalue(0,a#,150)
position light 1,x#,y#,z#
position object o,x#,y#,z#
return


As notes, it's very difficult to detect whether your graphics card supports shadows. When 5.8 came out there was some demo programs that Rick put together to show how to use new shadow commands. It states that only Vertex Shader 1.1 is needed for shadows. However my laptop with ATI mobility graphics has better than that yet shows no shadows at all.
Posted: 25th Jun 2007 16:38
that shadow example is bloody amazing, didn't relies that shadows would look that good. well thats one big worry out of the way. if my gfx card didn't support shadows would the game exit? or just not display the shadow?

also i am wondering how many lights i can have in game? is there a maximum?
Posted: 25th Jun 2007 17:04
If card does not support shadows, then they simply do not appear, which is good news. No horrid crashes or anything.

If you wanted to properly detect if card supports shadows, then maybe draw couple of objects and set shadows, then use POINT command to see if a shadow has actually been cast.

Most modern cards do gpu shadows, it's only some older ATI radeon laptop cards and a lot of integrated cards that dont support them.

And regards to number of lights, the MAKE LIGHT command spells it out for you. Aswell as default light 0 you can only create 7 new lights. This is a DirectX limitation. If you want more lights then you have to reuse lights, so as long as you can only see 8 lights at any one time, you have to do some clever juggling and moving of lights.
Posted: 25th Jun 2007 17:30
Hallo,Friends. Time ago...just by chance i made more than 8 lights and no error happened...then i done somethin like:

for i= 1 to 20
make light i
next i

and no error ...mmmm so i made a simple level with boxes and i put 7 lights down stairs ...all on then i went up stairs and put other 7 lights....this time off and as spooky says if we play somehow with our position "Y" then we can make all lights seems to be on....by same way we could do a complete hospilal with hundred of lights..LOL..

Greetings
Posted: 25th Jun 2007 18:46
i will have a play with it when i get to that part, but is there a way to do some form of light mapping or something as my environment is a large outside area (an abandon city) and 2nd there will be a multiplayer roll play option
Posted: 25th Jun 2007 19:33
If card does not support shadows, then they simply do not appear, which is good news. No horrid crashes or anything.


oh, er, I wouldn't be so sure
http://forum.thegamecreators.com/?m=forum_view&t=100574&b=15



If you want to light your abandoned city you would be better of using a light map with your model it's way, way faster. Can only be used with static objects and scenery though. I use DeleD Lite to make mine but limited to a 512x512 map for free use. There's also LightMapMaker by aWingSoft.com
Posted: 25th Jun 2007 19:52
There's also Dark Lights which looks good, but I have no experience of it. Link = http://darkbasicpro.thegamecreators.com/?f=dark_lights
Posted: 25th Jun 2007 19:56
Yeah you would buy dark light if you wanted to make you own custom light map maker i think.
Posted: 26th Jun 2007 1:30
Hallo all...ok djchaos ,of course there is a form of light mapping ...have a look to this example .

cheerz.