Finding 3Dworld position of texture pixel (texel)?

Blitz3D Forums/Blitz3D Programming/Finding 3Dworld position of texture pixel (texel)?

use LinePick (or CameraPick )
- Surf=pickedsurface()
- Tri=PickedTriangle()
- get the 3 vertices of the triangle :
V0=Trianglevertex(surf,0)
V1=Trianglevertex(surf,1)
V2=Trianglevertex(surf,2)

VU0#=vertexU(surf,V0)
VV0#=vertexV(surf,V0)

VU1#=vertexU(surf,V1)
VV1#=vertexV(surf,V1)

VU2#=vertexU(surf,V2)
VV2#=vertexV(surf,V2)

=> And get the coord :
U#=(VU0+VU1+VU2)/3
V#=(VV0+VV1+VV2)/3

Then convert the UV with texturecoord using:
=> GetSurfaceBrush => getBrushTexture()
And finally => texturewidth() , TextureHeight()
=> Pixel_I=U*TextureWidth()
=> Pixel_J=V*TextureHeight()