tangentproblem.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. THE PROBLEM OF THE TANGENT OF THE BLINES UNDER BONE INFLUENCE
  2. =============================================================
  3. Tangents are relative to vertices in any of its definitions (radius, angle)
  4. or (x,y). As the transformation performed by bones is prepaed to work on
  5. global coordinates vertices, the tangent transformation can not be directly
  6. transformed by bones in that way.
  7. There are some solutions to solve that:
  8. 1) The solution that Anime Studio gives to the tangents: It doesn't
  9. have real tangents but calculated ones based on the neighbour vertices
  10. position and a parameter called 'curvature'.
  11. 2) As well the tangents are relative to the vertex it belongs to, we
  12. need to convert the tangent to global coordinates, transform it by the
  13. bone(s) influence and then convert it to local coordinates again.
  14. 1) PROPOSAL FOR TANGENTS 'CALCULATED' BASED ON NEIGBOUR VERTICES
  15. ================================================================
  16. param convert type value type
  17. ----- ------------ ----------
  18. Tangent AverageTangent Vector
  19. Current BoneInfluence Vector
  20. Next BoneInfluence Vector
  21. Previous BoneInfluence Vector
  22. Link Vector Vector
  23. 'Current' is the current vertex in the bline (where the tangent lies) it is not a parameter
  24. 'Next' is the next vertex in the bline relative to Current
  25. 'Previous' it is the previous vertex in the bline relative to Current.
  26. Resulting Tangent (radius, angle) is defined by:
  27. Let's call: V=Current-(Next+Previous)*0.5
  28. Let's call: V0=Current.Link-(Next.Link+Previous.Link)*0.5
  29. Radius:
  30. radius = Link.radius
  31. Angle:
  32. angle=atan2(V.x,V.y) - (atan2(V0.x,V0.y)-Link.angle)
  33. When the user manipulates the tangent duck it modifies Link as an offset.
  34. Problems:
  35. -Insert a vertex
  36. -Vertex "on", "off"
  37. 2) PROPOSAL FOR TANGENTS IN GLOBAL COORDINATES
  38. ==============================================
  39. Given a vertex V and a tangent T and a transformed position of the vertex
  40. after bone influence V', calculate the transformed position of the tangent.
  41. global position of the tangent:
  42. TG=V+T
  43. TG'=V'+T'
  44. T'=TG'-V' = (V+T)' -V' where ' means tranformed by bones.
  45. param convert type value type
  46. ----- ------------ ----------
  47. Tangent BoneTangent Vector
  48. Bone Weight List List Static List
  49. Link (T) Vector
  50. Vertex (V) Vector
  51. It is reasonable that the Bone Weight List is the same for both parameters.
  52. When user manipulates the tangent duck it modifies the parameter T.