David Wilson

Calx

About Me

専門知識
Developer
業界:
Gamedev

Connect

LOCATION
United Kingdom
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

PolyBridge to Nearest Prim 2019年8月6日4:21

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 2019年8月5日10:28

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 2019年8月4日5:12

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);
}