Jump to content

Accessing Parametric UV's on a surface....


Sevro

Recommended Posts

Is there a way to access the parametric uv's on a surface?  I can get the assigned uv's, but not sure how I can access the intrinsic/implicit uv's for a shape?  

 

Link to comment
Share on other sites

The VEX functions xyzdist() or intersect() return primitive numbers along with intrinsic UV locations. Interpolated attribute values can then be obtained using primuv().

Documentation:
https://www.sidefx.com/docs/houdini/vex/functions/xyzdist.html
https://www.sidefx.com/docs/houdini/vex/functions/intersect.html
https://www.sidefx.com/docs/houdini/vex/functions/primuv.html

Examples:
Eg. transfer normals from the closest surface position of the second input:

int prim;
vector uvw;
float dist = xyzdist(1, v@P, prim, uvw);
vector nml = primuv(1, 'N', prim, uvw);

Eg. transfer color attribute from ray intersection with another surface:

float range = 1000.0;
vector pos = v@P + v@N * 1e-3;
vector dir = v@N * range;

vector pos_hit;
vector uvw_hit;
int prim_hit = intersect(1, pos, dir, pos_hit, uvw_hit);

v@Cd = primuv(1, 'Cd', prim_hit, uvw_hit);

 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...