Hello Guest

Author Topic: Tangents and Normals?  (Read 4234 times)

zettam

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 17
    • View Profile
Tangents and Normals?
« on: April 10, 2014, 10:18:09 am »
Custom shader caused this error

Shader wants normals, but the mesh  doesn't have them
UnityEditor.DockArea:OnGUI()

I've set my collection settings to generate both tangents and normals, however the error is still there. What's the quick fix for this?

zettam

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Tangents and Normals?
« Reply #1 on: April 10, 2014, 10:43:31 am »
UPDATE: My custom shader works with regular sprites. It doens't work with fonts in the collection.
When I set the material of any image based sprite to the material that uses my shader, it works nicely (no errors) however when the same material is set for any fonts in the correction, the error is there.

I believe the current version is TK2D is not generating normals and tangents for the fonts, even if it's set in settings.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tangents and Normals?
« Reply #2 on: April 11, 2014, 02:09:04 pm »
Its not creating them, simply because of the additional overhead. If you need it you can call mesh.RecalculateNormals() where it RecalculateBounds() in tk2dTextMesh.cs. You can fill constant values into the normals (0,1,0) and tangents (1,0, 0, 1) I think should you want to do that as well.