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 / DBP only supports 8 lights?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Mar 2010 16:14
Hi all!

OK, what I did is I made tons of lights distributed around the level, and I found that when I made light 9 (light 1-8 are already made), light 1 suddenly goes dull and switches from a point light to an ambient light. When I make light 10, the same happens with light 2, if I make light 11, same happens with light 3 and so on...

What's happening? How come I can only make 8 lights?

TheComet

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Mar 2010 16:16
It's a limitation of DirectX not DBPro.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Mar 2010 16:18
So why did TGC make it possible to add 65535 lights (or some ridiculous number like that) when only 8 lights work properly?

TheComet

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Mar 2010 16:21
It's a limit with DX and your graphics card. There are probably a few cards that will allow more lights, and DBPro might even support that too.

But the main thing, is that if you run out of lights, your not using them right. You need to spend lights sensibly, like store the positions of your lights, and check the distance to the camera, then take your 8 closest 'virtual-lights' and assign DX lights to them. As long as there's a decent spread to the lights it might be seamless, remember that 2D distance would probably do a good job, and think about ways to spend less lights.

This becomes doubly important when you add shaders with their own light sets, to get continuity you need a good lighting system - because DBPro can't do it all.

There was a multi-light example in a newsletter, maybe have a whizz through the last few, pretty sure Lee gave his monthly tips on how to do exactly this.


Health, Ammo, and bacon and eggs!
Daniel wright 2311
User Banned
Posted: 23rd Mar 2010 16:26
Van B has a good point, there really is no limmit becouse all you need to do is use them when you need them and you are not going to need 8 lights at the same time in the same area, so deliting lights then creating new lights in only the areas you are in is the way to do it.

ShaunRW
DBPro Developer
18
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 23rd Mar 2010 17:49
If you use the Extends Plugin, I'm pretty sure it finds the closest lights to you, so it's easy to make more then 8 lights with out having to create a routine.
Although with my experience with extends, it's better off starting the project with extends because i had a lot of trouble integrating it.

I would rather code my own routine first and see if it's any good.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Mar 2010 22:35
Thanks for the tips guys! I programmed a function to find the 8 nearest lights, and it works smoothly, but it's not exactly seamless. Oh well, better than nothing

I found something new too. If you set the color of light 0 to black, the surfaces of every object becomes really shiny. Is this a glitch?

TheComet

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Mar 2010 23:02
LIGHT 0 is the ambient light, and so suppresses the directional effect of any other lights. If you switch it off, you see an exaggeration of your point lights etc.

Math89
22
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 23rd Mar 2010 23:24
Light 0 is not the ambient light, it's the default directional light.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Mar 2010 00:52
Just what I was going to say. So why are things so shiny in your demo - they aren't in mine, I just get the ambient light as expected?

But as BatVink says, if you were to turn ambient light off, things would look a bit shiny.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Mar 2010 16:38
yes, directional, not ambient, my bad! But the result is the same

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Mar 2010 19:44
Quote: "But the result is the same"


?
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 24th Mar 2010 21:02
Quote: "There are probably a few cards that will allow more lights, and DBPro might even support that too."

Yeah, my card does support more than 8 lights. I don't remember how many exactly, but it was 10 or 18. I tested it a while back.

Quote: "It's a limitation of DirectX "

So, I don't think it's a limitation of Directx.

Cheers

Slayer rules!!! Yeaaah, man!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Mar 2010 22:18 Edited at: 24th Mar 2010 22:19
Quote: "Yeah, my card does support more than 8 lights. I don't remember how many exactly, but it was 10 or 18. I tested it a while back."


How did you test it?

Anyway, I've just looked at the DX9 SDK docs and I can't find any mention of lights being restricted to 8. In fact it seems to be a GFX card limitation as suggested by Van B earlier. Here's the only reference to numbers of lights that I could find in the SDK docs:



I must have been thinking of the texture blending stages - which are definitely limited to 8 according to the docs.

So it might be a DBPro limit in our case. If I knew how to code in C++ I could probably find the value of MaxActiveLights from the list of capabilities for my machines. A job for IanM perhaps?
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 24th Mar 2010 22:44
Quote: "How did you test it?"

I'll look it up. I still have that program somewhere. But I'm also really busy with the Intel Contest right now.

Quote: "Anyway, I've just looked at the DX9 SDK docs and I can't find any mention of lights being restricted to 8. In fact it seems to be a GFX card limitation as suggested by Van B earlier."

Yeah, that's why I don't think that it is a Directx limitation. And it is definately not a DBPro limitation either, because the program to test was written in DBPro.

Cheers

Slayer rules!!! Yeaaah, man!
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 24th Mar 2010 23:35
Quote: "If I knew how to code in C++ I could probably find the value of MaxActiveLights from the list of capabilities for my machines."

A quick hack- not in C++ though

TPC DLL and demo source attached. This machine has a GeForce 9600GT and supports 10 lights.
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 25th Mar 2010 00:41
@empty - Er I assume we need styx to compile? It errors out when I compile telling me it cannot find the styx registration file. (Yes I placed the dll in plugins user dir) - Perhaps it would be better to have uploaded the compiled exe? Either way it won`t take long to make more than 8 lights in dbp to find out.
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 25th Mar 2010 00:49
ooops...

new zip attached, doesn't need any plugins
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Mar 2010 01:18 Edited at: 25th Mar 2010 01:20
It shows 10 lights on my PC as well. Will check laptop tomorrow when I'm awake. I'll also see how many actual lights I can get showing in DBPro.

Looks like I tried to mislead everyone in my first post.

Sorry everyone.


Edit: This machine has a GeForce GTX 285.
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 25th Mar 2010 01:44
empty; Yeah - works now thanks - odd though that my "Estimated Avail Texture Mem" is -1809. Nothing else running other than dbp on vista - I have 512 vram on a 9600GT, (reports 10 lights too). Any idea why I get this value? Also could you tell me what "Texture Op Caps" means? I googled it but I keep getting web filter violations from the network I use(its a wifi thats free from where I work - also where I live), when trying to access some of the resulting sites. I can only think Op means operations but I can`t be sure. If it is operations(I assume it would be operations per cycle??), then could tell me what one operation entails?

Green Gandalf; I don`t suppose you(or anyone else reading) can think of any logical reason why newer cards support more lights when the way forward in gaming hardware appears to lean strongly towards the heavy use of shaders?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Mar 2010 02:07 Edited at: 25th Mar 2010 02:08
Quote: "Also could you tell me what "Texture Op Caps" means?"


If you need to know this sort of thing, get the MS DX9 SDK (it's free). Here's an extract of what it says (it was a long list ):



Quote: "I don`t suppose you(or anyone else reading) can think of any logical reason why newer cards support more lights when the way forward in gaming hardware appears to lean strongly towards the heavy use of shaders? "


Only that to not increase the limit would look like a backward step or a failure to keep up - but I'm guessing really. The number 10 seems odd in this power of two driven world.

Quote: "odd though that my "Estimated Avail Texture Mem" is -1809"


I get something similar. My guess is that there's been an integer type mismatch somewhere and a large integer has wrapped around to the negative values. Something like a dword being cast as an integer perhaps? Note that the value is probably megabytes or something.
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 25th Mar 2010 12:40
Thanks
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Mar 2010 15:33
Quote: "TPC DLL and demo source attached."

Why?
Why not just use GET MAXIMUM LIGHTS instead?
You can find most of the 'limits' can be found by looking through the functions at the tail end of the Basic 3D help.

DirectX 9 does not have a stated maximum limit of lights, but it does have a requirement of at least 8 lights for you to be able to say that your graphics card is DirectX 9 compatible, in the same way as MS state minimum shader levels, minimum number of instructions etc.

empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 25th Mar 2010 16:05 Edited at: 25th Mar 2010 16:06
haha well spotted!
Coincidently I've discovered that function in the objects header and then searched for it and fianlly found it in the DBPro dosc at this very minute
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Mar 2010 18:15
Hi there!...with this piece of code, I`v got in my small laptop samsung NC10 (10" creen) up to 18 lights at a time ... believe me !!, and with the same code, I got just 10 lights in my big laptop Acer Aspire 6930G...that means that not only the directX limitation...but the laptop limitation.


Just ckeck how many lights you get!!




cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Mar 2010 18:39
Quote: "but the laptop limitation"


I think you'll find it's a graphics card limitation as we've already discussed - not DirectX.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 25th Mar 2010 19:24


Returns -1 here...

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Mar 2010 21:16
Quote: "I think you'll find it's a graphics card limitation as we've already discussed - not DirectX"



"but the laptop limitation"

I suppose you`ll gess laptop limitation means all the components of a laptop....you can quote all my post if you are having fun...but I`m married.


Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Mar 2010 21:18
Both methods return 8 lights on my laptop and 10 on my desktop.

Quote: "Returns -1 here..."


Probably means that the number is so large that it's wrapped around to the negative integers.
GreenDixy
18
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 25th Mar 2010 21:32
when i run the program it highlights the first 8 i move the item with the up down key and i can activate the lights right up to 30 nice code

===================
No life, Lots of love, 2 Kids, God save me LOL
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 25th Mar 2010 21:35
Quote: " i can activate the lights right up to 30 "

Yeah, but you should count the ones that you see. Do you see 30 lights lit up?

Cheers

Slayer rules!!! Yeaaah, man!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Mar 2010 21:38 Edited at: 25th Mar 2010 21:48
@unixfr3ak

Wow !! up to 30 lights on at the same time ?!!?...what`s your computer ?


RE-EDIT
The Slayer`s right....you have to forget the left values, and just count the lights you can see.


cheers.

I'm not a grumpy grandpa
GreenDixy
18
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 25th Mar 2010 21:49 Edited at: 25th Mar 2010 21:51
18 on at a time

dual 3.06 (over cloked to 3.20ghz) 4gigs ram 4 terrabytes hard drive space (internal) 2 (external) using gforce 6600 windows xp pro

===================
No life, Lots of love, 2 Kids, God save me LOL
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Mar 2010 22:05 Edited at: 25th Mar 2010 22:07
@unixfr3ak
Ok...now that`s like my laptop...18 lights are enough for a level, but in most computers, just 8 or 10 light shining at a time.I think, it is better to make a function and reposition a number of 8 light maximum in order no to fail in some laptop or desktop.We need just make more test in differents PC.


Cheers!

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Mar 2010 23:03
Quote: "when i run the program it highlights the first 8 i move the item with the up down key and i can activate the lights right up to 30 nice code"


What program are you talking about? I seem to have missed something.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Mar 2010 23:20
@Green Gandalf
unixfr3ak meant the piece of code I post some post above.You can make a ckeck in your desktop or laptop.

cheers!

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Mar 2010 23:35
Thanks. I did miss something. Perhaps it's time for me to retire.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Mar 2010 23:44
@Green Gandalf

Ha ha...we´re getting old ....but never give up !!

Cheers.

I'm not a grumpy grandpa
GreenDixy
18
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 26th Mar 2010 00:20
lol i get 4 hours sleep a night and on these forums the rest of the time im old but love my pc

===================
No life, Lots of love, 2 Kids, God save me LOL
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 26th Mar 2010 17:39 Edited at: 26th Mar 2010 17:40
@Green Gandalf / empty ; still having issues with web filter here so could not download the latest dx sdk, however I was able to install an older one I had on my hd(aug2007) and found that the list was much smaller for texture op caps and that caps means capabilities. I re-ran the program by empty as I thought I remembered that the number of texture op caps was excessively high. It was 67043327! Can you confirm that the list is really this long? I am having difficulty believing that it would be.
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 26th Mar 2010 17:51
No the list hasn't that many entries but each entry is a bit flag. The device will be capable of more than one op. So these flags can be "or"ed together to store them in 32 bit dword value. To check if a certain op is supported you can use the "and" operator, for example the value for Lerp support is 0x02000000, so
if caps && 0x02000000 = 0x02000000 Then LerpSupported = true
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Mar 2010 18:46 Edited at: 26th Mar 2010 18:49
Quote: "It was 67043327! Can you confirm that the list is really this long? "


Don't be silly. If you set, say, 20 flags then the resulting binary number, i.e. %11111111111111111111, will be the moderately large decimal number 1048575. If you set 32 flags the number will be much bigger - but you'll only have 32 flags in the list.

Edit Didn't see the second page - sorry for repeating what empty just said.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Mar 2010 20:52
chafari

Your code shows 8 lights on my laptop and 10 on my desktop PC.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Mar 2010 01:44
@Green Gandalf
Thanks for testing...That confirms my suspicions, we have to use only 8 lights even knowing that last laptop soport 18 lights like my last one, but if we make any game with so many lights hoping it works in all laptop...we can be pretty sure that we are gonna fail.


Cheers.

I'm not a grumpy grandpa
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 28th Mar 2010 17:55
I guess it does not really matter how many lights over 8 you can support. Seeing as how 8 is the magic number, it would be pointless to support even one light over that.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Mar 2010 23:24
Quote: "I guess it does not really matter how many lights over 8 you can support"



Probably it doesn`t, but the question was ...Dbpro only soports 8 lights?

For me just one light would be enough, and then use light mapping


Cheers.

I'm not a grumpy grandpa
Nerd In Training
16
Years of Service
User Offline
Joined: 13th Feb 2010
Location:
Posted: 30th Mar 2010 17:30
What do you have to type to get the lights to work. This is what I have so far.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Apr 2010 01:03
@chafari, I get 18 on the left and 10 active (I have more than I thought!!) time to amend my include file!!

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Apr 2010 01:33 Edited at: 20th Apr 2010 01:34
Quote: "What do you have to type to get the lights to work. This is what I have so far."


Have a look at the light commands, perhaps?

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Apr 2010 03:16
Quote: "What do you have to type to get the lights to work. This is what I have so far"



just so easy!


Quote: "@chafari, I get 18 on the left and 10 active (I have more than I thought!!) "


Yeah..but just active lights are important.This example was just to check how many real lights were capable to show all differents graphic cards.

cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-27 20:18:16
Your offset time is: 2026-07-27 20:18:16