UDK – Simple Light Flicker Tutorial

LightFlickerCoverOverview:

Level: Intermediate

Assumes you know the basics of UDK level development, kismet and matinee.
 

I’ve had a few students who have wanted to create horror styled levels and one thing they have trouble with is creating fire or a flashlight that flickers realistically. None of them really knew about using Matinee to control a lot of actor properties so I decided to create a quick tutorial about using them.

Using Matinee differs from how many of the students did their light flicker, in which they use kismet to turn it on and off. The straight toggle on and off effect looks strange as its has no change over time, its instant fluctuation makes the light feel artificial or mechanical rather than a malfunction or like natural fire.

Setting up the scene:

This flicker will focus on changing a lights brightness rather than creating and using a light function as that’s a bit more complicated then I want to get in this tutorial. Setup for the test level is quite fast, we just need to create a new level and select the night preset and add a few objects to the scene for testing. The last thing I do is select the default light in the scene and lower the brightness a fair amount. Although we are in the night preset, our level is still pretty bright and we want to see our fire a bit easier.

LightFlicker_01

Adding in the emitter and light:

Next, we need to add in both a fire emitter and a light for our fire to give off. Any fire emitter will do but the light needs to be a dynamic light. Easiest way to set this up is to select the PointLightToggleable from the Actor Classes tab and drag that into our scene.

LightFlicker_02

I added in P_UDK_TorchFire01 for my emitter and changed my light color to a nice dark orange along with boosting it’s brightness up to 3.

LightFlicker_10

Old Way to Flicker:

Like I said before, a few students created their effect by simply turning the lights on and off via kismet. For the most part this was perfectly fine for their projects and many of them didn’t mind that it wasn’t perfect, they were really excited just to play around with Kismet. But a select few did want it to make it a bit better.

For now, lets make this old kismet driven flicker before we move on to the new one as it can be useful for certain things.

Opening up kismet we want to create 3 nodes, a Level Loaded, Toggle and Delay. As well as our PointLightToggleable as the variable to toggle. As always we right click in open space within Kismet to open a drop down menu and add in nodes, each is listed below.

Events->LevelLoaded

Actions->Toggle->Toggle (Hotkey: T+Left Click)

Actions->Misc->Delay (Hotkey: D+Left Click)

The level loaded will provide the initial start and the toggle and delay will create an infinite loop where the light will turn on and off. Connect them as shown here:

LightFlicker_03

I used a random amount of time by adding in a Random Float variable and hooked that up to the delay. I have mine randomly choosing a time between 0.05 and 0.25 seconds. As you can see from below, the effect isn’t ideal. It might pass for something like a flash light or an interior man made light, but even then it isn’t prefect. The one thing that it does do well is randomness.

A more natural way:

So instead we will now create a new Matinee Node to control the brightness of our light instead of just turning it fully on and off. Using a Matinee Property Track does mean we lose the random effect but the looping matinee looks much better and more natural in the long run.

Creating this Kismet Sequence is even easier than the last, we just need to delete or disconnect the previous sequence so it doesn’t mess with the new one and use the Level Loaded Node.  Next we add in a new Matinee Sequence and double click it to bring up that Matinee.

LightFlicker_04_A

Once opened, we want to create a new Group, naming it “lightflicker”. When we have the group made we want to exit Matinee for a second just to finish doing our setup.

LightFlicker_04

In kismet, add in our PointLightToggleable and connect it to our new “lightflicker” group that has been added to the bottom of our Matinee sequence. This connections lets the Matinee sequence what light to effect. Next, we select our Matinee and check its properties and set it to loop continuously so it never stops flickering.

LightFlicker_05

Now, we can double click and go back into our new Matinee sequence to make the light actually flicker. We do this by right clicking on our group and adding in a New Float Property Track, once you select this it will pop up with all the options that the light has to offer such as radius. For now we want to just select the brightness and hit ok.

LightFlicker_06

To create the change in brightness we add in a few key frames and move them on the timeline to some random places. I like to have the first and last keyframe the exact same so it loops perfectly. Here, I moved the total time down to about a second and added in 7 key frames, 2 at the start and end and 5 randomly placed around for now.

LightFlicker_07

Right clicking on any of these frames we get a menu, one of the options is “Set Value”. Keep the value for the start and end frame the exact same, but the other 5 we can move up and down. I try and keep it subtle, only moving the light up and down by intervals of 1 or 2 at the most. Another trick is to use the curve editor rather than simply putting in numbers by hand.

You have to toggle both the curve button at the top Matinee toolbar as well as the black square on the Brightness Track itself (which turns yellow after selected) to get the curve to show up. After, we can select and move each key frame to raise and lower the brightness a bit easier.

LightFlicker_09

Once we have the keys where we want them we can test it out. I had to play around with it for a minute before I got something I liked.

This was an extremely quick pass for the fire lighting but it worked well enough for this tutorial. In the end it might be best to add in a fill light that stays constant for the fire, and make the track a bit longer to avoid people from seeing any repetition.

Property Float Control Tracks can be really useful for other instances as well, not only for lights. The setup is the same but doing these little polish bits help make a level feel much more alive.

Tips:

  • Subtle is better – Don’t go too overboard with jumping up and down in brightness. Too much can make it look fake or strange too.
  • The Matinee approach can also work for man made lights.
  • Property Tracks can be used for other actors, not just lights. A level in Unreal Tournament 3 used them to create a sand storm effect by increasing the fog density in Matinee.
Categories: Tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *