> Also Ask Fabrice he told once he is a barycentric GURU :))
Can't recall that! Truth is far away from that. I needed other ways to retreive 
uvs than I was doing previously for the raytracer I was working on,
and came across a version of this principle I liked. Credits due are in the 
class as its basically a 1/1 copy of this publication.
In its first version/first commit, It was a variation of it, using away face 
order, which turned out be wrong, was easyer fix the raytracer and set it back
and be able use the class for more cases. Such as the HitTest class for BSP.

Pretty much all we need has been done, it's a matter of adaptation. No guru, no 
voodoo, no magic and certainly not me!

Fabrice


On Nov 23, 2010, at 2:34 PM, Michael Iv wrote:

> 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]
> 

Reply via email to