max_lights confusion ?

Posted By: Andreas C

max_lights confusion ? - 02/09/09 08:42

I've created a standard "empty level" from the templates. I've added one block and ca. 25 MDLs (from Dexsoft SEWER-kit). Also, I've added 22 dynamic lights (since MDLs aren't lit by static lights.

I've checked the "Create_Meshes" box for compiling.

The first line in my main() routine is :

max_lights = 64;

but when I run the level, the engine turns off all but 8 of the lights (they are in different section of the sewer-maze, so I see it my walking around to where the lights should be).

I have A7-Pro, so I was under the impression this should get me around the 8-light limit.

Any help would be appreciated !

Cheers,
Andreas
Posted By: Stromausfall

Re: max_lights confusion ? - 02/09/09 15:06

from the online manual "The Lighting Engine" :

"Normal engines support only 8 dynamic light sources because that's the limit of today's 3D hardware. The A7 engine however contains a light manager that can render a theoretically unlimited number of dynamic light sources at the same time. Before rendering a particular mesh or object its 8 closest light sources are automatically activated and all other light sources are switched off. This way the 3D hardware limit is still kept, despite hundreds of light sources can be visible at the same time."



Maybe the problem lies in the limitation of 8 light sources per mesh. I have to admit that i'm not really sure what a mesh is.
But if your sewer complex is one big model (object) only 8 lights can affect it...
So if that's the problem you should split up your level models into smaller parts i think, so that each part is lighted by max 8 lights - but as i said, just a guess
Posted By: Andreas C

Re: max_lights confusion ? - 02/09/09 15:26

I understand about the limit of 8 lights per mesh ... this should not be the issue, since I have lots of individual MDLs and any individual MDL does not have more than 3 lights close to it.

What I see is that the lights 9-22 are turned off / not rendered. If I add another light (e.g. in front of or close to one that is being rendered), then another previously lit light gets turned off.

This is exactly what I would expect under A6 with its hard limit of 8 lights.

Very strange ...

Cheers,
Andreas
Posted By: EvilSOB

Re: max_lights confusion ? - 02/10/09 06:36

Do you have the DYNAMIC flag set on those lights in WED?
Posted By: Andreas C

Re: max_lights confusion ? - 02/10/09 08:24

Originally Posted By: EvilSOB
Do you have the DYNAMIC flag set on those lights in WED?


Yup ... DYNAMIC flag is set on all lights ... frown

And if I delete some of the "working" lights, the other ones show up again ... so it seems to definitely be the issue with only 8 dynamic lights being active.

I've put level blocks around the MDLs (in essence "encasing" them), just in case the fact that the sewer-mdls are only one sided, but that did not improve anything ...

Cheers,
Andreas
Posted By: EvilSOB

Re: max_lights confusion ? - 02/11/09 12:13

Weird. If its possible, as a test,
can you create the same lights in position from your script?
Just to see if its maybe a compiling issue or a engine issue.
Start with less than 8 and increase till something happens...
Posted By: Andreas C

Re: max_lights confusion ? - 02/19/09 10:21

Originally Posted By: EvilSOB
Weird. If its possible, as a test,
can you create the same lights in position from your script?
Just to see if its maybe a compiling issue or a engine issue.
Start with less than 8 and increase till something happens...


Well, I've done that and it just displays 8 dynamic lights. The debug (statistics) panel shows 8 lights ... never more than that ...

But I can't believe that it just doesn't work at all ... obviously to me, I've done something wrong here ... but I just can't figure out what.

I use A7, I've set max_lights to 128, I've checked the "create meshes" box in the compiler options ... I am NOT trying to get more than 8 lights to light a single entity.

I've been reluctant to post this under BUGS because I am pretty sure it is something I am doing wrong here ... I could post the level someplace, but it is so simple that anyone could recreate it in about five minutes.

Any more ideas ?

Cheers,
Andreas
Posted By: EvilSOB

Re: max_lights confusion ? - 02/19/09 11:33

If I were you, I'd post a link to here in the "Ask the Developers" forum.

I can understand debug only saying 8 lights, cause there is only 8,
AT ANY ONE TIME. Check on Stromausfall's post to understand that.

If you are relying JUST on that number, dont do so, is a deceiving number.

But Id try posting a link to here in the "Ask the Developers" forum.
There maybe something in your code that is stopping the engine from doing
its "automatic switching lights on and off" to get past the 8-light limit.
Posted By: Andreas C

Re: max_lights confusion ? - 02/20/09 07:46

Well, I've posted it in the BUG HUNT.

I've created a simple level (only blocks, no MDL-geometry) with 12 dynamic lights and when I enter the stat-view (pressing F11 twice) I see the bounding boxes for the dyn. lights (only a total of 8 are present in the level at this point). As I create new ones at runtime (in another part of the level that is not visible, I've put in code so I can individually add a total of 4 dyn. lights at specific locations by pressing the "L" key ...), I can see the engine remove one of the current dyn. light entities (in the order they were created ... just like mentioned in the manual)in view .

This does not sound like the A7 light manager is managing much of anything at all.

I hope that JCL & Co. can show me the error of my ways (because frankly, I still don't believe that it just doesn't work at all).

Cheers,
Andreas
Posted By: Andreas C

Re: max_lights confusion ? - SOLVED - 02/20/09 08:30

Ok,
as I suspected ... it was something I did (or didn't do in this case crazy !).

The T7-templates (display.c) sets the max_lights variable to 8 ... my setting the max_lights variable had no effect whatsoever.

I needed to change the template code.

And voilá ... it works.

Cheers,
Andreas
Posted By: EvilSOB

Re: max_lights confusion ? - SOLVED - 02/20/09 12:22

God damn! The templates have an un-documented feature!
© 2024 lite-C Forums