Grid - detect inside faces / border faces / corner faces?

   1315   2   0
User Avatar
Member
17 posts
Joined: Nov. 2018
Offline
Hi there,

I've got a grid and I'd like to detect the inside faces / border faces / corner faces and create a value attribute which assigns 0 to inside / 1 to border / 2 to corner.

Thanks in advance for any help.
User Avatar
Member
5100 posts
Joined: Feb. 2012
Offline
Hi,

You can do this easily with the Group Create SOP's Unshared Edges option to get the border prims and use this VEX code to isolate the corner primitives from that. The rest will be inside primitives:

int count = 0;
int primindex = -1;

int prims [ ] = pointprims ( 0, @ptnum );
foreach ( int pr; prims )
    if ( inprimgroup ( 0, "borderprims", pr ) )
    {
        count += 1;
        primindex = pr;
    }
        
if ( count == 1 )
    setprimgroup ( 0, "cornerprims", primindex, 1 );

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
17 posts
Joined: Nov. 2018
Offline
Really helpful thank you.
  • Quick Links