Copy meshes to primitives

calendar_today

02.12.2023

label

VEX, Modeling

mouse

Houdini 19.5

Description

Copying meshes to their own polygons using VEX.

1 Code discussion

The mesh is copied multiple times based on the number of the polygons of the target mesh. The copy node creates an individual copynum-attribute which is used to ad.

vector bb = relbbox(0, v@P).zxy;
int copy = prim(0, 'copynum', i@primnum);

vector pos = primuv(1, 'P', copy, bb);
vector nml = prim_normal(1, copy, bb);
float area = primintrinsic(0, 'measuredarea', copy);

v@P = pos + nml * bb.z * sqrt(area);
v@Cd = bb;
download

downloads