Saori Yoshimoto work notes since 2018

Thursday, September 12, 2019

[VEX] get primitive info from hit point (xyzdist, prim_normal, primuv)

ray node(SOP): Automatically generate attributes int hitprim, vector hitprimuv
e.g.)
int    success;
s@name = getattrib(1, "prim", "name", i@hitprim, success);

xyzdist() (Can get distance to the surface & primnum & Parametric UV)
float  xyzdist(<geometry>geometry, vector origin)
float  xyzdist(<geometry>geometry, vector origin, int &prim, vector &uv)
float  xyzdist(<geometry>geometry, vector origin, int &prim, vector &uv, float maxdist)
e.g.)
float maxdist = 10;
@dist      = xyzdist(1,@P,i@pr,v@uv,maxdist);
@P         = primuv(1,"P",@pr,@uv);

float  xyzdist(<geometry>geometry, string primgroup, vector origin)
float  xyzdist(<geometry>geometry, string primgroup, vector origin, int &prim, vector &uv)
float  xyzdist(<geometry>geometry, string primgroup, vector origin, int &prim, vector &uv, float maxdist)

primuv() (Can get position and color)
<type> primuv(<geometry>geometry, string attribute_name, int prim_num, vector uvw)
<type>[] primuv(<geometry>geometry, string attribute_name, int prim_num, vector uvw)

prim_normal() (Can get primitive normal)
vector  prim_normal(<geometry>geometry, int prim_number, vector uvw)
vector  prim_normal(<geometry>geometry, int prim_number, float u, float v)
vector  prim_normal(<geometry>geometry, int prim_number, float u, float v, float w)

--sample in English

No comments:

Post a Comment