Dynamic Light

Posted By: tivi

Dynamic Light - 10/21/07 13:46

Hi,

I have a propblem with light entities and models. The lighting is switched on/off on the models. I think this happens when I load a terrain. The light is an animated sprite with this action: Code:

action irr_gang_Viol()
{
my->red = 70;
my->green = 2;
my->blue = 70;
my->ambient = 80;
my->lightrange = 30;
my->frame = random(40);

while(1)
{
my->frame += 1*time_step;
if(my->frame > 41) my->frame -= 40;

wait(1);
}
}


Does someone know the problem and maybe has a solution?. I tried changing the unlit-flag, lightrange etc., nothing helped.
Please help me

Tom
Posted By: Nems

Re: Dynamic Light - 10/21/07 16:38

Depending on the Gstudio your using, you may have too many dynamic lights running at the same time. The old default was 8 dynamic lights but in the new way, it depends on the output of your game compile I think.
Posted By: tivi

Re: Dynamic Light - 10/21/07 21:18

thanks for the reply.
There are only four lights in the level, so this should not be the problem. Without the terrain, everything runs fine.
With the terrain the reflected light on some models start blinking on/off slowly. Sometimes it´s ok for some seconds .
The problem is the same on different pc´s.
I´m using A7.06pro

Tom
Posted By: tivi

Re: Dynamic Light - 11/03/07 08:18

really no one with the same problem? I still have no solution and no workaround. I saved the terrain as mdl and used a detailmap shader, the lightning problem is the same.
Posted By: Nems

Re: Dynamic Light - 11/03/07 08:59

Try my.light = on; before the lightrange declaration,just wondering if it needs to be activated to get a consistent light effect without the switching happening on you.

Mind you, dont know your syntax arangment my->, I'm more used to my_lightred and so on like this;

my.lightred = 70;
my.lightgreen = 20;
my.lightblue = 70;
Posted By: tivi

Re: Dynamic Light - 11/03/07 11:37

I´m using lite_C so it should be: set(my,LIGHT); right?
my.lightred... leads to an error ( lightred is not a member of ENTITY )
I´m coming from C++, so I´m always writing my->... for pointers, but I changed this for testing, with no luck.
Thank you for trying to help me and sorry for my bad english.

Tom
Posted By: alienheretic

Re: Dynamic Light - 03/03/08 05:49

i had a simillar problem also placing a solid sky bok around the level seemed to fix it
Posted By: DarkWhoppy_

Re: Dynamic Light - 03/07/08 03:43

I am having the same problem... The light fades on and off... Without turning it on/off by code. I think it's a bug... I can't get it to stop doing it.

BTW... It is the ONLY light in the scene... A7.07 Extra Edition
Posted By: tindust

Re: Dynamic Light - 03/07/08 04:28

Looks to me as if the problem might be with the while loop. It allows the frame 41 to be used when it does not exist. It should be:

Code:
{		my->frame += 1*time_step;
if(my->frame >= 41) my->frame -= 40;
wait(1);
}



or:

Code:
{		my->frame += 1*time_step;
my->frame %= 41;
wait(1);
}



at least that's how to use the modulo operator in c-script

cheers

edit: Also wonder why you want to tie the frame number to time_step and not the time each frame is shown. It should really be:

Code:
{
my->frame += 1;
my->frame %= 41;
wait(-time_step); // multiply with 0.01 ... 100 to adjust length
wait(1);
}


Posted By: Nems

Re: Dynamic Light - 03/15/08 09:28

Ok, I think its to do with "Creat Meshes" in the build dialog box. I keep this unchecked as I develope with models mostly so Dynamic lights always work for me.
Posted By: alienheretic

Re: Dynamic Light - 04/09/08 23:43

that def fixes issue for me having a solid skybox and uncheck create meshes in build dialog
Posted By: tivi

Re: Dynamic Light - 04/13/08 07:00

Big Thanks!
Switching off "Create Mesh" and using a skybox solves my problem too, but it´s still a bug, isn´t it?
© 2024 lite-C Forums