Git Product home page Git Product logo

lightflicker's Introduction

Unity Light Flicker

A component to make Unity's Light component flicker by a sequence of alphabets. This way of implementing flickering lights is inspired by Valve, which is used in their games like Quake and Half-Life series.

โš ๏ธ PHOTOSENSITIVE WARNING: This document may contain animated GIFs with flashing images and are hidden by default. Click on the foldouts to reveal the original image.

(Click to show) Select from 12 presets, or type in custom patterns, and preview the changes in realtime.

Installation

  1. Download the full repository.
  2. You can try out the test scene under the Test folder to see how it works.

Usage

  1. Add LightFlicker to an existing Light component.
  2. Click on the Preview Pattern to see the flicker pattern in action in Edit Mode. A preview Animation Curve and a timeline cursor will help visualize the change of the light intensity in a graph.
  3. Select the flicker pattern from a group for presets or type in a custom pattern.
  4. The pattern defines how the light intensity will change in sequence using alphabets a to z, from lowest (a being 0% brightness) to highest (z being 200% brightness).
  5. Define the Normal Brightness, the light intensity at 100% brightness, or when the flicker pattern reaches the m letter.
  • Note that this will override the Intensity field on the original Light component.
  1. Define the Pattern Duration and toggle the Lerp option (linear interpolation, i.e. whether the light intensity will change smoothly or not).
  2. Some public properties are exposed so settings can be changed by other scripts, see the section below.

Public Properties

Property Name Type Description
Pattern string The pattern of the Light component's intensity using alphabets between a to z, with a being 0%, m being 100%, and z being 200% intensity of the NormalBrightness.
PresetPattern LightFlickerUtility.Preset
(Custom type)
Set the pattern from a selected collection of presets referenced from Valve's games. See the section below for the full list of available presets.
NormalBrightness float The light intensity at 100% brightness.
Note: This will override the Light component's intensensity value.

Speed Settings

Property Name Type Description
PatternDuration float The duration for the pattern to iterate once.
Lerp bool Whether the light intensity should change smoothly using linear interpolation (lerp).

LightFlickerUtility.Preset Enumerations

Here are all 15 presets available to quickly achieve flickering lights. You may add your own presets under the file Utility/LightFlickerUtility.cs.

None

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.None
Actual Sequence a

Normal

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.Normal
Actual Sequence m

Double Brightness

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.DoubleBrightness
Actual Sequence z

Fluorescent Flicker

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.FluorescentFlicker
Actual Sequence mmamammmmammamamaaamammma

Slow Strobe

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.SlowStrobe
Actual Sequence aaaaaaaazzzzzzzz

Gentle Pulse

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.GentlePulse
Actual Sequence jklmnopqrstuvwxyzyxwvutsrqponmlkj

Slow Strong Pulse

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.SlowStrongPulse
Actual Sequence abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba

Slow Pulse Not Fade To Black

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.SlowPulseNotFadeToBlack
Actual Sequence abcdefghijklmnopqrrqponmlkjihgfedcba

Fast Strobe

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.FastStrobe
Actual Sequence mamamamamama

Underwater Light Mutation

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.UnderwaterLightMutation
Actual Sequence mmnnmmnnnmmnn

Candle (First Variety)

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.Candle1
Actual Sequence mmmmmaaaaammmmmaaaaaabcdefgabcdefg

Candle (Second Variety)

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.Candle2
Actual Sequence mmmaaaabcdefgmmmmaaaammmaamm

Candle (Third Variety)

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.Candle3
Actual Sequence mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa

Flicker (First Variety)

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.Flicker1
Actual Sequence mmnmmommommnonmmonqnmmo

Flicker (Second Variety)

Preview
Click to show
Preset Enum LightFlickerUtility.Preset.Flicker2
Actual Sequence nmonqnmomnmomomnon

References

lightflicker's People

Contributors

huchi57 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.