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 its surfaces 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.

// INPUT
int num = chi('sections');
vector uv = vertex(0, 'uv', i@vtxnum);

// WEIGHTS
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);

// POSITIONS
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;
}

// OUTPUT
v@P = pos;
download

Downloads

smart_display

Videos

Blending multiple Cross Sections of Sweeps – Houdini Tutorial