It’s been a while since I’ve worked on this scene, so I thought I’d ease back in by playing around with materials again!
When the big machine in the roof of my scene turns on, I wanted to turn on a bunch of lights.
Here it is!
I’m doing this with a mix of actual lights, and an animated dynamic material.
Each piece of the geometry that is lit has vertex colour data on it, and the vertex colour is used to offset the flickering (which I’ll explain a bit later).
Here’s what the vertex colours look like (I’m only using the red channel at the moment, but I might use green and blue for other data later when I want to damage the lights):
And here’s the material:
The stuff outside of the “Flicker” group is just regular Normals, Roughness, Metalicity, etc.
I’m not using a separate emissive texture, I’m just masking the parts of the Albedo that are glowy, and using those in the material emissive slot. The mask is stored in the Albedo alpha channel.
Now, for the flickering part…
I’m using a texture to determine the brightness of the flicker, each pixel representing a different light intensity at a different point in time (I stretched the image to make it obvious, but it’s actually a 256 * 1 texture):
The vertex colour, that I mentioned before, is the offset into the above texture. So each light has a different offset into the flicker pattern, so they all go through the same cycle, but they start at different points in the texture.
There are parameters for the strength of the flicker, minimum and maximum emissive strength, etc.
These parameters are controlled by a dynamic material instance, so that I can play with their values in the RoofMachine blueprint, like so:
And, finally, I just set up some curves to control these parameters over the “power up” phase, which I just played around with until I was reasonably happy:
And that’s about it!
I’ve also done a little tweaking of the lighting, etc, and although it’s a bit too gloomy at the moment, it hides my nasty wall material that currently looks like cheese 🙂