Documentation



Hot Patch 1.2.6 has been submitted to fix vlights from preventing picking objects in 5.3.4.

Hot Patch for 1.2.4 vlights has been submitted to fix incorrect falloff. If you need a fix soon contact me at brianvlights at gmail dot com.

If realtime shadowed v-lights are not working please add a layer in your project called "vlight" this is also required for the post effects. This requirement will be removed in the next version.


If you are having any compatibility problems with Unity 5 please contact me.

brianvlights at gmail dot com

Setup

  1. Download the file from the asset store and install it into your project.
  2. Add a new layer into unity called "vlight" (this is important for using a post process effect.
  3. Your done!

Creating a V-Light

Creating a V-Light is exactly same as creating a gameobject in unity. 
Simple click 


  • GameObject->Create Other->
    • (V-Lights Spot)
    • (V-Lights Spot)
    • (With Light/V-Lights Point)
    • (V-Lights Point With Light)
Spot are spot light shaped and point are sphere shaped lights. "With Light" means that it will attach another gameobject with a unity standard light on it. The default materials V-Lights uses are in the Materials folder under V-Lights.


Tweaking Parameters

V-Lights comes with 5 different sample scenes showing you the various parameters that you can modify to create your own custom lights.







Script Parameters:

  • Render wire frame: Display the unity wire frame mesh. You may want to disable this for a clearer view of the v-light.
  • Point Light Radius: Size of the point light.
  • Spot Light Parameters
    • Spot Range: Distance the spot light extends.
    • Spot Near: Distance from where the spot light starts from.
    • Spot Angle: Angle of the light.
    • Area Volume: Creates a 3D volume with various shapes. (Cube, Rounded Cube Sphere and Cylinder)
    • It's best to keep the range and angle small to optimize the speed and quality.
  • Light Gradient: To control the light fall off directly you can enable Use Curves then modify the gradient. The standard light parameters will not affect the light.
  • Use Dithering: Smooths the light out a bit by applying a dither pattern. Similar to the post process interleaved sampling.
  • Use Smoothing: Creates a soft edge where the light intersects geometry similar to soft particles. This requires the depth buffer.
  • Light Type: Choose between point and spot light. When swapping lights the material will be changed to either the spot or point light as each uses a different shader and texture types.
  • Shadow Mode: Does the light cast shadows? Real time shadows require Unity 5 personal or Unity 4 pro. Be careful with point lights as they require rendering a cube map(6 sides) for real time shadows.
  • Render Full Shadows: Internally v-lights uses a copy of the Unity depth shader to to render shadows. Certain objects like Speed Trees cannot be used with this and need to render a full depth buffer scene. Use this option if your shadows do not work.
  • Slices: Slices control the quality of "volumizing" the light. The more slices the more accurate the volumetric light is represented. Raising the number too high will increase the fill rate (how many pixels your graphics cards needs to fill) slowing it down. A good number is around 30-40 if you are not using interleaved sampling(explained later) and 10-15 with interleaved sampling.
  • World Scroll Amount: If you want the noise to animate when moving the light increase this value. Think of it as a light moving through noise.
  • Light Material Properties
    • Color Tint: Tint the light.
    • Light Multiplier: Multiplies the intensity of the light
    • Spot Exponent: Controls the "softness" of the light. 
    • Constant/Linear/Quadratic Attenuation: Controls how the light fades out with distance.
    • Noise Speed: Rotation or scrolling speed of the noise texture.

Material Properties

  • Light Color Emission: Texture used to tint the light.
  • Noise Map: Texture used to control the alpha of the light
  • Shadow Map: This can be set to a baked shadow to create a shadow inside the volume. The gray scale value controls the depth of the shadow.

About V-Light Materials

Every time you create a v-light object is creates a new instance of it's materials. This let's you customize each light individually without affecting other lights.  One drawback is that changing the base material will not update all the lights using the same material.


Interleaved Sampling / Down sampling Blurring / Bilateral


Add Component > V-Lights > VLight Image Effects to your camera

Interleaved sample is a great way to get better performance and quality from lights. Each volumetric like is built from a stack of transparent planes. As with any transparent object this quickly increases your fill-rate. Also as your screen resolution increases so does your fill rate. Reducing the number of planes helps improve performance but degrades quality because the light doesn't have enough sampling planes to accurately represent the volume. That is why the slices parameter is something that has to be carefully tweaked.

For Unity 4 pro or Unity 5 Personal users there is a post process effect which can help you resolve these problems using 3 techniques.

  • Interleaved sampling
    • Interleaved sampling improves image quality by taking every color pixels from 4 slightly offset versions of your light and combining them back together almost like a dithering effect.
    • Min Interleaved Res: if your lights use less pixels on screen than this value interleaved sampling will be disabled.
  • Down sampling
    • Instead of rendering the light at full resolution we down sample it to a quarter or eighth of the screen resolution then upscale it. This means that your computer only needs to render a fraction of what it needs.
  • Blurring
    • Blurring improves image quality by giving a soft appearance to the light.
  • New experimental Bilateral Filtering and depth aware up sampling
    • Enabling this reduces edge leaking when using blur. 
    • This is a more complex technique and is a bit heavier on GPUs.
    • Bilateral Disabled
        Bilateral Enabled
These techniques are combined to give you the best image quality/performance. Down sampling improves performance then interleaved sampling and blurring help improve the quality of the up scaled image. It is advised to use this FPS games or games in which you expect the player to go inside of your light frustum.

Editing

V-Lights supports multi object editing. Multiple lights can be selected and edited at once.

Important Things

V-Lights and post effects are viewable during editor mode for easy setup. This sometimes causes object clean up messages because the editor doesn't like removing shared materials and meshes. These can be safely ignored.

It's best to keep the player out of the frustum because the closer you go the more fill-rate you incur.


The next version will resolve this.

Mobile Devices

V-Lights is mostly a desktop solution but will run on most modern mobile devices like iPhone 5s and 6. Fill-rate (how many pixels that can be rendered to the screen) can cause bottlenecks on mobile devices because of their slower GPUs. It's best to keep the lights far from the camera.