Dynamic light limit

Posted By: Anonymous

Dynamic light limit - 07/13/05 03:35

I am aware that there is a limit on dynamic lights in a level... so how can I get around that? I am designing a game set at night, which will include, if possible, one or two lights on each vehicle and a light on each trooper, to represent their headlights/torches. How can I do this for two players without overloading the dynamic light limit?
Posted By: ulillillia

Re: Dynamic light limit - 07/13/05 03:46

Perhaps updating the lights' paths less frequently and turning lights that are invisible or too far away off? What I mean by updating lights' paths less frequently is to have 8 lights to be processed in one frame, the next 8 lights processed in the next frame, then the final 8 in the third frame. After that, update the first 8 lights in the fourth frame, update the next 8 in the fifth, the next 8 in the sixth then update the first 8 again in the seventh and so on. Though I'm not sure how to script it, perhaps using a while loop for processing lights and when 8 lights are done, insert a wait instruction then the next 8 lights follow with another wait instruction like this in a way:

while(1)
{
light_1_action;
light_2_action;
light_3_action;
light_4_action;
light_5_action;
light_6_action;
light_7_action;
light_8_action;
wait(1);
light_9_action;
light_10_action;
light_11_action;
light_12_action;
light_13_action;
light_14_action;
light_15_action;
light_16_action;
wait(1);
light_17_action;
light_18_action;
...
wait(1);
}

Don't know if this'll work, but you can certainly try it. This idea is only best at slow speeds, but if you have too many lights, you'll need a longer delay and it'll soon become noticeable, especially at low frame rates.
Posted By: Anonymous

Re: Dynamic light limit - 07/13/05 06:46

In the maual it says that there is a limit of 32 dynamic lights- is there a way to bypass that? Making 'fake' dynamic lights?

And if I am using a lot of 'fake' lights, that function might be very useful, thanks.
Posted By: ulillillia

Re: Dynamic light limit - 07/13/05 07:07

Actually, the hardware limit is 8 dynamic lights and, from what I can tell, an unlimited number of static lights. Using models and sprites might help "fake" dynamic lights to some extent.

As for the function, just replace the light_XX_action with whatever the actions are for your dynamic lights. This way, 8 of them get processed per frame, but, to make best use of it, you'll need a decent or sufficient frame rate or you may notice the "faking" of it.
Posted By: mk_1

Re: Dynamic light limit - 07/13/05 10:54

You'll notice it.
The new light management switches between light group and can therefor display more than 8 lights. Look at the forecast section.
Posted By: iWaNtToKnOw

Re: Dynamic light limit - 07/13/05 11:28

i think it is possible to make Fake Lights like HL1 FlashLight using a bitmap with alpha channel and the Texture to be iluminated and make a Decal, but is very hard and complicated, need some shader knowledge, try use something like this in models headlights.
Posted By: Orange Brat

Re: Dynamic light limit - 07/13/05 11:43

You can have more than 8 lights per level...you just can't have more than 8 on at once. However, having that many lights on at once is a framerate killer in certain circumstances. I like to keep it under 4-5 in a single view.

Try out my dynamic light code...it takes care of most circumstances including shutting lights on/off if you desire:

http://www.coniserver.net/ubbthreads/showflat.php?Cat=&Board=UBB3&Number=536372

Quote:

In the maual it says that there is a limit of 32 dynamic lights-




That's a relic from the A5 days. I think Conitec had their own engine trick and could display that many, but they weren't hardware lights. I recall a lot of people hated the switch to hardware lights and actual prefer the old software look. Anyway, that shouldn't be in the manual anymore unless you're using an old one. Get the newest in the Blame the Manual forum.
Posted By: Matt_Aufderheide

Re: Dynamic light limit - 07/13/05 12:08

Quote:

8 lights to be processed in one frame, the next 8 lights processed in the next frame, then the final 8 in the third frame.



this is a very bad idea.. this will make all of your light flicker..ugly. Bascially you cant get around the 8 light limit yet, so dont try, just design around it..instead of using 2 lights for each car headlights, just use one for each car. of course, only activate lights that are near to the camera, and can easlity fade them in and out..when you think about it, 8 lights at once is an awful lot of lights, more than you should reasonably need.
Posted By: Anonymous

Re: Dynamic light limit - 07/14/05 02:17

Well, in a tank battle at night, you might have 5-10 tanks per side, each with a headlight.
So it would be possible to just turn off lights that aren't seen at a given point in time?
Posted By: Matt_Aufderheide

Re: Dynamic light limit - 07/14/05 05:47

yeah sure you can do this..for each light object say you have a function like this:
Code:
function check_visibility()
{
var screenpos[3];

while(1)
{
vec_set(screenpos.x,my.x);

if (vec_to_screen(screenpos,camera)!=0)
{
my.lightrange=0;

}
else{my.lightrange=light_range;}


wait(1);
}

}


Posted By: prophet

Re: Dynamic light limit - 07/17/05 03:18

Go with Orange Brat's script, it works quite nicely.
Posted By: ulillillia

Re: Dynamic light limit - 07/17/05 08:27

Quote:

Quote:

8 lights to be processed in one frame, the next 8 lights processed in the next frame, then the final 8 in the third frame.



this is a very bad idea.. this will make all of your light flicker..ugly. Bascially you cant get around the 8 light limit yet, so dont try, just design around it..instead of using 2 lights for each car headlights, just use one for each car. of course, only activate lights that are near to the camera, and can easlity fade them in and out..when you think about it, 8 lights at once is an awful lot of lights, more than you should reasonably need.




In case you're wondering, I'm thinking that this'll still have the lights being shown, but have a delay not getting updated after some time. That is, when light 8 is processed and the wait instruction is encountered, when light 9 starts up, light 1 remains in the same position it was in earlier and light 9 is processed. Because of the frame advance, lights 1 through 8 would have their old positions kept without being changed. Then, when the whole cycle went through and back to 1 again, light 1, being behind some, will get updated to it's new position. It's a weird concept, but it works best with high frame rates. At low frame rates, it's more easily noticed.
Posted By: Matt_Aufderheide

Re: Dynamic light limit - 07/17/05 09:28

It's not a wierd concept at all. it's pretty straightforward.. but the thing is wont work really..unless you have really high framerates like 100fps or so.. even then it will still produce flickering. And since no 3d game has a consistent framerate at all times, it will also stutter..the results would generally be unacceptable.
Posted By: Orange Brat

Re: Dynamic light limit - 07/17/05 09:46

Quote:


Code:
function check_visibility()
{
var screenpos[3];

while(1)
{
vec_set(screenpos.x,my.x);

if (vec_to_screen(screenpos,camera)!=0)
{
my.lightrange=0;

}
else{my.lightrange=light_range;}


wait(1);
}

}







That's a pretty nice way to turn off a light and not mess with vec_dist like in my script. I might find some way to integrate it into my Ultimate light script one day...as an option. This method would be good for lights in a multi-floor level and that are on a floor above or below the player but are still within a range that would keep them turned on. That's a pretty big flaw in my current version, but it only occurs when the multi-floor scenario is in play.
Posted By: Matt_Aufderheide

Re: Dynamic light limit - 07/17/05 11:02

Actually this wont work for the multi floor situation..as there is no occlusion testing.. the only wy to do occlusion testing would be to cast a ray from the light to the eye.. however, if you have multiple floors, you should have BSP or some kind visibility in play, so the object that produces the light ought to be culled by the engine automatically..eliminating the problem altogether.
Posted By: Aram

Re: Dynamic light limit - 07/26/05 10:50

So this dynamic light limit, is it a 3DGS limit or is it something related to DirectX ?
Posted By: ulillillia

Re: Dynamic light limit - 07/26/05 10:55

Neither. It's a hardware limit as far as I know. DirectX makes use of the hardware so it may have some effect to it.
Posted By: old_bill

Re: Dynamic light limit - 07/26/05 10:56

The dynamic lights are hardware based, and there DirectX gives the limit of 8.
But Conitec is working on a fast software solution, which will eliminate the limit of 8
active dynamic lights.

old_bill
Posted By: Aram

Re: Dynamic light limit - 07/26/05 10:58

Thanks for the info guys.
© 2024 lite-C Forums