PDA

View Full Version : How to get Point world position from UV coordinates


BluEgo
09-22-2010, 03:06 AM
I don't know how to solve this problem

in maya api you can use the MitMeshPolygon and iterate over every face to find the world position by uv with the command getPointAtUv.

I know that someone else asked for this here, but that thread was closed.

Somewhere I find a suggestion to use a kd-tree, but even if I think I could learn to use this structure (to me seems like he good old "divide et impera" algorythm), I can't imagine how to apply it to this problem.

Any help will be really appreciated :)

meetar
09-22-2010, 03:34 AM
You're talking about this thread, yes?

http://forums.cgsociety.org/showthread.php?t=284557

The pointOnMesh command they describe is one of the plugins that comes in the devkit, and can be found in maya\devkit\plug-ins.

Once installed, it's callable through Python, but you'll need to use Maya Python API methods to iterate over the faces of the mesh in question. I believe Pymel has a nicer interface to pointOnMesh, but for that you have to install Pymel.

ewerybody
09-23-2010, 12:40 PM
But what do you want to do?

A UV comes always directly bundled with an according VertexFace. So you could just -toVertexFace via polyListComponentConversion (http://download.autodesk.com/us/maya/2009help/Commands/polyListComponentConversion.html#flagtoVertexFace) and xform it:{
string $uv = "pCube1.map[9]";
float $pos[3] = `xform -q -t -ws (polyListComponentConversion("-toVertexFace", $uv))`;
print $pos;
}

but AAHHHH now I get what you are looking for: Not a uv-component but any UV value! I see I see...
Yea thats quite some meat. So the spot would have to be mapped exactly once!.. ehm good luck ^^

CGTalk Moderation
09-23-2010, 12:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.