2D Toolkit Forum

2D Toolkit => Support => Topic started by: casimps1 on August 10, 2013, 08:32:37 pm

Title: Normal generation generates flipped normals?
Post by: casimps1 on August 10, 2013, 08:32:37 pm
I've been working on a 2D game and I've been trying to add lighting to give a little extra atmosphere to the game. So, I switched the shader from BlendVertexColor to LitBlendVertexColor, turned on normal generation in the Sprite Collection settings, and added a spotlight shining directly on my sprite to my scene.

I kept trying to tweak positioning, spot angle, intensity, and range, and I just could not get my sprite to light up. Then, by accident I lit my sprite from the backside. Suddenly everything worked perfectly.

Is this maybe a bug with normal generation?
Title: Re: Normal generation generates flipped normals?
Post by: unikronsoftware on August 10, 2013, 08:42:45 pm
What version of 2d toolkit and unity? Also, are you using tk2dcamera?
Title: Re: Normal generation generates flipped normals?
Post by: casimps1 on August 10, 2013, 09:41:50 pm
Latest stuff - Unity v4.2, TK2D v2.1 final + hotfix 1.

I'm using tk2dcamera... but I've tried a standard Unity ortho camera too and it doesn't seem to make a difference.
Title: Re: Normal generation generates flipped normals?
Post by: casimps1 on August 10, 2013, 10:36:17 pm
Also, I just noticed the Double-sided render option for sprites, so I tried that too. That didn't make a difference either. I still had to light from the back side to get it to show up.
Title: Re: Normal generation generates flipped normals?
Post by: unikronsoftware on August 11, 2013, 06:19:43 pm
I just tested this in 2.1 on Unity 4.2, it behaves exactly as I'd expect it to. It lights up properly from the front, by default.
Can you send me a repro case of your broken one to support at unikronsoftware.com?
Title: Re: Normal generation generates flipped normals?
Post by: casimps1 on October 03, 2013, 08:21:48 pm
Sorry this took so long to respond. I had let this project slide for a while but I'm working on it again now.

Anyway, I'm sending you a simple repro now using the latest v2.2 stuff. It's really odd. Seems to be somehow related to TiledSprites in particular.
Title: Re: Normal generation generates flipped normals?
Post by: unikronsoftware on October 03, 2013, 09:39:01 pm
Tiled sprites weren't generating normals properly. If this is specifically the issue you're experiencing, it will be fixed in the next release.
Title: Re: Normal generation generates flipped normals?
Post by: casimps1 on October 04, 2013, 05:59:52 pm
Tiled sprites weren't generating normals properly. If this is specifically the issue you're experiencing, it will be fixed in the next release.
Yep, tiled sprites were the problem. Well, great! Any ETA on that release?
Title: Re: Normal generation generates flipped normals?
Post by: unikronsoftware on October 04, 2013, 06:35:13 pm
Probably over the weekend.