limits of dx lights

Blitz3D Forums/Blitz3D Programming/limits of dx lights

RifRaf(Posted 2009) [#1]
Has anyone every tried making a recycling system for dx lights, i think the dx7 has a limit of what? 8 or 16 lights, somthing like that. Would it be a large speed hit to continualy delete and create lights based on their intended positions range from the player?

I want to add some real time lighting, not so much shadows or anything like that.

Just curious if any of you have played with this method at all.

a scene like this needs a a few lights here and there, perhaps even projectile trailing lights.
http://www.empowergames.com/ineedlights.jpg?


Kryzon(Posted 2009) [#2]
If you create more than 8 lights, they are really there, just not lighting things up.
You can still edit their properties, position and rotation, but they just won't light anything up.

I was thinking of using a Dx7 userlib to implement a dynamic hardware lighting system, always having 8 of the most optimal lights turned on (the others, obviously, turned off by use of the IDirect3DDevice7::LightEnable method). That way only the 'best' lights would be turned on, and used to the full potential of 8.

Unfortunately, I don't have enough C++ experience to set up an interface with the Direct3D 7 Device (it shouldn't be that hard, really, you can get the address by using the SystemProperty function).

Then you could create a userlib to use the LightEnable function (which enables a light based on a 0~7 index, with you setting the light to True or False to turn it on or off).


Ross C(Posted 2009) [#3]
Don't suppose you have looked at fake lighting, using lightmesh? Puki had a decentish system up and running for it.

But, why delete and recreated the lights. Just have 8 lights and move them accordingly, and change their properties. There is (or was) an issue with creating more than 8 lights, and trying to get the ones you wanted to work. Hideentity on a light for instance, did not make a light that was previously not working, work because one was hidden.

So, your best bet if you want to use the hardware lights, is to move them around, based on what ones you don't need, or do need.


Kryzon(Posted 2009) [#4]
"Sauce" of the issue please?

Now that you mention it, indeed it would be much simpler to just move the lights around (moving the 8 lights to the most optimal slots based on the player's position, that is).

Would save the trouble of having to create an userlib just to get the LightEnable method to oficially turn lights on or off, while keeping a max of 8 lights on to avoid compatibility issues.


Ross C(Posted 2009) [#5]
Sauce? :P :D I'll have a look back. It was about 5 years back I think. And i have been wrong about remembering that far back before :S


RifRaf(Posted 2009) [#6]
Ross,
Yeah ive looked at fake lighting, and ive put some in the archives. I think that would be a large hit. Moving 8 lights sounds like the best idea so far, thanks.


Matty(Posted 2009) [#7]
http://blitzbasic.com/codearcs/codearcs.php?code=1246

Something that was suggested a long time ago for this I think. Haven't tried it myself though...