# World position of texture coordiantes

This topic is 4551 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is there any way to find the position in world/object space of each texture coordinate on a ID3DXMesh? I have'nt tried it, but I am fairly certain the D3DXIntersect function returns the UV coordinates hit by the ray, so as a last resort I could always try sending a bunch of rays at the mesh and record the positions. -Chris

##### Share on other sites
I'm not very familiar with the ID3DXMesh interface, but I imagine you should be able to get the data for each vertex. That should include the vertex position, normal, and texture coordinates. Maybe they do something odd like store the texture coordinates in another list somewhere, but it should still be tied to each vertex in some way (perhaps by vertex index?).

##### Share on other sites
Quote:
 SDK documentation, about D3DXIntersectTri:The D3DXIntersect function provides a way to understand points in and around a triangle, independent of where the triangle is actually located. This function returns the resulting point by using the following equation: V1 + U(V2 - V1) + V(V3 - V1).Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The parameter U controls how much V2 gets weighted into the result, and the parameter V controls how much V3 gets weighted into the result. Lastly, the value of [1 - (U + V)] controls how much V1 gets weighted into the result.Barycentric coordinates are a form of general coordinates. In this context, using barycentric coordinates represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for barycentric coordinates.Barycentric coordinates define a point inside a triangle in terms of the triangle's vertices. For a more in-depth description of barycentric coordinates, see Mathworld's Barycentric Coordinates Description.

Hope this helps.

1. 1
2. 2
3. 3
Rutin
20
4. 4
frob
20
5. 5

• 32
• 13
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
632560
• Total Posts
3007082

×