• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Level Design Need help with Advanced Lighting

Colonel Panic

Grizzled Veteran
Jul 5, 2009
313
5
I've been poking around the web looking for tutorials and stuff, but it seems only info on the basics that I'm mostly familiar with is readily available. I need more info on how the different types of lighting and projectors work, so I can tailor my map to use them to the best effect. The map I'm working on is intended to use darkness as a major part of the environmental feel and difficulty... no, it's not a Doom 3 map.

Anyway, from what I've learned so far in trying various things... staticmeshes do not cast shadows on other staticmeshes or themselves when hit with static light, so, essentially, if you light one side of a staticmesh, such as, for example, a KFDoorMover, the other side will also be lit, even if the other side of the door is supposed to be in complete darkness. If using dynamic lights, they ignore and pass through everything, including both staticmeshes and BSP, so those are out... I've tried toying with the headlightprojector, but it seems to also cast light through a KFDoorMover the same way static lights do.

What I don't really understand is why it blocks light from illuminating BSP surfaces, but not from illuminating actors.

Attached are some screenshots that illustrate the probem. One of them is the closed door from the dark hallway (the other side of the door and frame (staticmeshes) are lit with dim red lights), The other two are me facing down the dark hallway with the door directly behind me. One of them is with the door open, and the other is with the door closed. Can you tell which?

Now that I've defined the problem, I need to know... what's the solution? Is there a way to fix the lighting so this doesn't happen? are there workarounds I can employ, such as embedding a light blocking volume in a DoorMover, etc? even a way for me to simulate the effect such as having a light that turns on when triggered by the KFUseTrigger of the door would be sufficient for letting the light through when it's open I suppose, but I need to have a way to block the light when it's closed.
 

Attachments

  • Shot00011.jpg
    Shot00011.jpg
    19.2 KB · Views: 0
  • Shot00014.jpg
    Shot00014.jpg
    17 KB · Views: 0
  • Shot00015.jpg
    Shot00015.jpg
    16.1 KB · Views: 0
Anyway, from what I've learned so far in trying various things... staticmeshes do not cast shadows on other staticmeshes or themselves when hit with static light
Of course they cast shadows on other StaticMeshes! To be honest I heard this "they don't cast shadows on themselves" thing too so I wasn't 100% sure on this but I just did a quick test and they do. It just isn't very precise because StaticMeshes are lit per vertex and not via lightmap so "shadows" don't look much like shadows in most cases. But they are there. At least in the capacity that a door which is only lit from one side will be completely black on the other!

Unless it's a 2d sheet, which shares its frontside vertices with its backside. Or you did something really weird with smoothing groups in a 3d modeling program.

If using dynamic lights, they ignore and pass through everything, including both staticmeshes and BSP, so those are out...
They aren't meant to be used as regular lights like in some newer engines! Light in the UnrealEngine 2 is static as it has to be rendered. BSP surfaces have to have their lightmaps calculated and saved and StaticMeshes their vertices. When you add new lights in the editor you only get a rough preview of what they are going to look like when they are rendered! This preview doesn't cast shadows from a staticmesh on itself or on another staticmesh. The rebuilt light will!

Is it possible you just didn't Rebuild Lighting?

EDIT:
I checked the map. Your problem isn't a limitation with the way StaticMeshes receive lighting, per se!

The reason why the door isn't lit on the red-light side is because its only vertices on that side are buried in your warning-stripes trim. They are the only points on this side of the door that can receive light-information but they are inside solid matter. Can't work. As a test, try moving it towards the red-light room until it sticks out of the warning-stripes border and rebuild lighting. It'll be red on the right now and dark on the other.

The reason the other side of the door isn't completely black but gray is that for some reason the engine thinks it's in another zone, namely the one with the ambientlight of 1. Ambient lighting counts double for StaticMeshes (that's a bug) so it's lit by 2, which is enough to make it appear brighter than completely black.
END-EDIT




Truly dynamic lights (i.e. ones that cast shadows) were too expensive back in the day.
The watered down pseudo dynamic lights we have were still implemented though because they aren't completely worthless, if used right.

Dynamic lights are meant for decorative purposes only! E.g. you have a lamp that flickers a bit, so you give it a normal light, which casts shadows and all and you make it look as if the lamp was on, except maybe a tiny bit darker. Then you add a smaller and darker dynamic light that flickers so the scene looks a bit more dynamic. And this isn't meant to be done with every lamp in the map either. Just in special places where you want that special effect. And if you have a place planned where you might want to do this, make sure it isn't too close to other rooms so light shining through walls won't pose a problem.
Also, they should never be used to light things on their own! Not only because they aren't meant for this and it will most likely look bad, but also because people can turn off dynamic lights in the menu and if a map uses them as the only source of the light the map wil be pitch-black for everyone who disabled dynamic lights.
Use them sparingly and with care.

Situations that require dynamic shadows aren't done with dynamic lights but with projectors. Dynamic lights, in these cases, if used at all, are only additional decoration. "Shadows" are projected with a projector, which can be moved or animated. E.g. if you have a dramatic scene with light shining through a fan. The turning shadow of the fan is made with a projector and the moving lightbeams are made with moving staticmeshes with translucent textures on them and if the light behind the fan isn't centered and you want a subtle change in brightness whenever the fan obscures the light a little more this is done with a subtle pulsing dynamic light.

I've tried toying with the headlightprojector, but it seems to also cast light through a KFDoorMover the same way static lights do.
It doesn't case light at all. It projects an image. And it projects it on everything within its radius and FOV unless otherwise specified.

Attached are some screenshots that illustrate the probem. One of them is the closed door from the dark hallway (the other side of the door and frame (staticmeshes) are lit with dim red lights),

The other two are me facing down the dark hallway with the door directly behind me. One of them is with the door open, and the other is with the door closed. Can you tell which?
Of course not because lights (and thus shadows) are static in this engine! For me to notice a change you would have to fake either the light when the door opens or the shadow when it's closed. Both can be done with a projector.


even a way for me to simulate the effect such as having a light that turns on when triggered by the KFUseTrigger of the door would be sufficient
Light that can be turned on or off must be dynamic and dynamic lights do not cast shadows. They aren't meant to be used in situations like this. They are meant for a button you press and then it starts blinking red or something. Not for something as complex as this.

You'll have to use a dynamic projector which you are going to attach to the bottom of the door. When it opens it'll "illuminate" the hallway behind the door.
Here is roughly how you have to set it up:
projector.jpg


Here is how projectors work:
http://udn.epicgames.com/Two/ProjectorsTutorial.html
You'll have to use a "DynamicProjector" instead so you can attach it to the mover.
Here is how to attach things to movers:
http://wiki.beyondunreal.com/Legacy:Attaching_Actors

Beyond that it's all about toying with the FOV and rotation of the projector and of course tweaking the projected textures until it looks about right.

I recommend using some sort of trim around the door so you have a little margin of error and the brightness of the light in the one room and the fake light from the projector in the other room don't have to match up exactly.

EDIT:
Seams are visible in skybox--Status: looking for cause of the problem
This is because you let your textures Wrap instead of making them them Clamp. Open the texture browser and navigate to the sky textures. Open their properties, go to textures and where it says TC_Wrap change it to TC_Clamp (don't do this if they in an official package! If they are, export them and then import them to your own package or myLevel and do it there!).
The advantage is that you won't see seams anymore when you're done. The drawback is that the textures clamp. This makes them appear weirdly stretched out. In the link below there is an example pic of a stretched out texture and below the guy explains how to fix it so it looks normal:
http://www.unrealplayground.com/forums/showpost.php?p=416795&postcount=10
It seems like an awfully long way to go to get rid of seams in the skybox, but it's not that bad and it's probably worth it.
One more thing: If no matter how hard you try and no matter how closely you follow the instructions in the link above you can't get rid of the stretching it's because of bsp-cuts. You won't see these cuts, but they are there and they mess with clamped textures for some reason. If you move the skybox away from the map it won't get cut up internally with BSP-cuts and this could help.
If you need more help with this, post and I'll walk you through it in more detail.
 
Last edited:
Upvote 0
Thank you very much, Murphy! that was a very enlightening post.

Since that version of the map I had posted, I have changed the doors a bit. I replaced the BSP door frame with a grooved staticmesh that encompasses the center of the door, while the rest of the door sits outside the frame, which is what you see in that pic I posted.. It works to recieve light as you suggested, though what still puzzles me is why the dark side of the door frame is lit as brightly as the light side. The door sits flush to the BSP, so there should be no light on the other side of the door if what you're suggesting about staticmeshes casting shadows on themselves is true. I don't know if it's a bug, an error, or what, but I'm thoroughly confounded. It looks a lot brighter than an ambientlight of 2 issue, but either way, is there some way for me to fix the zoning issue? Is this what's illuminating the zeds down the hallway too? basically, how can I fix the light being where it shouldn't? the entire lower zone seems to be riddled with bits and pieces of ambient light here and there, which illuminates only meshes/actors and not BSP. Is this something that can be fixed? or do I just have to deal with it?

I really like your diagram for the projectors. I was reading up on them some this afternoon after finding this tutorial and had an idea of trying something like that, though I wouldn't have known how exactly to pull it off if it wasn't for your input. I think I'm going to enjoy abusing the projectors once I have them all figured out, as it seems they're pretty much the one true answer to most of the effects I want to be doing with lights.

Is there a way to connect a use trigger to a projector as a toggle? It would be neat if I could have a button on the wall to push to turn on and off the flood light. It would also be cool if I could employ that rotating caution light in the tutorial as something that came on while the door is moving, hook it into the KFUseTrigger on a timer or something.
 
Upvote 0
Hmm... well, I looked into it a bit, but after playing around with a projector for the door idea, I'm running into a few problems... first, there doesn't seem to be a way to adjust the horizontal and vertical FOV independently, and secondly, since it only projects square textures, this means there's no way to cast the projection in a flat line across the doorway and not have it light up a rediculous 180 -degree area including both sides of the door. I can kinda get around this by using multiple projectors and some fancy trig...

However, there's also the issue that, since the projector only casts a texture and not a light, casting it in darkness has no effect on lighting up the intended meshes--they're still in complete darkness, so you can't see the white texture, if that makes sense... and using a black texture to create shadows also blocks your flashlight from illuminating BSP, and even creates a black spot in your vision over the flashlight cornea. I tried setting it to projectbsp false and projectalpha false, but it didn't do anything.

maybe I'm missing something, but there doesn't look to be a solution to this after all...
 
Last edited:
Upvote 0
Set the texture in the projector to brighten instead of none or alpha. It's somewhere in the projector properties. Can't check atm. If it's set to none or alpha it's just projected and then it's as bright as it would be if it was lit there. If you set it to brighten it'll add its own brightness to that.

I found it, it's the Projector>FrameBufferBlendingOP needs to be set to PB_Add. Still doesn't illuminate textures, but in sufficiently subtle amounts it gives me the effect I'm looking for... and by subtle I mean like 3% visibility of red on black. It casts some interesting artifacts outside of its projection area, but the effect is acceptable for my application. Thanks again!
 
Upvote 0