Blending multiple cross sections

calendar_today

06.05.2024

label

Modeling, VEX

mouse

Houdini 20.0

Description

Houdini's sweep node supports multiple cross-sections. We isolate one of them to blend into all others using multiparm-blocks with curve ramps and VEX.

1 Code

Weighted average positions along the length based on dynamically created channel ramps of each cross section.

int num = chi('sections');

vector uv = vertex(0, 'uv', i@vtxnum);

float weights[];
for(int k = 0; k < num; k++){
    float weight = chramp('weight' + itoa(k), uv[1]);
    append(weights, weight);
}
float weight_sum = sum(weights);

vector pos = vector(0.0);
foreach(int i; float w; weights){
    string grp = "@crossnum==" + itoa(i);
    vector pos_i = uvsample(1, grp, 'P', 'uv', uv);
    pos_i *= weights[i] / weight_sum;
    pos += pos_i;
}

v@P = pos;
download

Downloads