Hi, I try to understand how work barycentric coordinates in deep.
I know how it is definied:
In RaycastHit structure we have barycentricCoordinate field. I don’t know how can I use it in practice.
I do some research about barycentic cordinates:
Where and why I should use barycentric coordinates? Why don’t use uv instead of barycentic coordinates?
I also try to understand example script from documentation:
I don’t understand why we multiply triangleIndex by 3?
Vector3 n1 = normals[triangles[hit.triangleIndex * 3 + 1]];
Also I don’t understand idea behind this line of code:
Vector3 interpolatedNormal = n0 * baryCenter.x + n1 * baryCenter.y + n2 * baryCenter.z;
Why don’t use Raycasthit.normal?
Summary:
Where I must use barycentric coordinates? Are other variables from Raycasthit not enought to do everything?
What are pros and cons of that space in practice?
Sorry for chaos in my question but after few hours of searching explanation I don’t know how to define question.