Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsJedi Knight and Mysteries of the Sith Editing Forum → Dynamic Lights
Dynamic Lights
2005-06-30, 7:21 PM #1
Is there any way to stop the effect of a dynamic light from crossing an adjoin? I have a dynamic light in a corridor. When you open the door, the room ahead is lit with the light from the corridor. WHen the door closes behind you, the light disappears. Very distracting and looks crappy.

Any help?
BSR
2005-06-30, 7:53 PM #2
I recently posted *another* thread about dynamic lights (just a few below yours), but it probably doesn't have all of the information you need. So'll just quote a PM I sent in response to another Massassian about Dls, to save me typing out a bundle again ;) :


Quote:
Hi,

I'm glad you decided to ask me about DLs, since they are currently my favorite method of lighting JK levels. I assume you read my thread on the Editing forum - http://forums.massassi.net/vb/showt...;threadid=33618 ? Well, that is an idea I have for Dynamic Lights, but it may not work.

Depending on your level, you could light it with GBK's flicker cog (posted down below), but you seem to be limited to under 30 DLs using this method. If you go over this limit, DLs start shutting off. You said you understand the fundamentals, so I won't go into great detail unless you specify, but I will say that their seems to be no currently known way of giving DLs both range and intensity attributes. If you go to Sige's thread ( http://forums.massassi.net/vb/showt...;threadid=30544 ), you'll see the formula he worked out for how DLs generate light.

JK's default DL templates (that I know of) are 0.0, 0.1, 0.7, 1.0, and 3.0. You can also add the "EXTRA LIGHT" value to 3dos, effectively turning them into lights themselves. I apologize if you already know this.

I assume you are having trouble with DLs flickering? In that case, use this modified version of GBK's DL flicker control cog, which I used in my "Basilica" JKA level (which is still being worked on):

Code:
# "Ode to Suzanne"
#
# Dynamic lighting controller
#
# 12/2002 - 07/2004 gbk
Flags=0x240
Symbols
	Message	Startup
	Message	Newplayer
	Message	Pulse
	Thing	Ghost0 #Position for each light.
	Thing	Ghost1
	Thing	Ghost2
	Thing	Ghost3
	Thing	Ghost4
	Thing	Ghost5
	Thing	Ghost6
	Thing	Ghost7
	Thing	Ghost8
	Thing	Ghost9
	Int	Used	#number of used lights. (ID of last used)
	Template	L	#Actual light template, eg. "Light1.0"
	Thing	LL0=-1		Local
	Thing	LL1=-1		Local
	Thing	LL2=-1		Local
	Thing	LL3=-1		Local
	Thing	LL4=-1		Local
	Thing	LL5=-1		Local
	Thing	LL6=-1		Local
	Thing	LL7=-1		Local
	Thing	LL8=-1		Local
	Thing	LL9=-1		Local
	Thing	Player		Local
	Sector	Player_sec	Local
	Flex	Rate=0.1	#Rate of replacement.
	Int	I=0		Local
End
Code
	Startup:
		Player = jkGetLocalPlayer();
		SetPulse(Rate);
	Stop;
	Newplayer:
		Player = Getsenderref();
		Setpulse(Rate);
	Stop;
	Pulse:
		Player_sec = Getthingsector(Player);
		For(I=0;I<=Used;I=I+1)
		{
			If(LL0 != -1)
				Destroything(LL0);
			LL0 = Createthingatpos(L, Player_sec, Getthingpos(Ghost0), '0 0 0');
			If(LL0 == -1)
				Print("Light creation failure!");
		}
	Stop;
End


Ask me if you need any help setting it up, or even download GBK's Ode to Suzanne level off of Massassi or my own BETA of Basilica from the JK Hub.

Feel free to ask me any more questions, I only briefly described what I know about DLs and how they affect their environment here. Friend14 (CaptBevvil) is the true expert in this field however.


Here's another followup message with some more info about custom DLs, just in case you were wondering:

Quote:
In response to DLs, if you're worried about range, you DON'T have to use the JK defaults. You can create your own light templates. I aplologize for not specifying this earlier, I wasn't sure if it was necessary.

If you want to make a light template, simply take this light template for Light 1.0:

Code:
# DESC: Dynamic Light 1.0
# BBOX: 0 0 0 0 0 0
light1.0          _ghostdecor        thingflags=0x1 light=1.000000



And copy and paste this to the bottom of your master.tpl, changing the values to whatever you desire. Here is an example of a new light template below:

Code:
# DESC: Dynamic Light 9.5
# BBOX: 0 0 0 0 0 0
light9.5          _ghostdecor        thingflags=0x1 light=9.500000



It's that easy. Then simply select this new template in the F7 cog window for your light cog, and Voila! All of the lights for that specific cog will be generated with this light value.


Hope this helps. The cog might not be self-explanatory (it wasn't for me) so post back if you need any help with that.

I'm a little bit worried though, because unless you can find a way around the 30 limit, you'll have a tough time lighting your Massive Star Trek level. :-/

I think Friend14 might know a way around this, but I haven't talked to him in ages. With any luck, he (or CaptBevvil) will post in this thread.
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-06-30, 8:09 PM #3
If your using the LEC door cogs, remember that they unadjoin sector the door is in.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-06-30, 11:53 PM #4
Couldn't you use the RVTCS (you know, the cog that controls the creation of things based on range/sectors) to work around the 30 dynamic lights limit?
I don't think you can stop anything in range of a light to be lit. Maybe try the "Blocks light" flag, might help.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-01, 12:01 AM #5
Quote:
Originally posted by BSR
I have a dynamic light in a corridor. When you open the door, the room ahead is lit with the light from the corridor. WHen the door closes behind you, the light disappears. Very distracting and looks crappy.

I'm confused - what exactly is happening? You have a light in a corridor, check. You open the door and the light floods in. You walk into the room, the door closes and the light dissapears, being blocked by the door. How is this a problem? I experienced something like this years ago in a level of mine and thought it was a fantastic effect - unfortunately it may look crappy in your level. In mine, a door opened to the outside which was dynamically lit and the light flooded in when the door was open.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2005-07-01, 12:34 AM #6
Normally it wouldn't be that bad. But the light "floods in" unrealistically. It lights up walls that aren't facing the light.
BSR
2005-07-01, 12:44 AM #7
I believe there are thing and adjoin flags for blocks light. I would try cleaving adjoins in the direction of the light flow (like cleave the shape of the shadow) and have those adjoins set to blocks light. Hopefully it would make it flow in realistically. But I recall that you use a lot of 3DOs, and your entire level may be made of 3DOs, in which case you could make fake adjoins with 3DOs using transparent MATs or geo of 0 and flag said fake adjoins with blocks light.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2005-07-01, 12:47 AM #8
Hmm....the block light flag seems to only work with vertice lighting. I'll give it another shot.
BSR
2005-07-01, 12:49 AM #9
Yeah, it could be a JED-only flag. It is not by chance pretty high? Like 0x80000000 or something?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-01, 12:54 AM #10
Yeah, something like that.
BSR
2005-07-01, 2:31 AM #11
Then I'm pretty sure it's a JED-only flag. That means it won't work ingame.
The only way to get rid of the sudden change would be to remove the sector adjoin/unadjoin commands from the door cog. But that might lead to framerate problems.
It's a general problem with dynamic lights, that their illumination is not blocked by sector architecture. Just play around with intensity values, until the unwantedly affected surfaces are out of range.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-01, 9:08 AM #12
Hmmm, I have an idea. Perhaps you could post a JED wireframe of your door and the sectors/3DOs around it?
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-07-01, 9:51 AM #13
[http://www.massassi.net/ec/images/16155.jpg]

The purple highlighted area is the corridor, which contains two dynamic lights. One has a range of 0.25 and the other, nearest the doorway, is 0.7.

The yellow highlighted area is the room you access from the problematic doorway. When you open the door, the light spills inside, but in an unrealistic way and causes the problematic wall to light up almost full-bright.

I am considering using a smaller-ranged dynamic light in place of the 0.7 ranged one.

Anyway, my reason for posting this thread was to discover a way to stop the effects of the dynamic light from crossing the adjoins that make up the doorway. This works when the door is closed, due to the door sector's surfaces being unadjoined by the door cog. I want to somehow cause the same effect, but when the door is open and the adjoins are still there. I realize this may be an impossibility, but I figured someone else may of had a workaround.
BSR
2005-07-01, 10:00 AM #14
I have had a similar problem in my level, where a dynamic light seems to stream through the floor of my upper level, and appear through the ceiling in my lower level. Zagibu is right, JK ignores the "blocks light" flag on Sector Architecture. However, I don't think it ignores this flag on a 3do.

You seem to have some space between that corridor and the prblematic wall. Perhaps you could place a very long, thin rectangular sector there, and place a wall 3DO with the blocks light flags inside that sector to prevent the DLs flooding from the corridor into the other room. It might not work or be very efficient, but it is just an idea which might be worth trying.
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-07-01, 11:17 AM #15
Quote:
Originally posted by BSR
The yellow highlighted area is the room you access from the problematic doorway. When you open the door, the light spills inside, but in an unrealistic way and causes the problematic wall to light up almost full-bright.


Give that door a special version of the door cog with the code to reduce the EXTRA LIGHT value of the problem wall while the door is open and the revert it back after the door closes. If you play with the negative light value enough, it should be pretty unnoticable. :cool:
"The solution is simple."
2005-07-01, 1:56 PM #16
It might be possible to automate this too, using the GetSurfaceVertexPos verbs and figuring out the average light value of the surface and subtracting that from the surface extra light value temporarily. Can't get it perfect though, because the surface is lit per vertex, while the surface's extra light value is for the entire surface.
Air Master 3D (my iPhone game)
My Programming Website
2005-07-01, 2:20 PM #17
Ah, I just noticed that you are doing these levels for MotS, and MotS (as far as I know) does let you set the lighting values for individual vertices, and so a cog could be made that would calculate the lighting at each vertex due to your light and while the door is open make it so that the surface does not appear to receive any light from it.

I haven't tested this under MotS, but in JK the light value for a level surface vertex due to a dynamic light can be found using this equation:
(1 - distance_from_light / (light_intensity * 1.25)) * light_intensity

If MotS uses the same method to determine light contribution from a dynamic light, then you could probably also use this with colored lights, you just have to evaluate the equation for each color component, ie do it for light_intensity_red, light_intensity_green, ... and also for the normal light intensity, if you plan on supporting software lighting I guess.
Air Master 3D (my iPhone game)
My Programming Website

↑ Up to the top!