Download

Randomizing instances of Light Function Material?

Apologies in advance for possibly confusing language, I’m new to this:

I’m trying to make a scene that’s mostly candle-lit, using a Light Function Material for the flicker (just some offset sine waves added to seem random). I want to offset it on a per-instance basis, so all the candles will not flicker in sync. But I’m having trouble figuring out how to do that.

Intuitively I was trying to use the Object Position to make a unique hash to feed the offset. But it seems “GetObjectWorldPosition” is an “undeclared identifier” when the Material Domain is set to “Light Function”? Is there some way to pass that variable in to the material editor? Or how else would one do this?

You can pass a random float from blueprint using Material Parameter Collections on Begin Play. Afaik you can’t get object position from a light function.

1 Like