Home Unreal Engine

Material - Flickering Light on a Mesh

polycounter lvl 7
Offline / Send Message
Utility polycounter lvl 7
Hey guys!
I'm trying to create a flickering light on a mesh in UDK (and believe me, I made sure to trawl the nets; this is a pretty common newbie request), and I can't quite get it. Instead of merely getting it to pulse, I wanted it to mostly be on, then flicker off/on, and back to on again for a while. The math part of this is really hard to nail down - what I'm missing is the ability to get the light to "pause" whilst on, then flicker off and back on again.

Couple references:
[ame="http://www.youtube.com/watch?v=_XBkCkq-eKA"]Flickering lights Experimental - YouTube[/ame] - The one at the beginning is a good example of what I want; a quick flicker while the light mainly stays 'on'.

[ame="http://www.youtube.com/watch?v=CnnGYaqjW-A"]Einstürzende Neubauten Sabrina - YouTube[/ame] - The light right at the beginning is also a good example. Plus it's a kickass video and song.

Also, here is where I'm currently at:
jmIur1ij

I get the light staying on, with some quick pulses. Not ideal, but workable. If anyone's wondering, it's for a fluorescent light bulb mesh. Any help would be SUPER appreciated! You guys rock.

Replies

  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    Put a 'ceil' or 'floor' node after the sine node. This will make it step to the nearest whole number and be more 'flickery'.
  • r4ptur3
    Options
    Offline / Send Message
    r4ptur3 polycounter lvl 10
    another way of thinking about this -- maybe have the whole thing driven by a texture map? just scroll a gradient in one direction -- you can get super precise timing that way :)
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Your adding of sines with different periods is a good idea.
    Suggestions:

    Your main on,vs flicker period should have a ceil as sprunghunt mentions. This will effectively make the sine wave a square wave. On or off only.
    For the flickering behavior try:
    constantClamp[0-1](sin(3/x)*sin(5/(1-x)) (where X is 2*Frac(time * some speed value)) this gives a rather erratic flicker behaviour. The most interesting part of that function is for values between 0 and 2.. hence the multiplication)

    If you take the max of your clamped long period sine, and the lower one, you'll get a flicker with sustained on periods. Depending on the frequency differences you won't always get the same flicker pattern either.
  • Utility
    Options
    Offline / Send Message
    Utility polycounter lvl 7
    Thanks guys! Sprunghunt, I ended up modifying your solution; I put a ceil on the first Sine and a floor on the second. I also Added a +1 to the mix before it went into the Lerp to give it a 'boost' so when it lights up, it has a bit extra emissive glow. It's not perfect, but I like it so far. Vailias, when I have time, I may try your solution :P
Sign In or Register to comment.