Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 7th_zorro), 1,203 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with lights #150593
08/27/07 20:16
08/27/07 20:16
Joined: Jun 2007
Posts: 20
PA
F
FatherGuido Offline OP
Newbie
FatherGuido  Offline OP
Newbie
F

Joined: Jun 2007
Posts: 20
PA

So I have 5 dynamic lights working in the level not including dynamic sun. They are scripted to go on/off relative to player position and depending on time of day. The problem is that all lights seem to behave strangely depending on..
1. Where the player is in the level
2. Rotation of the camera in relation to where the lightsource/surfaces being lit

The level is comprised of all models and sprites except for the invisible skybox which i'm not even sure I need since I use the day/night script by loopix for environment.

Here is my light action code attached to light sources.

action light
{

my.passable = on;
my.transparent = on;

while(1)
{

if(vec_dist(camera.x, my.x)< 6000) // if light entity is within range of camera

{
if((sun_angle.pan > 170)&&(sun_angle.pan < 360)) // and if the sun is over the horizon
{
my.bright = on;
my.ALPHA = 80;
my.LIGHTRED = 195;
my.LIGHTGREEN = 255;
my.LIGHTBLUE = 150;
while (my.LIGHTRANGE < my._l_range) // run this loop until the entity gets to full light range
{
my.LIGHTRANGE = max(0, my.LIGHTRANGE + 15 * time_step); // increase my.LIGHTRANGE (15 = speed)
wait (1);
}

}

if((sun_angle.pan > 20)&&(sun_angle.pan < 180)) // when sun begins to rise
{
my.bright = off;
my.ALPHA = 100;
my.LIGHTRED = 255;
my.LIGHTGREEN = 255;
my.LIGHTBLUE = 150;
while (my.LIGHTRANGE > 0) // run this loop until the entity becomes invisible (LIGHTRANGE = 0)
{
my.LIGHTRANGE = max(0, my.LIGHTRANGE - 15 * time_step); // decrease my.LIGHTRANGE (15 = speed)
wait (1);
}
}
}

else // if light entity is not within range of camera
{
while (my.LIGHTRANGE > 0) // run this loop until the entity becomes invisible (LIGHTRANGE = 0)
{
my.LIGHTRANGE = max(0, my.LIGHTRANGE - 15 * time_step); // decrease my.LIGHTRANGE (15 = speed)
wait (1);
}
}
wait(1);
}
}

Please let me know what I'm doing wrong. Or are the lights supposed to act this way?? Unlit Surfaces Lit surfaces


P4 2.6 ghz 1 gig ram geforce 6600 256 mb GS A7.05 commercial
Re: Problem with lights [Re: FatherGuido] #150594
09/01/07 17:24
09/01/07 17:24
Joined: Jun 2007
Posts: 20
PA
F
FatherGuido Offline OP
Newbie
FatherGuido  Offline OP
Newbie
F

Joined: Jun 2007
Posts: 20
PA
"Me" Hi self, are you still looking for an answer?

"Self" Why yes, yes I am. Do you have an answer?

"Me" No, not yet. Patience my friend, someone will get to you.


P4 2.6 ghz 1 gig ram geforce 6600 256 mb GS A7.05 commercial
Re: Problem with lights [Re: FatherGuido] #150595
09/01/07 18:55
09/01/07 18:55
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Hi, not entirely sure from your post what you think is wrong with the lights except that they "behave strangely". Could you specify in what way they are wrong, i.e do they not come on, too early, too late etc.?

cheers,
tindust


Lighten Your Load With

DynaLights 1.0

Realtime 3D Lighting. Free Trial Version available.

3DGS 660P
Re: Problem with lights [Re: tindust] #150596
09/01/07 20:25
09/01/07 20:25
Joined: Jun 2007
Posts: 20
PA
F
FatherGuido Offline OP
Newbie
FatherGuido  Offline OP
Newbie
F

Joined: Jun 2007
Posts: 20
PA
Well they do come on. However, they only light (some) surfaces. If I pan with the mouse slightly, they light the other surrounding surfaces that they are supposed to. This includes the player himself. Please see the photos. You will notice the player in the same position in both pics. In the first pic (unlit surfaces), The light is actually on but is only lighting some of the surfaces within it's light range. In the second pic(lit surfaces), the view has been rotated very slightly, thus lighting the other surfaces. this is the same with all lights in the level.

Thank you much


P4 2.6 ghz 1 gig ram geforce 6600 256 mb GS A7.05 commercial
Re: Problem with lights [Re: FatherGuido] #150597
09/01/07 21:35
09/01/07 21:35
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
OK. Here is one detail I noticed in your code: Your light action uses the distance to the camera as cue, not the distance to the player model. Since you use the 3rd person view this means that the camera is always located at a distance behind the player model and when you turn, the location of the camera will change which in turn will have an effect on the light intensity of the given light. One solution would be to use the distance from the light to the player model instead of the distance to the camera. This should help for starters.

Re: Problem with lights [Re: tindust] #150598
09/02/07 01:36
09/02/07 01:36
Joined: Jun 2007
Posts: 20
PA
F
FatherGuido Offline OP
Newbie
FatherGuido  Offline OP
Newbie
F

Joined: Jun 2007
Posts: 20
PA
tindust, thanks for the suggestion. However, I tried changing if(vec_dist(camera.x, my.x)< 6000) to if(vec_dist(player.x, my.x)< 6000) and have the same result. Any other suggestions? I must be missing something somewhere!


P4 2.6 ghz 1 gig ram geforce 6600 256 mb GS A7.05 commercial
Re: Problem with lights [Re: FatherGuido] #150599
09/02/07 03:58
09/02/07 03:58
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Well, the pointers for player and for camera are probably the same unless you specify otherwise. So, I would try something like this:

you = ptr_for_name("thewdlnameoftheplayermodel_mdl_012");
if(vec_dist(camera.x, you.x)< 6000)

Re: Problem with lights [Re: tindust] #150600
09/05/07 15:57
09/05/07 15:57
Joined: Jun 2007
Posts: 20
PA
F
FatherGuido Offline OP
Newbie
FatherGuido  Offline OP
Newbie
F

Joined: Jun 2007
Posts: 20
PA
Thanks, no good though. I get the same thing. I deleted every light from the level and started over Placing/Building/Running them one by one. It seems that every time I got to 5 lights I got these errors again. I even disabled the on/off switch and the dynamic increase/decrease of the light. I also noticed that if I create any light in the level higher than 1500 quants above 0 on the z axis I get this as well and it doesn't matter if I have 1, 2, 3 or more lights. I guess we are limited to 4 dynamic lights?


P4 2.6 ghz 1 gig ram geforce 6600 256 mb GS A7.05 commercial
Re: Problem with lights [Re: FatherGuido] #150601
09/05/07 18:54
09/05/07 18:54
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
I have routinely worked with 8 dynamic lights. So there is defitively not a general limit of 4. However, there are other possible limitations, both hardware and software that can limit the number of dynamic lights that can be active at any one time. Your graphics card from what I can see should easily handle 8, but I'm not sure if the Commercial 3DGS7 is has a limitation as to how many dynamic lights that can be handled by the engine. Also, your default engine setting might be 4 lights. You can make sure that 8 light are allowed by adding the code:

max_lights = 8;

somewhere in your startup code.

Also, you might already have tried this, but make sure each light has its own action that controls its dynamic behavior. I never trust the WED settings only to handle dynamic lights. I might be wrong on this, but I always give each dynamic light its own action.

You mention a z limit position to get normal light behavior. This seems really odd. Not sure what to make of that. Do you have a geometry box around your World? That might help to get beyond that limit.

All in all there seems to be more than one problem issue going on here.

These are just a few suggestions, I hope they will help...

edit: just thought of another thing ... try turning off the sun while working with other lights. Done be adding the code:

sun_light = 0;

Last edited by tindust; 09/05/07 19:00.

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1