- Home /
Dynamic Ambient Light 'Flicker' Effect | Example/Custom Images Inc.
Forewarning: This is not a request for you to go out of your way to make it. Looking for any possible external examples, suggestions in achieving this, or store assets. That said, I am a relatively novice programmer so any help is more than appreciated. Thank you for your time.
Hello everyone, today I'm looking to achieve something I've seen little to nothing about. The ambient light 'flicker' effect, that you might've seen in triple-A titles over the years. (Hand-recorded example below.) The reference is not to the lights themselves, but the light yet rather atmospheric ambient flicker effect you can see around the edges of the light and where it fades. The effect rather subtle, yet all but unnoticeable.
How to achieve this however, I'm not entirely sure. As you can see, each light has it's own offset. (They don't match in pattern.) This effect also seems to be relatively random, though it very hard to tell given it's subtleness. Clearly you can not just use a standard flicker effect, that would only turn the light itself on/off and is not what we're looking for.
My only other solution is to have a second light, that stretches slightly further out; that has such a standard on/off flicker effect. This would be extremely expensive to render though, as you would need at least two of every light in the scene. Utilizing resources that are otherwise not available, especially the mobile platform we are targeting. (iOS to be exact.) I would love nothing more to hear all of your inputs though, I'm sure there's a relatively easy way of doing this that I'm unaware of; as per-usual.
Credit: Starbound from Chucklefish shown above. Include: Another picture for reference, not recorded by myself.
Answer by blueLED · Nov 12, 2014 at 04:03 AM
One way to achieve this effect:
Select a point light in your scene, then go Window -> Animation. Click "Add Curve" and save your animation as "lightPulse" or something like that.
Then click "Add Curve" again and click the Light dropdown to show the properties you can animate.
The ones you are interested in are "Light.Range" and "Light.Intensity". Move to about 2 sec on the timeline and set your keyframe with the value you want, and repeat to make it look natural or random like. You may also want to go to the Curves view (button next to Dopesheet) and then right-click on the nodes and set them to "Flat". This will make the transitions/tweening smoother.
The animation will play automatically in a loop now when you run the game.
You could make more lights with their own varied animations so they're not all pulsing in sync.
Of course you could write a script and Lerp these value changes and set some random ranges within that script.
Hope that helped. Oh, and I'm not sure why you referred to them as "ambient" light, I believe they're just point lights.
Thanks a lot, yeah. This is presumably the best way to handle it. Also, I referred to it as ambient light as we were trying to achieve the flickered 'ambience' at the edge of the lights, not the simple point light torches themselves. Thanks again!
Answer by idurvesh · Nov 12, 2014 at 05:04 AM
The effect is called Vignetting .
If you are using Unity Pro then you can easily achieve it by importing Image effects comes up with unity
Assets > Import Package > Image Effects (Pro Only)
Then on main Camera add the component "Vignetting and Chromatic Aberration" Component > Image effects > Camera > Vignetting and Chromatic Aberration
and play with it.
Main property is "Vignetting"
A Vignette just creates an overall dark, blurred border.
It would add to the atmosphere, so still a good suggestion.
I have not tested it yet.You may try to change "Vignette$$anonymous$$ask.png" img in asset folder with the shape you desire.You may get that effect.
Your answer
Follow this Question
Related Questions
Why do 2D Lights render past shadowcasters. 1 Answer
How to make a light flicker 5 Answers
Flickering Deferred Lighting 0 Answers
Trying to make light pass through object 0 Answers
How do I adjust the lightmap parameters for objects in Unity 2018? 1 Answer