David Wilson

Calx

About Me

EXPERTISE
Developer
INDUSTRY
Gamedev

Connect

LOCATION
United Kingdom
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

PolyBridge to Nearest Prim Aug. 6, 2019, 4:21 a.m.

Thanks so much for this, so helpful - it's really appreciated. Will give it a try and come back with results.

PolyBridge to Nearest Prim Aug. 5, 2019, 10:28 a.m.

A-OC
Hey, this turned out a bit more complicated than I thought.

The first thing to note is that I stole the node “create_explicit_lines” from the Connect Adjacent Pieces sop. Then, it's a matter of creating the two groups and the attribute as the piece to loop over in the for-each.


Thanks for spending time on this, really appreciated. Huge step forward for me.

In the example scene everything works perfectly, but when i dropped it into my actual work file, SOME of the faces bridge with the incorrect winding, so i suppose my next rabbithole is working out how to unify everything before running the approach you've outline as I have no way of specifying winding order per pair.

As you can see on the attached, the pairs in the blue box bridged perfectly, but the pairs in the yellow box need winding order reversing in order to get the correct result.

PolyBridge to Nearest Prim Aug. 4, 2019, 5:12 a.m.

Sure, example scene attached.

And a bit of psuedocode to explain what I want to do in the loop.

Genuinely appreciate the help

Thanks

Dave


for (prim this_prim in Group_ENDS)
{
    prim closest_prim;
    float smallest_dist = BIG_NUMBER;

    for (prim that_prim in Group_ENDS)
    {
        if(this_prim != that_prim)
        {
            float this_dist = distance(this_prim, that_prim);

            if(this_dist < smallest_dist) 
            {
                smallest_dist = this_dist;
                closest_prim = that_prim;
            }
        }
    }

    polybridge(this_prim, closest_prim);
    remove_from_group(this_prim);
    remove_from_group(closest_prim);
}