Hello Guest

Author Topic: Light-cone/circle (fake)  (Read 10445 times)

helioxfilm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Light-cone/circle (fake)
« on: December 27, 2012, 05:28:08 pm »
Hi folks,

we would like to achive a similar effect, like in this great game (best seen from 4.27).

http://www.youtube.com/watch?v=Dxx3DUKHPxw

Do you have any suggestion how to achive such effect? In our game there is the night level, where the characters have torches, and only those animals are visible on screen which are in their light cones/circles. The background, animals, divers are managed by 2D Toolkit.

I welcome any ideas.

Best regards,
Helioxfilm

helioxfilm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Light-cone/circle (fake)
« Reply #1 on: January 13, 2013, 08:42:40 pm »
No idea so far... It seems this task is not so easy...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Light-cone/circle (fake)
« Reply #2 on: January 14, 2013, 09:16:34 am »
It isn't that straightforward to do this.
I do have a product in development which will let you do this and a lot more - its meant to be a cheap add-on to 2D Toolkit. The issue is I've not had enough time to complete it :( Maybe next month...

MaaS

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Light-cone/circle (fake)
« Reply #3 on: January 14, 2013, 12:06:42 pm »
The game I'm developing use lightings zones and torches (lighting up or down, a NPC moving around with one)...

I'm still testing how to approach it... So far I've been trying with real lights, tints, addition flare sprites above everything, or multiply the whole screen with a huge black sprite (semitransparent or black and multiply) with a hole where the "light" is (in my case that's not possible as I can have several torches)... and none convinced me yet... but you could try the multiply thing if it's not too much graphic cost for a "similar" effect...
« Last Edit: January 14, 2013, 12:21:52 pm by MaaS »

helioxfilm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Light-cone/circle (fake)
« Reply #4 on: January 14, 2013, 05:45:39 pm »
Thanks for the replys. In my case I can have maximum 8 torches/light circles at the scene. Not always on screen, but it might happen. They swim in-out from the screen.

It shall run on the ipad2, mini and above, as well as on Android (wague definition for Android I know).

I am extremely interested in the product in development, Unikron...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Light-cone/circle (fake)
« Reply #5 on: January 15, 2013, 11:31:54 am »
With the solution I've got, you can have as many colored lights in any shape as you like within reason - they only start costing a lot when they overlap in screen space. Each light is a sprite, and it properly illuminates other sprites.

It works on iPad2 and above and all GLES2 hardware, but the final version will have a workaround for GLES1 hardware, losing colored lights in the process. You need Unity Pro for colored lights on any hardware, but the fallback monochrome light mode will work on any hardware.

The GLES2 path works now, but the fallback system remains to be done. I'll post on this forum when I have that done.

helioxfilm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Light-cone/circle (fake)
« Reply #6 on: January 15, 2013, 06:51:46 pm »
Our minimum hardware target is iPad2 and above. I have Unity Pro iOS 3.5.7, so it seems to be OK for me...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Light-cone/circle (fake)
« Reply #7 on: January 16, 2013, 12:14:11 pm »
I'll give you a shout when its ready for more wide testing :)

MaaS

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Light-cone/circle (fake)
« Reply #8 on: January 17, 2013, 03:29:22 pm »
Unikron, would you mind to explain a bit more about how the light effect will be done? Just from the graphic (sprites and tilemaps) point of view...

I'm working on drawing our tilesets right now, and I would like to know if with your light solution I'll have to do a set of "shadow" tiles, if the graphic will look like if they are tinted, and things like that hehehe :)

Thanks!!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Light-cone/circle (fake)
« Reply #9 on: January 17, 2013, 04:23:34 pm »
How it works is you have an ambient light - this is global and all sprites are affected by it. You control the ambient light independently to all other lights.

Other lights are created as sprites, the shape of your sprite determines the amount of light that is emitted. You can control the global intensity of the lights, so you can have sprites which are 2x brighter than white. This is useful to illuminate dark source textures. You can also have negative lights which create shadow - you can use this to darken room edges.

There is a light accumulation buffer which gets computed before the rest of the scene is rendered. All lights, ambient, positive and negative get accumulated here and finally get merged with your main scene.

You get the same effect as normal point/spot lights - except you can shape your lights with ease.

I'll try to complete this after 1.90 final is out. The core system works perfectly now - I just need to clean up the interface and complete the fallback path for Unity Free & GLES 1.1 and its done.

helioxfilm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Light-cone/circle (fake)
« Reply #10 on: January 17, 2013, 07:51:58 pm »
Just for clarification: this solution is much cheaper than using real sportlights, I suppose.. Can you release the Pro version first, and then update it for Unity free?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Light-cone/circle (fake)
« Reply #11 on: January 18, 2013, 05:05:38 am »
Once you go beyond 1-2 spotlights it is massively cheaper. Also, using Unity lighting you'd have to use pixel lighting to get the spotlights looking correct, and that adds further expense, so for a like for like comparison I'd say it is quite a bit cheaper, and even more so if you have a lot of small lights. You can easily have hundreds of lights, as long as they don't overlap.

I'll be able to judge better after 1.90 is done and released.

MaaS

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Light-cone/circle (fake)
« Reply #12 on: January 18, 2013, 11:44:16 am »
Thank you for your explanation :)