Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Lights & shadows

Author
Message
djchaos
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Brighton, UK
Posted: 25th Jun 2007 05: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
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 25th Jun 2007 06: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.

djchaos
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Brighton, UK
Posted: 25th Jun 2007 06: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
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 25th Jun 2007 06:41 Edited at: 25th Jun 2007 06:43
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

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
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.



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.

Boo!
djchaos
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Brighton, UK
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?
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
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.

Boo!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
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

oh my god
djchaos
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Brighton, UK
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
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 25th Jun 2007 19:33 Edited at: 25th Jun 2007 19:51
Quote: "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

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
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

Boo!
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
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.

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 26th Jun 2007 01:30
Hallo all...ok djchaos ,of course there is a form of light mapping ...have a look to this example .

cheerz.

oh my god

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-05 14:22:57
Your offset time is: 2024-05-05 14:22:57