2D Toolkit Forum

2D Toolkit => Support => Topic started by: SirJson on December 10, 2013, 03:09:14 pm

Title: Lightning problems
Post by: SirJson on December 10, 2013, 03:09:14 pm
Hi,

When I'm using the tk2dCamera the lightning in Unity is broken. This bug only occurs when I play the game but not in the editor.

It should look like that
(http://pixeltastic.de/files/editor.png)

But instead it looks like that
(http://pixeltastic.de/files/game.png)

I'm using Unity 4.3. What can I do to fix the lightning? (except using the standard Unity ortho camera). Is this a known bug?
Title: Re: Lightning problems
Post by: unikronsoftware on December 10, 2013, 05:07:21 pm
This is a known unity renderer bug. It was fixed in 4.2 (after a really really long wait), but regressed in 4.3. I've reported it but not heard back.
Title: Re: Lightning problems
Post by: shaneandersonxp on December 14, 2013, 01:20:43 am
It seems that you can fix this by adjusting the Orthographic Size on the unity camera, even if you're using pixels per meter on the tk2d camera. However, normally the unity camera component is hidden when you're using a tk2d camera. In my case, the unity camera was set to 100 as the orthographic size, and lowering it to 10 fixed the lighting issue.
Title: Re: Lightning problems
Post by: unikronsoftware on December 14, 2013, 03:17:53 pm
That kinda fixes it. The unity bug is that unity ignores the custom projection matrix and uses some stuff from the ortho size, etc. If you feed it a close enough ortho size, it should work reasonably. Remember to take into account zoomScale, etc if its starts misbehaving.
Title: Re: Lightning problems
Post by: SirJson on December 15, 2013, 06:38:26 pm
Thanks! Now it works flawlessly :)
Title: Re: Lightning problems
Post by: djemix on January 15, 2014, 02:55:46 pm
This is a known unity renderer bug. It was fixed in 4.2 (after a really really long wait), but regressed in 4.3. I've reported it but not heard back.

Hello! I have this problem too, do you know anything about when Unity will solve the error?

Thank you!
Title: Re: Lightning problems
Post by: unikronsoftware on January 15, 2014, 04:28:38 pm
Your guess is as good as mine. The last time this was fixed it was about nearly a year from the time I reported it.
Title: Re: Lightning problems
Post by: djemix on January 16, 2014, 05:06:00 pm
But if It is Unity problem, they must fixed soon.

Anyway, is there any way I can make it work in a similar way?

I tried the solution above, but does not work me.
Title: Re: Lightning problems
Post by: unikronsoftware on January 16, 2014, 09:49:12 pm
You can use a normal ortho camera if you want, that doesn't suffer from the issue only custom projection matrices (which tk2dCamera uses) seem to be affected. You lose some of the nice features tk2dCamera gives you though.
Title: Re: Lightning problems
Post by: djemix on February 20, 2014, 01:18:00 pm
Do you know anything about if Unity solve the problem?
Title: Re: Lightning problems
Post by: unikronsoftware on February 20, 2014, 01:26:03 pm
No, my bug is still open.
Title: Re: Lightning problems
Post by: djemix on May 28, 2014, 03:05:07 pm
Hello again unikron, do you know anything about if Unity solve the problem?
Title: Re: Lightning problems
Post by: unikronsoftware on May 28, 2014, 03:37:05 pm
No update, the bug is still open. You could test it in 4.5 though, I haven't had a chance.
Title: Re: Lightning problems
Post by: R3nD on July 28, 2014, 01:56:08 pm
Hi!

Sorry to bump this one up but it seems that the problem remains under 4.5 (using 4.5.2f1).
Is it possible "to vote" for the bug so that it gets corrected faster, and if so could you please pass the link?

I've been avoiding the problem for some time now by tweaking the ortho size of the Camera but now with dynamic zooming and lots of prefab lights, I can't seem to get anything satisfactory :/

Thank's in advance!

R3nD
Title: Re: Lightning problems
Post by: unikronsoftware on July 28, 2014, 02:42:22 pm
http://issuetracker.unity3d.com/issues/lighting-is-incorrect-when-a-custom-projection-matrix-is-set-on-the-camera

If its a showstopper, I suggest using an ortho camera, as it will sidestep the issue entirely. No idea when it'll get fixed by Unity...
Title: Re: Lightning problems
Post by: R3nD on July 31, 2014, 09:01:55 pm
Sorry for the delay.

You mean only use an ortho camera. Won't I be able to use zoom in this case?


I know it's not that much but as a subscriber of the Pro yearly plan, I'll try to send a mail to see if they can speed things up, although I'm pretty sure you already did...
Title: Re: Lightning problems
Post by: unikronsoftware on August 01, 2014, 09:02:11 am
You can change ortho size to zoom?
Title: Re: Lightning problems
Post by: R3nD on August 03, 2014, 08:54:15 am
True :D Don't know why I didn't think of that!

Thank's for your fast support as always.
Title: Re: Lightning problems
Post by: djemix on August 08, 2014, 11:51:49 pm
http://issuetracker.unity3d.com/issues/lighting-is-incorrect-when-a-custom-projection-matrix-is-set-on-the-camera

If its a showstopper, I suggest using an ortho camera, as it will sidestep the issue entirely. No idea when it'll get fixed by Unity...

Hello! I've seen that have a recent reply about this. Is this the solution?

I have this problem and I haven't publish my finished game until I can find a solution.

But I have another problem. I use a light with a yellow color. Well, when I see then game in differents devices, there are some devices that I see without yellow color, why is this?

Attached examples.
(http://s27.postimg.org/zeopco4wz/Good.png)
(http://s27.postimg.org/4d3igtwir/Bad.png)
Title: Re: Lightning problems
Post by: unikronsoftware on August 10, 2014, 12:16:21 pm
What is the background? One big sprite? if so, it might be a platform that doesn't do pixel lights....
Title: Re: Lightning problems
Post by: stilghar on January 14, 2015, 05:18:44 pm
This seems to have been solved in 4.5.5 according to the issue tracker. Can anyone confirm that in fact this works now with latest version of Unity?
Title: Re: Lightning problems
Post by: unikronsoftware on January 15, 2015, 10:21:03 am
A brief test suggests its working properly in 4.6.1f1