Random windows and living night windows?

Hi! (I admit, I’m away from my PC with UE, so I’m working at least in my head)

I’d like to ask you two questions:

  • Is there a way to give a merged modular building random windows? Currently I know no better way than assigning to every window a different material instance. I guess it’s not the best way to do it, or is it?

  • I’ve been thinking about “living night windows”. Meaning, they all don’t switch all at once but they randomly switch on/off according to the daytime. I’ve achieved this with Game Maker when I was stuck with it.
    See in the video: Living building video - Vikom - Mod DB
    Maybe it wasn’t performance efficient, I don’t know, GM sucks in 3d, so that prototype didn’t go much further. Still, that result was almost perfect for me.

I’m wondering, what’s the best way to achieve such result in UE4?
My (still quite amateurish) idea is: as in the previous question, windows have different material instances. Let’s say, 200 windows, and 60 material instances overall. The instances would be dynamic and a specific actor would randomly switch their emmissive colour multiplier.
I see a problem in the number of material instances. I think it’s too much instances for development but still not enough to make it look good. If I’m right, if you switch the dynamic material, it affects every occurance of the instance, doesn’t it?

So, I would like to ask you, if there is a way to randomly assign material instances to windows; and if, during runtime, is there an efficient way to change any window’s parameter indepedently on other windows.

I would be very glad for any answer, even one saying that there’s no better way.

It really depends on a lot. This is one mesh? How many materials are applied to it?

In essence, a render target plugged into the emissive.
you can then use whatever you want as the render target including animations/footage perhaps.

I would push the model in blender, set the seams so every window has its own uv, bake a random ID black/white texture, so that you have a random value to use.

You can then create time effects by multiplying this texture to a time node which will essentially randomize a sine to operate differently based on the window.
you can use the same map to offset the brightness by subtracting it or adding it (clamp after).

if you want the lights to flicker you probably just use frac or ceil or an IF to manually isolate whatever value has reached above a certain threshold or a value of 1 to affect the mask (otherwise the lights would just slowly fade on/off).

1 Like

I can think of a few different ways. They all have plusses and minuses.

  1. Make the window transparent, and move “unlit” or “emissive” cards with light in them behind the windows that should be “on”
  2. Use a second UV channel, and map each window to a separate pixel in a texture that determines whether that window is “on” or “off” and then procedurally update the texture (or offset/flipbook it)
  3. Use vertex colors, and update the vertex color channel
  4. Build each window as an instanced static mesh, and use the instance ID in the shader to control each window

Thank you for your answers (and sorry for my slow answer…school exams).
I’ll try your suggestions and make the best out of them.