Ok here is a quick way to get UVs from ray-triangle intersection point:
A;B;C vectors of triangle vertices P intersection vector uA uB uC- U coords of A B C vA vB vC -V coords of A B C First, you compute distances from P to A, B and C: 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 Read it in one of 3d math forums ,have not tested yet. But it is expressed exactly as barycentric formulas are formulated in math. Good Luck :)) On Tue, Nov 23, 2010 at 2:23 PM, Michael Iv <[email protected]> wrote: > You should transform these coords to barycentric . I am too stuffed to > write a showcase on this.But there is a lot of materia on this in the > web.Also Ask Fabrice he told once he is a barycentric GURU :)) > > But it seems to me that transform material should contain such an example > as it projects texture based on vector. > > > On Tue, Nov 23, 2010 at 2:19 PM, John Brookes <[email protected]>wrote: > >> Nice. >> So whats the UV position of the hit ;) >> >> > > > -- > Michael Ivanov ,Programmer > Neurotech Solutions Ltd. > Flex|Air |3D|Unity| > www.neurotechresearch.com > http://blog.alladvanced.net > http://www.meetup.com/GO3D-Games-Opensource-3D/ > Tel:054-4962254 > [email protected] > [email protected] > > -- Michael Ivanov ,Programmer Neurotech Solutions Ltd. Flex|Air |3D|Unity| www.neurotechresearch.com http://blog.alladvanced.net http://www.meetup.com/GO3D-Games-Opensource-3D/ Tel:054-4962254 [email protected] [email protected]
