world point position from poly uv's

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  01 January 2008
world point position from poly uv's

Is it possible to get the point position from a uv coord on a poly?

You can do this on a nurbs surface

pointPosition nurbsCylinder1.uv[1.79693196412904][4.79288262919124];
// Result: -0.811743 0.796932 -0.583178 //

any help appreciated
(also posted in dynamics forum)
  01 January 2008
well just change .uv with .map then it should work:

  01 January 2008
using the .map coords doesn't give me what I want...
it does not interpolate across the uv space as the nurbs .uv's do,
and how do I know which uv coord map[$n] corresponds to?

for instance
I have particles with goalU and goalV if my goal object was nurbs I could easily
fing out where the particles were being attracted to by

float $pos[]=`pointPosition nurbs.uv[goalU][goalV]`;

unfortunately I am not using nurbs so I want to find a way of doing the same thing with
a poly object

  01 January 2008
oops posted twice

Last edited by devoy : 01 January 2008 at 10:47 PM. Reason: posted twice by mistake
  01 January 2008

just a quick try i did - with a sphere which is parented to world..

xform -q -ws -t[253] - returns a value which does give you usable values..

but when the pSphere is under a group, now the command is NOT returning world space values ???

sory this might be fully usable but just wanted to try..
|| Loka samastaa sukhino bhavantu ||
  01 January 2008
if I understand correctly, you're trying to find a point ANYWHERE on the poly object. I've made a script in the past that did this sorta (it was for a company so I can't post the script). Buttttt, the script involved some math to find an exact location on a plane, the math is basic algebraic math. Basically finding locations between verts based on percentages.

is/of * x/100 = %

soo basically, I'd find the 4 vert locations of the face the object is currently in. And if you take two vectors of two verts in that face, and subtract each other, you'll have a difference that you can move the object through ----



so the possible movement area between these two verts is

<<(x2-x1), (y2-y1), (z2-z1)>>
<<2,5,3>> --- This is your "Of" value in the equation I wrote above.

so to pull the percentage, this would be an already existing attribute on the particles themself of object itself. For particles, just make another general per particle array.
but lets say the object is 70 % between both of those verts

Soo for this --- is/of * x/100 = %
You'd look for the "Is"

And just plug in your vector you found

X/2 * 70/100 = 1.4
X/5 * 70/100 = 3.5
X/3 * 70/100 = 2.1

So, the vector 70% between point 1 and point 2 is -
<<1.4, 3.5, 2.1>>

You'd write these in scripting like this --

$Is = Of * x /100;
float $X = 2*70 / 100;

Then add the found values for point 1 -



And just do it for your x y and z, but this is a bit of work. SOOOO I dunno if you feel like writing out the math for this.


Seeing how polygon objects have UVs, and are set points in space, it's hardder to find specific points on the object. Nurbs are all math, so the mesh uses the logitude and latitude as U and V values, but you know that.

Here is something I wrote up real fast, but pretty much all it does is find the selected UV on the poly object's UV Map and converts it to a vert and finds the point in space of the vert.

string $selUV[]=`ls -sl -flatten`;
//Convert selection to Verts
PolySelectConvert 3;
string $selected[]=`ls -sl -flatten`;
//World Space Point Position
vector $pointPos=`pointPosition $selected[0]`;
print $pointPos;
//Select the original UV again
select $selUV[0];

Thats the best I can do without writing a bit larger of a code for you.

But, if you are doing this for a particle system, it's easy to just run through the verts as a goal value, and the particle will like float to the next point, you just need to lower the goal weight. That way the particles will move to the next particle. You can find the next vert to move to by finding the connected edges to the vert and find the verts on one of those edges and the vert that you arn't currently at would be the only other vert listed.

DAMN, that was long

Last edited by trancor : 01 January 2008 at 02:37 AM.
  01 January 2008
didn't update in the server that I posted anything on this thread ---
  01 January 2008
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:24 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.