Flashing / Blinking Material

I’m currently trying to get a flashing / blinking material that I can use for lamps. Since I can’t add Blueprint functions to every lamp in the game (most of them are props used as components in larger BPs), I want the flashing to come from the material itself.

Is that even possible?

How would a randomly flashing (like a neon lamp) material structure look like?

Here is an example of how you could do flickering inside a material:

On the left I use object position to make a “random” value. You could also use the “PerInstanceRandom” node, but that requires that your lamps are all of type InstancedStaticMesh.

I added the value to time and with the time I loop through the flicker texture uv’s on the x axis.

Here is what the flicker texture looks like:

This thingy here is the texture–>

25592-flicker00.jpg

(Yeah, you have to squint your eyes to see it :P)

It’s a small texture, 1 pixel on the x axis and 64 on the y. You could make the y axis as long as you wish.

So it’s using time to get a value from the texture. This way the artist can control the way it flickers.

The lerp in the end is splitting the data so you have control over how everything looks when the light is off (A) or on (B).

[Here you can download the complete package!][3]

1 Like

Thank you very much, this works wonderfully.
There is only one more thing I would like to know. The material does not light the scene at all. Are there any settings that make the material actually light the scene when it’s lit?

Since you want it to dynamically light the scene, because there is flickering, you could try a light propagation volume and in the material there is a setting “Dynamic Area Light, this makes sure the material gets injected into the light propagation volume texxture”. The problem is, if the mesh with the material is small, like most lights, it won’t be picked up by the light propagation volume.

The other problem is that light propagation is not entirely real time, so the flickering won’t be picked up any way.

All these reasons together is why most people choose to make a flickering effect in blueprint, since you can just pass the value to the material, while toggling a light.

I will take a look in the afternoon if there is a solution that fit’s with your needs.

I fixed it by using light functions, and it all works fine, enjoy! Please mark the answer as resolved if you like it :slight_smile:

Thanks, this works beautifully!

This is the easiest and most efficient way I have found. Credit goes to someone else on the forums here, I only “adapted” the second slower version. I know it’s late, but anyone else who scrolls through this may find it useful.


3 Likes

Thank you! Your answer is the simplest and most effective. I had forgotten about the sine math function. There is also “cosine”, which seems like it cycles form -1 to 1, and sine seems to be from 0 to 1. It has been a while since I had created strobing light materials.

I’ve taken BubbaBonkers’ answer and modified it, to allow for non-black emissive strobing (using “strobe_min” connected to a clamp). There are also other modifiers, like “emissive_max”, to push the base color past its normal emissive range.

1 Like

Worked perfectly and so simple! Thank you!