Jump to content

Recommended Posts

Looks like you were on the right track with the use of half edges. You could approach the problem using a primitive wrangle as follows:

// Array of neighbouring prims
int prim_neighbours[];

// Loop through the primitives vertices
foreach (int vtx; primvertices(0, @primnum))
{
    // Get the forward half edge for the vertex
    int this_hedge = vertexhedge(0, vtx);
    
    // Only process if a valid half edge
    if (hedge_isvalid(0, this_hedge))
    {
        int equiv_hedge = this_hedge;
        
        // Loop through equivalent half edges and get the neighbouring prims
        do
        {
            equiv_hedge = hedge_nextequiv(0, equiv_hedge);
            
            if (equiv_hedge != this_hedge)
            {
                // !! Get your attribues here !!
                push(prim_neighbours, hedge_prim(0, equiv_hedge));   
            }
        
        } while (equiv_hedge != this_hedge);
    }
}

i[]@neighbours = prim_neighbours;

 

Edited by Wooshum
Code mistake
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you very much Dan! Now, I am able to see the list of the neighbours on points but still, I can't see it in the primitives. Do you know what can be wrong?

Share this post


Link to post
Share on other sites

another way:

//primwrangle

int pt = addpoint(0, @P); //center for each primitive
removeprim(0, @primnum, 1); //we just want the new created points

connect adjacent pieces with type set to adj. points. set radius to correct value to not get too many connections. unit icosahedron would be 0.3 for example

//pointwrangle

int nb[] = neighbours(0, @ptnum); //this array is the neighours for each point. point numbers correspond to prim numbers

 

Share this post


Link to post
Share on other sites

Dan, one more question. It seems that now I have a list of points and a list of primitives with 5 attributes instead of three.  I guess it is because I found the adjacent points. How can I create a list with the adjacent primitives - triangles? 

Share this post


Link to post
Share on other sites

The number of neigbouring primitives returned is dependent on the number of edges each primitive (as in face/polygon) shares with another primitive. So in your example a Dodecahedron will return 5 neighbours per prim as each face has 5 shared edges. If you start with a Icosahedron you will return 3 neighbours per prim, etc.

image.png.4a430eaa1aef9a5400f990a541d41c36.pngimage.png.23c2baab20c557dec9eeb7d6d2c1a831.png

Primitives in houdini are n-sided polygons so can have any number of shared edges.

Share this post


Link to post
Share on other sites
Posted (edited)

Building from myself some hardsurface procedural methods, one issue i have.. Is it possible to filter generated clusters? Merging small cluster which area is too small or area too stretched to the most adjacent cluster?

Off course, it's also hard to know if the cluster has to be removed or not . I mean in mure term of design, the size should not be the only element to take into consideration, but that's off couse another more complex question :)

Might i ask if that speak to you ?
 

 

Thanks you !

 

image.thumb.png.98d4a491f807ec439b7539a3a49decbc.png

@Wooshum @3dome @f1480187 @petz  @konstantin magnus

proceduralplayer_wip.PNG

________________________________________________________________

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts

 http://fr.linkedin.com/in/vincentthomas

Edited by vinyvince

Share this post


Link to post
Share on other sites

Thanks @konstantin magnus. Totalyl agree with you on your comment, sadly here the clustering is not based on the voronoi diagram, i know already these tricks but i can't apply it here. Even with clean geo, it could creat some small pocket areas you may not want.

Basically how i see will be to loop to eachpiece, if  the area or stretch value is under a certain value, look around (point cloud ) to find the neighbour cluster, pick the best one, and change the cluster attribute value of the considering unwanted area.

I guess there is not need to shift the cluster value as some will be missing in the total amount.

Now will be to vexify this method. Sam thing coudl be apply to merge small group actually.

 

A second  probably more tricky point is,  how to define "stretched area"?

One with quite different ratio? Not easy in a non planar space... At least when you have an artistic approach :blush:

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×