Approximating subdivision surfaces

calendar_today

26.06.2024

label

Modeling

mouse

Houdini 20.0

Description

Iteratively approximating a subdivision model to match a target surface after subdivision.

1 Code

Calculating the subdivision limit surface.

C
        int prim_hit;
vector uvw;
xyzdist(0, v@P, prim_hit, uvw);

int patch;
float patch_u;
float patch_v;
osd_lookuppatch(0, prim_hit, uvw[0], uvw[1], patch, patch_u, patch_v);

vector pos;
osd_limitsurface(0, 'P', patch, patch_u, patch_v, pos);

v@pos = pos;
    

Displacing the surface along the normals by the signed distance between the limit surface and the target surface.

C
        int pr;
vector uvw;
float d = xyzdist(1, v@pos, pr, uvw);

vector pos = primuv(1, 'P', pr, uvw);
vector dir = normalize(v@pos - pos);
vector nml = primuv(1, 'N', pr, uvw);

float s = sign(dot(dir, nml) + 0.01);

v@P -= v@N * s * d;
    
download

Downloads

link

Related articles

favorite

137

label

Modeling

Adaptive Resampling of Curves

favorite

281

label

Modeling

Applying Scales to Mesh Surfaces

favorite

187

label

Modeling

Blending COPs SDFs into 3D Volume

favorite

271

label

Modeling

Branching Subdivision Curves

favorite

129

label

Modeling

Circuit Networks

favorite

331

label

Modeling

Constructive Solid Geometry Tool