UV Mapping Problems

   2204   1   0
User Avatar
Member
9 posts
Joined: Dec. 2008
Offline
Hi,

I'm attempting to do something very simple, and failing miserably - stretching a series of curves out to the UV space of another object. I have a NURBS surface, which is assigned camera-projected UV coordinates, meaning that the values fall outside of . I then have curves with UV values in the same coordinate space, and I want to assign each curve point to a location on the NURBS surface, e.g. u=0,v=0 on the curve maps to the (x,y,z) where u=0,v=0 on the surface.

I've tried the Paste and Creep SOPs, no dice. It then occured to me that a simple Point SOP expression should suffice. So I tried:
tx = primuv(“../each1”,0,“P”,0,$MAPU,$MAPV)
ty = primuv(“../each1”,0,“P”,1,$MAPU,$MAPV)
tz = primuv(“../each1”,0,“P”,2,$MAPU,$MAPV)

Now the curves are stretching out to the height of the surface primitive, and squashing to the width. I know this has something to do with “real” and “unit” UVs, and should be solveable by using the unituv() and realuv() expression functions, but I cannot find the right expression to perform the mapping.

Here's an illustration. As you can see in the uv view, there is one set of curves that intersects the surface, and that's *all* I want on the surface. The other curves can be discarded. Any ideas? Thanks in advance!

-Kappy

Attachments:
uvmapping.jpg (30.3 KB)

User Avatar
Member
9 posts
Joined: Dec. 2008
Offline
I've solved it! Here's how:

First, for the surface, create a vector attribute (we'll call it pSave), and stuff the position coordinates into it. Then translate each point in both the surface and the curve to it's UV coordinates. Ray SOP the curve to the surface, making sure the “Import Attributes from Hits” parameter's checked and “pSave” typed into Point Attributes. Then delete points with pSave0,0,0) and translate the rest of the points to the pSave coordinates.

Not exactly obvious, but then I suppose it wouldn't be as much fun to figure out.

-Kappy
  • Quick Links