Archived post by Bender

From @trzanko ray sop or prim uv’s don’t yield super great accuracy, as it only interpolates among a primitive’s points, to get a smooth position you can leverage the osd vex functions
here’s my subdiv ray snippet which illustrates this, you can see the diff between the osd pos and the primuv pos if you comment out the line which declares the variable sDP
“`int primNum; vector UV;
float dist = xyzdist( 1, @P, primNum, UV);
vector restN = primuv(1,”N”,primNum,UV); vector posOnRest = primuv(1,”P”,primNum,UV);
//subdiv float pU, pV; int pId; int patch = osd_lookuppatch( 1, primNum, UV.x, UV.y, pId, pU, pV);
//these two functions return the last argument //so posOnRest is being overwritten in the function, much like xyzdist() int sDN = osd_limitsurface( 1, ‘N’, pId, pU, pV, restN); int sDP = osd_limitsurface( 1, ‘P’, pId, pU, pV, posOnRest);
@P = posOnRest;“`

posting Tighe’s post for re-gemming