How to find nearest primitive

   9143   3   1
User Avatar
Member
36 posts
Joined: Sept. 2013
Offline
Hi Guys ,

I need to find the nearest primitive using VEX,basically looking for something like nearpoint function in VEX,but for primitive,I am getting the output using Attribute transfer,but want to do it using VEX.

The scene is such that I have two exact same spheres with same topology.One have primitive based color and I want to transfer the primitive color from one sphere to another using VEX
User Avatar
Member
9436 posts
Joined: July 2007
Offline
xyzdist() will give you nearest primitive (as well as exact uv location within) to provided position
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
727 posts
Joined: Sept. 2013
Offline
xyzdist() is usually used for looking up the right primitive number along with its intrinsic UV-coordinates.
primuv() is used then for grabbing attributes from exactly that location.

Hit play to see it in action:

Attachments:
xydist_example.hiplc (130.3 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
36 posts
Joined: Sept. 2013
Offline
Thanks alot guys …It works great!!Cheers!!
  • Quick Links