Git Product home page Git Product logo

2d-light-of-sight-unity's Introduction

2D Light of Sight (v0.9 alpha)


Demo

  1. [Radial Shadow] (https://dl.dropboxusercontent.com/u/27907965/games/LOS/RadialLightDemo/RadialLightDemo.html)
  2. [Fullscreen Shadow] (https://dl.dropboxusercontent.com/u/27907965/games/LOS/FullScreenLightDemo/FullScreenLightDemo.html)
  3. [Ludum Dare #32 entry: "Long Live The Great Leader!"] (http://ludumdare.com/compo/ludum-dare-32/?action=preview&uid=24851)

What is it?

A 2D dynamic lighting plugin for Unity3d, that is, it achieves something like [this] (https://dl.dropboxusercontent.com/u/27907965/images/LOS/los_radial_light_0.png) and [this] (https://dl.dropboxusercontent.com/u/27907965/images/LOS/los_full_screen_light_0.png).

Features

  1. Can cope with any shape, as long as the corresponding collider is attached with the object.
  2. Has [radial mode] (https://dl.dropboxusercontent.com/u/27907965/images/los_2.png), and [fullscreen mode] (https://dl.dropboxusercontent.com/u/27907965/images/los_1.png).
  3. Event system. Objects can be notified if it gets lit or gets unlit.
  4. Can work with perspective camera too. (Tested with topdown view, not tested with 45 degree isometric view)
  5. Works with 2D & 3D Physics!
  6. All features are supported by Unity #FREE# version!!! This may not be as important as now Unity5 unlocks all engine feature.

How to use:

  1. Set camera. Place LOSCamera script on the camera that is used to render the shadow. (Or ignore this step if you only have one camera, the editor will do the work for you.)
  2. Create a light. In the GameObject dropdown, select LOS 2D Lighting / Radial Light (or other lights) to create a 2D light gameobject. For the 2D light to work properly, the obstacle layer property should be set in the inspector.
  3. Create an obstacle. Create any premitive or sprites, and attach Unity collider to them. Then attach LOSObstacle script to the gameobject. Also don't forget to set its layer to match what's set in step 2.
  4. Adjust degree step to match the precision you want.

Tips & Tricks:

  1. Toggle 2D / 3D Physics: The latest version of this plugin supports 2D & 3D physics in Unity. All you need is to set the Physics Opt field in LOSManager's inspector.
  2. Precision VS Performance: Sometimes for moving lights, the degree step (which stands for precision) should be set lower, something like 0.1f or 0.2f would be good enough. However, the smaller the degree step (better precision), usually means more costly. I'm planning to work on better scene management to improve this.
  3. Full Screen Light Tips: The Full Screen Light requires its position is within the camera so that to work properly.
  4. Fake 3D Shadow: If you want to use perspective camera to render effects like [my LD#32 game] (http://ludumdare.com/compo/ludum-dare-32/?action=preview&uid=24851), you can use orthographic camera to render other things normally, and render shadow using perspective camera (by playing with layer mask). This effect is inspired by a game called Teleglitch.
  5. Blur Lights & Shdows: With Unity5 and above, you can blur the edge of the lights & shadows! Check out [the blured version of full screen light] (https://dl.dropboxusercontent.com/u/27907965/images/LOS/Screen%20Shot%202015-04-23%20at%205.38.45%20pm.png). Here is how it works: render the light in a separate camera which has blur image effect component attached. One thing to note is that, this camera should be rendered at last (by setting the camera's Depth low). So the background (not blured) actually rendered before the light, but I just made the background semi-transparent to make the light visible. You can check out the Full Screen Light Blur example in the plugin.

TODO

  1. Currently in Unity 5, full screen light has issue with capsule collider, but other parts works fine.
  2. Directional light.

Remarks

Feel free to use it! It's under MIT liscence! Just a reference back to here will be very appreciated :D Also any comments, questions, and suggestions are welcome! Unity forum: http://forum.unity3d.com/threads/light-of-sight-2d-dynamic-lighting-open-source.295968/

2d-light-of-sight-unity's People

Contributors

f15gdsy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2d-light-of-sight-unity's Issues

2D Torch Light

Is it possible to create 2D torch light with this ? if yes then please help.

Is there a way to combine 2 Full Screen lights?

I'm using this for a fog of war, of sorts. However, I have multiple players and I would like their line of sights to combine into one. Is this possible with the current version of Light of Sight? Side note, I'm using the 2D version.

Los event trigger in 2D

Triggers do not really work in 2D mode. I was not able to use LOS event trigger in 2D physics mode. It basically does not recognize the event. Triggers only works with 3D physics. I really need to use 2D physics system. Any suggestions?

Missing Script

In the Fullscreen light blur example, the child camera object shows a missing script. I suspect it's the blur component mentioned in the readme as there doesn't appear to be any blurring when running the example.

Update README

Hey!

You have made an awesome LoS plugin! I noticed that the README could be a bit more "clear", the Tips & Tricks section to be precise. Number 3. is a lie, even worse than the cake, and the number 6. should be either number 1. or its own heading/title! :)

Took me a couple hours to actually notice that I CAN use Box Collider 2D, etc.

Rotation Problem

I think this plugin seems the best among the Line of sight library.

But, I found one problem.
Dynamic light is not sync with its parent or it self rotation.
Temporary I rotate light by its cone angle.

I want to fix it. but I dont know where to start.
Where do I have to fix it?

Example scene blur camera script is missing.

Hi,

Thank you for amazing plugin.
I'm trying to test an example scenes. but I can't find one script.

Full Screen Light Blur.scene/Main Camera/Camera/Script Missing
Radial Lights.scene/Main Camera/Camera/Script Missing

I guess that it is for "blur image effect component".
Can you check example plz?

Demos not working

Hey, I noticed the demos look awesome, but when I attempted to open the demo scenes in engine, they did now work. I am using Unity 4.6.1. Basically, the scene opens, but no lighting effects / shadows. Am I supposed to do anything for demos to work or something?

BoxCollider2D doesn't work

Hi,

I've just discovered your plugin and you've made an incredible work ! However, in my scenes, I must use BoxColliders instead of BoxColliders2D, otherwise, it doesn't work (even if Physics Opt is set to Physics2D).

Do you know what may cause this issue ?

Thanks in advance ;)

Demo's is empty.

Hi,

Thank you for this awesome plugin, it's really amazing and helpful.

I'm trying to create an event system for hiding/showing some object when they are in the light distance, but I've didn't figure out how the event system work, could you please point me to the right direction of how to use it.

Sorry I've got away from my issue title, I've opened the demo's and they are empty, there is no object in the Hierarchy (for all scenes). I really appreciated if you can help me with this.

Thank you again for this plugin.

Mumen

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.