View Full Version : Getting a UV position based on selected CV..
03-21-2007, 12:30 AM
I think I've spent a good few hours on trying to find this out and have found nothing just yet. Would anyone happen to know what's the best route to get the UV position of a NURBS surface based on a selected CV? I'm sure the answer is something reasonably simple that is just escaping me at the moment. Any suggestions would be greatly appreciated. Thanks..
now back to the search...
03-22-2007, 02:22 AM
If the UV's have not been modified, then a point on the surface (defined in UV coords) will match a scaled version of the texture coords (the paremetric surface point will be defined between the maxu/minu maxv/minv attributes). If however you have edited the nurbs surface UV's in UV edit mode, then, erm, i don't know.... (the patchUVIds of a nurbs Surface may hold the key, but dunno.... )
I don't think it's possible at all from CV's since most of them are not on the surface....
03-22-2007, 09:27 AM
You can try to do this with the help of a closestPointOnSurface-node. Given a worldSpace-coord it results the closest Point on a surface and the parameterU and parameterV at this point.
- create a closestPointOnSurface (in script editor execute: createNode closestPointOnSurface)
- connect worldSpace-Attribute of your nurbsSurface to inputSurface-Attribute of closestPointOnSurface-Node
- query worldSpace-coords of selected cv (vector $pos=`xform -q -ws -t nurbsSurface.cv`)
- set inPosition-Attribute of closestPointOnSurface to $pos (setAttr closestPointOnSurface1.inPosition ($pos.x) ($pos.y) ($pos.z) )
- then closestPointOnSurface1 holds parameterU and parameterV that you want
Hope it helps...
03-23-2007, 03:12 AM
doc.. thanks that seems to work out great.
I was thinking that I probably was going to need the world space value of the CV but hadn't come across the node to place it in to get what I was looking for.. Kept coming across the pointOnSurface node not the closest one lol..
03-23-2007, 03:12 AM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.