Hello Guest

Author Topic: Problem with lights  (Read 4093 times)

DJVDJV

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Problem with lights
« on: June 12, 2015, 10:29:00 pm »
Hello,
 I have problem with light and tilemap Z.

I use:
* tk2d tilemap as tilemap
* spriterender for characters
* Unity point light as light
* Sprite/Diffuse as shader for map and character
* Character and map have same Z

Map and character are on same layer, same sorting layer just "order in layer" so that character appear top of map.

If I add spot light in screen it affects only for character. If I change light Z 0 ->3 it affects map but not player anymore.

Why light needs different Z for map? Have any suggestion have I forgot something?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Problem with lights
« Reply #1 on: June 13, 2015, 04:25:25 pm »
Its complicated. Unity lighting isn't really well suited for flat planes which is what tilemaps and sprite renderers are. The results are different based on forward / deferred rendering and its not exactly easy to explain - you're better off asking in the unity forums about that.

If you really want 2d lighting you should think about rendering the lighting additively as sprites into a separate buffer and just multiply with your normal scene sprites. That will give you much better results and be noticeably faster.

DJVDJV

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Problem with lights
« Reply #2 on: June 13, 2015, 09:19:19 pm »
Hello,
Any suggestion what kind lights people usually uses with 2dtk tilemaps? Any suggestions about assets etc?