# How to group prims by similar curvature

## Recommended Posts

Hi, I'm a relatively new user so forgive me if this is a trivial problem

I'm trying to sort my mesh according to regions of similar curvature.
My aim is to be able to iterate over each region and remesh it smoothly— Ideally, in a way that would preserve boundary points and leave the mesh water-tight.

Below is a link to the work of a Houdini artist whose procedure I'm trying to reproduce on my own meshes.

Any help or a nudge in the right direction would be much appreciated. I've attached a very simple hip file illustrating what I'm trying to accomplish.

Thanks so much!

Measured Partitioning_test.hiplc

##### Share on other sites

I use a lot of VEX for that example.

I recommend trying GroupSOP's "Min Edge Angle" first.

##### Share on other sites

Ahhhhaha wow! Thrilled to have your input!

Didn't know about feeding seam groups to connectivity! Thank you!

##### Share on other sites

This is not a trivial problem as soon as you try on a decently complex model.

Have some semi success using standard houdini hacking node, i need more time and see how i could group small cluster area, smooth the border of each , Im not far but in other hand but to be honest i also feel a math Vex approach will be the better .

Ideally we want to reduce the curvature into a classified sparse collection of seen smooth curves which can cut and minimize the surface into a path of simple
developable surface while preserving the main feature of the original shape.
By considering the neighbour points , algorithm like gradient descent will help to minimizing the energy and avoid the square angle.

Will love to see more feedback from this please..

________________________________________________________________

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

##### Share on other sites

Hi,

You can also select edges using the angle between the faces sharing it:

```float getAngleBetweenVectors ( vector v0; vector v1 )
{
vector v0n = normalize ( v0 );
vector v1n = normalize ( v1 );
return atan2 ( length ( cross ( v0n, v1n ) ), dot ( v0n, v1n ) );
}

int pts [ ] = neighbours ( 0, @ptnum );
foreach ( int pt; pts )
{
if ( @ptnum < pt )
continue;

int prs [ ] = { };

int firsthedge = pointhedge ( 0, @ptnum, pt );
int count = hedge_equivcount ( 0, firsthedge );
if ( count == 2 )
{
int hedge = firsthedge;

do
{
int pr = hedge_prim ( 0, hedge );
if ( pr != -1 && find ( prs, pr ) < 0 )
append ( prs, pr );

hedge = hedge_nextequiv ( 0, hedge );
}
while ( hedge != firsthedge );

vector n0 = primuv ( 0, "N", prs [ 0 ], 0.5 );
vector n1 = primuv ( 0, "N", prs [ 1 ], 0.5 );

float angle = getAngleBetweenVectors ( n0, n1 );
if ( angle >= radians ( ch("minangle") ) )
setedgegroup ( 0, chs("vex_selectiongroup"), @ptnum, pt, 1 );
}
}```

• 3

##### Share on other sites

Is it a different implementation that what SideFx group min edge does excepted off course faster?

Still it doesn't solve the main problem as i describe before. Try to organise, cut and clean polish area of a more complex asset like a statue or let say our pig head is where the challenge is

I could get this on the Pig head

________________________________________________________________

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

##### Share on other sites

The implementation should be similar more or less, but you might want to add maxangle also for completeness. I just wanted to show another way to select edges by angles in VEX.

##### Share on other sites

Slightly off topic from this post but may i ask something?

I struggle to pass some attribute i define in a custom VEX Wrangle to drive some value of others SOP node like thicken or whatever.

I could only make it works with Label using something like  ch("../attribwrangle5/Depthval")

How could i export/write the value of an attribute in an extra-label created?

function like printf only write value to console, right?

Obviously im missing something here it has to be more simple , isn it ?

It s actually drives me crazy... Please tell me how you manage this yourself,

Cheers

##### Share on other sites

huh ? just works for me...

##### Share on other sites

Humm... i guess my eyes are and brain are a little too foggy at the end of this week... ?

Here a portion of my setup, on the leaf itself, thicken node... Any idea to pass a custom attribute here my @thicken to the Labs_thicken local variable depth value?

Thanks you

________________________________________________________________

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

planleaftree_wip_vinc.hipnc

##### Share on other sites

You and those  nodes .
I use only this Vop to take any angel and convert to any Group ..but its just me.

Group.hiplc

##### Share on other sites
10 hours ago, vinyvince said:

Humm... i guess my eyes are and brain are a little too foggy at the end of this week... ?

Here a portion of my setup, on the leaf itself, thicken node... Any idea to pass a custom attribute here my @thicken to the Labs_thicken local variable depth value?

Thanks you

________________________________________________________________

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

mmmm i don't think it does 'local' thickness. It's still just one thickness coz under the hood, the asset extrudes as connected components and not individual components...to use local thickness, it would have to be in Local Control, zscale (or whatever custom attrib)

Soooo....time for DIY: it's not that hard.

vu_PetalThickness.hiplc

##### Share on other sites

Yes, you right its make sense that it use connected pieces, thanks Vusta.

In fact i don t know why I didn t thought about writting a couple of lines of VEX to extrude these  passing my custom attribute and normal , it's really easy

I guess i still haven t broken enough with all these years of software with premade node with content locked

Thanks

9 hours ago, Noobini said:

mmmm i don't think it does 'local' thickness. It's still just one thickness coz under the hood, the asset extrudes as connected components and not individual components...to use local thickness, it would have to be in Local Control, zscale (or whatever custom attrib)

Soooo....time for DIY: it's not that hard.

## Create an account

Register a new account