houdini from model world position to uv position?

   3227   4   1
User Avatar
Member
20 posts
Joined: Dec. 2018
Offline
I know you can get uv space to world space, but is there a way to trace backwards?

if I have vector3 position on the model surface I want to find out where is it in the UV coord?

Thanks
User Avatar
Member
9374 posts
Joined: July 2007
Offline
you can use Ray SOP in Minimum Distance mode and import uv attribute

or you can use xyzdist() followed by primuv() VEX functions to get coordinates on the closest surface and interpolate uv attribute at that location, essentially the same as Ray SOP above does
Edited by tamte - March 14, 2022 23:16:21
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
5091 posts
Joined: Feb. 2012
Offline
Hi,

Here is an example:





Lookup UV :

int hitprim = -1;
vector hituv = 0;
xyzdist ( 1, @P, hitprim, hituv );

i@hitprim = hitprim;
v@hituv = hituv;

vector p = primuv ( 2, "P", hitprim, hituv );
@P = p;
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
20 posts
Joined: Dec. 2018
Offline
tamte
you can use Ray SOP in Minimum Distance mode and import uv attribute

or you can use xyzdist() followed by primuv() VEX functions to get coordinates on the closest surface and interpolate uv attribute at that location, essentially the same as Ray SOP above does

Thanks I will try it out....
User Avatar
Member
20 posts
Joined: Dec. 2018
Offline
animatrix_
Hi,

Here is an example:





Lookup UV :

int hitprim = -1;
vector hituv = 0;
xyzdist ( 1, @P, hitprim, hituv );

i@hitprim = hitprim;
v@hituv = hituv;

vector p = primuv ( 2, "P", hitprim, hituv );
@P = p;
super cool !! thanks
I will try it
  • Quick Links