Hello Guest

Author Topic: Normal generation generates flipped normals?  (Read 6601 times)

casimps1

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Jarcas Studios
Normal generation generates flipped normals?
« 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?
Jarcas Studios

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Normal generation generates flipped normals?
« Reply #1 on: August 10, 2013, 08:42:45 pm »
What version of 2d toolkit and unity? Also, are you using tk2dcamera?

casimps1

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Jarcas Studios
Re: Normal generation generates flipped normals?
« Reply #2 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.
Jarcas Studios

casimps1

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Jarcas Studios
Re: Normal generation generates flipped normals?
« Reply #3 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.
Jarcas Studios

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Normal generation generates flipped normals?
« Reply #4 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?

casimps1

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Jarcas Studios
Re: Normal generation generates flipped normals?
« Reply #5 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.
Jarcas Studios

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Normal generation generates flipped normals?
« Reply #6 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.

casimps1

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Jarcas Studios
Re: Normal generation generates flipped normals?
« Reply #7 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?
Jarcas Studios

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Normal generation generates flipped normals?
« Reply #8 on: October 04, 2013, 06:35:13 pm »
Probably over the weekend.