Position From Texture-UV

   2534   0   0
User Avatar
Member
941 posts
Joined: July 2005
Offline
This is a continuation of a thread in the mailing list, which I'm placing here so as to be able to include attachments…

Jaideep Khadilkar
I want to find position of a point on a surface using its uv attributes.
“primuv” expression gives me the position, if the surface is NURBS, but it uses orignal NURB uv to calculate position and doesn't use texture uv atrribute that we modify.
How to do that???

Let's call the geometry you want to project “src” and the surface you want to
project it to “tgt”, and they both have a 2d attribute called “uv” (src.uv
and tgt.uv). Then, in theory, you'd just need to convolve some filter
centered at src.uv with all the tgt.uv's to arrive at a weighted sum of all the target positions…. then divide by the sum of all the weights and you're
done.

Jaideep Khadilkar
I went thru ur reply. But I still have some problems. How perfect it will be. Is it geometry resolution dependent ( number of points in the geometry) ??? Can u plz send me the hip file u r talking abt…

Yes, its accuracy depends on how many samples the target has in uv space – IOW, the limitations are similar to those of an AttributeTransfer SOP.
One thing that you can do to improve its chances somewhat, is to pre-compute the filter width (in uv space) based on the average or max of a few neighbours (I've done this in the example attached). But this may cause problems when uv coords “wrap” across neighboring points.
Also, note that this is a sketch using VEX, not the HDK. If using the HDK then I guess you could interpolate across primitive faces and discard the convolution idea…

Attachments:
Test_AttConvolve.hip (146.1 KB)

Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
  • Quick Links