Typically one has use the barycentric formulas to get to the UV calculation using (in UrhoSharp case) the ray/triangle intersection involving Urho.RayQueryLevel.Triangle
Q1: perhaps there is a benefit of using Urho.RayQueryLevel.TriangleUv for UV calculation. However, I could not find anything after hours of googling.
=> Could someone comment on this?
This is another Urho(3D) & SkiaSharp(2D) use case that is unique for Xamarin platform that clearly differentiates from other .NET 3D engine.
Q2: Could someone share how to do this efficiently combining UrhoSharp & SkiaSharp:
(a) get the result below (discussing the potential benefit of using RayQueryLevel.TriangleUv instead of RayQueryLevel.Triangle)
var cameraRay = app.Camera.GetScreenRay ( (float)e.X / app.Graphics.Width, (float)e.Y / app.Graphics.Height); var result = app.Octree.RaycastSingle (cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry);
(b) How to get the Intersection in UrhoSharp and UV coordinate to efficiently draw a small circle at the identified UV coordinate in SkiaSharp?
dA = distance from A to P dB = distance from B to P dC = distance from C to B sum = dA + dB + dC coefA = dA / sum coefB = dB / sum coefC = dC / sum
So, the texture coordinate at point P is :
uP = uA * coefA + uB * coefB + uC * coefC vP = vA * coefA + vB * coefB + vC * coefC