Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Light Controller

Discussion in 'Works In Progress - Archive' started by andrewkausy, Nov 6, 2018.

Thread Status:
Not open for further replies.
  1. andrewkausy

    andrewkausy

    Joined:
    Feb 15, 2018
    Posts:
    1
    Welcome! The light controller is an in depth light effect creator, that I have designed with both coders and non-coders in mind.


    Features: Full control of lights’ intensity, light color, emission color, range, spotlight angle, and audio assignment through a variety of ways, including, animation curves, gradients, lists, and numerical values with variations of each that are for random values rather than defined ones.


    Uses Scriptable Objects as the data containers for the effects so you can do your editing at runtime


    Includes a way to stage all of your effects, meaning that you can set them up to fire when you want, in the order that you want, and how every many times you want.


    The stager is scripter friendly but requires no scripting to use. It allows you to plug in your own methods that will tell the stager when it should advance and will give you access to some of it’s data as a parameter in the method.


    Easy to add and customize audio to a light—can scale volume base on the audio.


    Can generate light from an attached audio file—meaning if you have a light sound effect—you can plug it in and the controller will do all the work of matching it to a light effect for you.



    This is an intensity control option. There are a total of five properties that can be simutaniously updated, and there is also five different generation modes—curve, double curve (random between), constant, between two constants, and list. List is an array of values that can be randomized or defined. You can also customize each property chosen in case you don’t want them to be completely alike. Material intensity actually scales the emission based off the curve, meaning it gives the effect of the light bulb getting brighter and brighter as the light rises in intensity. You can also customize how long you want everything to take with the rate of change variables. In this case, I want it to follow the curve I have there exactly, so I have it set to none. Don’t Transition Smooth makes the light not update until it reaches a peak or valley (does the full transition at once rather than over time).

    clip_image002.jpg

    The color control option can affect the color of the material emission of a light (technically a renderer with an emissive material but from a player standpoint it’d be the light’s emission) or it can be set to affect the light’s light color (or both). This option contains a gradient, a double gradient (random between), a single gradient for random values (picks a color on the gradient at random), a constant color, or randomization between two solid colors. Just like the intensity controls, the color control options have the ability to change the speed at which any of this is happening with the rate of change variables.
    clip_image004.jpg

    This is an example of an audio control option. In this specific one, I am using the audio files to generate the light intensity for me (meaning I don’t need a intensity control option if I use this) and can affect all of the same properties as the intensity control option can. You don’t have to generate the light intensity from the audio though—if it is toggled off, all of the intensity related options are removed from the screen. The way the audio nodes working is pretty simple really—the “Play at” field is what intensity (of the light) that particular clip should be played at. The control option selects the node with the highest value that is below or equal to the current light’s intensity. With each node you can also define when you want to start at and end at (in case you don’t want the full file to run) and if you aren’t generating intensity from the audio file, you have an additional choice to scale the volume of your light with the intensity of your light.

    clip_image006.jpg

    Next up is the final control option (then we have two controllers to look at ) This control option you can stage other control options in to further customize how and when your control options are used. The two biggest components to a stage is it’s duration and when it moves onto the next option (Stage Advancement). It’s noteworthy that as many or as few stages can be running at once, there is no requirement for the duration of a stage to be done by the time it is ready to advance, hence them being separated. You can also choose to limit the amount of times a stage can be activated—which is where the loose order option comes in. If loose order is on, stages can skip past a stage that can no longer activate to find one that can—if loose order is not on, it a stage cannot advance to the next stage in the order, it cannot advance at all. There are three different duration and advancement triggers, it can use the amount of iterations (the number of times completely through a control option) to determine when to advance, it can use time, OR it can use an event. Some events will come already written—the most common ones. On collision or trigger, when the duration is done, etc. You can very easily write your own events though and plug them into the stager. You can put the methods on a MonoBehaviour and attach it in scene or as a prefab OR I have included a partial static class that will also be searched that you can add methods to (to keep down on prefab instantiation clutter when possible).

    clip_image008.jpg

    Next up is the Grouped Light Controller, this one is pretty simple. You can have as many control groups as you want and each control group is just a group of lights and/or emissive materials that will be updated by the same control options.

    clip_image010.jpg

    And finally, the other controller—the Staged Light Controller. I can't upload a sixth image but it looks almost identical to the control option stager but instead of staging control options--you can stage other light controllers (including other Staged Light Controllers).

    Thanks for reading this far! Please let me know what you think! Any and all feedback is welcome! I'd love to know if you guys think it's nearly ready to go on the asset store and if not what you guys would add to it! Look forward to hearing from you!

    EDIT: Here are two short clips showing two very short demonstrations. The first one is four rows of lights going off one after another and the other clip shows the audio to intensity generation. NOTE for some reason OBS REFUSED to record the light flicker properly so it looks like it's flicker a lot slower than it actually was (likely due to frame rate recording conversions). It flickers along with the static though rather than being slightly slower like the clip shows.


     
    Last edited: Nov 6, 2018
    Xavierblock36 and Mark_01 like this.
  2. TimoteoCarbone

    TimoteoCarbone

    Joined:
    May 22, 2020
    Posts:
    1
    Dear andrewkausy
    Wonderful job! Where is it possible to download your asset?
     
    Mark_01 likes this.
Thread Status:
Not open for further replies.