stackmann0
stack mann
1 posts

#17191
How to get the 3D position for the point with (0,0) UV coordinates? 1 month, 1 week ago Edited by stack mann on Jan. 11, 2019, 5:15 p.m. Reason: Initial post
Hello,
I have a 3D triangular mesh(vertices, indices, uv coords) that I'm rendering to the screen. Let's assume that the UV mapping is onetoone. I'm trying to find a way to find the 3D position of the point with UV coordinates equal to (0,0). I searched the internet but I only find answers that I don't find convincing. The solution that I found:  Find, in UV space, the triangle that contains (0,0).. let's call it T  Calculate barycentric coordinates for (0,0) with respect to T  interpolate the 3D positions of T's vertices using barycentric coords to get the result. this seems wrong to me. Here's why: Let M be the mapping between 3D space and UV space that associates UV coords for every vertex. Let A,B and C be the vertices of T. Let P be the origin of UV space ( P = (0,0) ). We have P = alpha*A + beta*B + gamma*C (alpha,beta and gamma are the barycentric coords of P with respect to T). We assumed the UV mapping to be onetoone, so let M° be the inverse of M. We have : M°(P) = M°(alpha*A + beta*B + gamma*C)
The solution in question assumes that M° is linear.. if that was the case you can have: M°(P) = alpha*M°(A) + beta*M°(B) + gamma*M°(C)
But that is not the case (correct me if I'm wrong). So is there a way to find the 3D position of a point with specific UV coords? Thanks in advance. 
mrmixer
Simon Anciaux
535 posts

#17233
How to get the 3D position for the point with (0,0) UV coordinates? 4 weeks ago stackmann0 What do you mean by that ? That the texture is 100% covered with triangles ? If that's the case, shouldn't one of the vertex have its UV attribute be (0, 0), so you can find the corresponding model space vertex position and transform it into world space ? 