How to carve (cut) a continuous primitive in houdini?

   4631   13   0
User Avatar
Member
35 posts
Joined: 6月 2019
Offline
I have a tube with a hole. I want to expand the open edges and increase the hold size. Basically want something like a carve node but for primitive. However I don't really know how to do that. Any help is very much appreciated!.

Attachments:
Capture.PNG (299.2 KB)

User Avatar
Member
8045 posts
Joined: 9月 2011
Offline
Increase the size of the shape that cut the hole in the first place. That's what proceduralism is for.
User Avatar
Member
35 posts
Joined: 6月 2019
Offline
jsmack
Increase the size of the shape that cut the hole in the first place. That's what proceduralism is for.
Thank you for your reply. However, in my situation, I cannot control the shape used to cut the geometry. It is what it is without any construction history.
User Avatar
Member
13 posts
Joined: 6月 2014
Offline
Just an idea :
group the edges of the hole ("unshared edges"), flatten them so you get back a circle, scale it to your needs, construct a new cylinder out of it and boolean that from the original geo ...
Edited by asche - 2022年4月6日 03:18:57
User Avatar
Member
4730 posts
Joined: 2月 2012
Offline
Hi,

You could probably isolate the hole by poly capping it and then extruding that polygon to perform a boolean afterwards like this:

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
35 posts
Joined: 6月 2019
Offline
asche
Just an idea :
group the edges of the hole ("unshared edges"), flatten them so you get back a circle, scale it to your needs, construct a new cylinder out of it and boolean that from the original geo ...
Thank you. I think it's a good idea. However, What I want eventually is to make the hole bigger and bigger and the geometry will get "corroded" completely. So when the hole expand to the ngon in the tube in the picture I uploaded, it should naturally follow the continuity of the surface and continuo to cut the geometry. Sorry for being confusing.
User Avatar
Member
4730 posts
Joined: 2月 2012
Offline
You could probably do a simple geometry traversal using VEX like this:





@P.y = getbbox_max ( 0 ).y;

vector center = getbbox_center ( 0 );
@N = normalize ( @P - center );
@N.y = 0;

int hitprim = -1;
vector hituv = 0;

float threshold = 0.1;
float d = xyzdist ( 1, @P + @N * threshold, hitprim, hituv );
vector p = primuv ( 1, "P", hitprim, hituv );
vector n = primuv ( 1, "N", hitprim, hituv );

n = normalize ( n );
@N = normalize ( p - @P );

float dist = ch("distance");
float stepsize = 0.01;

int iterations = floor ( dist / stepsize );
float laststepsize = dist - stepsize * iterations;

p = @P;
vector v = @N;
for ( int i = 0; i < iterations; ++i )
{
    d = xyzdist ( 1, p + v * stepsize, hitprim, hituv );
    vector p2 = primuv ( 1, "P", hitprim, hituv );
    
    //v = normalize ( p2 - p );
    p = p2;
}

if ( laststepsize > 0 )
{
    d = xyzdist ( 1, p + v * laststepsize, hitprim, hituv );
    vector p2 = primuv ( 1, "P", hitprim, hituv );
    
    //v = normalize ( p2 - p );
    p = p2;
}

@P = p;
@v = v;

After this you can use the Boolean SOP but depending on the geometry and how smooth you want to animate the carving, you might get artifacts on some frames.

The most robust way using the above method would be to delete the inner polygons and reconstruct the ones on the border from scratch using VEX. This is a lot of work

There might be simpler ways though.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
495 posts
Joined: 7月 2005
Offline
Hi,

you can also try to extract the shape (like mentioned before) and contruct a small tube around it. This can be iterated few times.

Here is an example to demonstrate the idea.


Clip combined with distance along geometry node is another option aswell.
Edited by Aizatulin - 2022年4月6日 07:05:49

Attachments:
expand_shape_on_poly.hipnc (193.8 KB)
expand_shape_on_polyA.hipnc (234.4 KB)

User Avatar
Member
35 posts
Joined: 6月 2019
Offline
Aizatulin
Hi,

you can also try to extract the shape (like mentioned before) and contruct a small tube around it. This can be iterated few times.

Here is an example to demonstrate the idea.


Clip combined with distance along geometry node is another option aswell.
This one is pretty good. Didn't know I can make vdb out of points. I feel like this method is a bit slow and rought for my purpose but it defininetly help when I want some organic erosion. Thank you for your help. (Feel like it's also a nice way to bruteforce the shape.)

How would you implement clipping combined with distance along geometry node? It sounds interesting but I'm not sure how to do that excactly.
Edited by hinsunlee - 2022年4月6日 22:17:47
User Avatar
Member
35 posts
Joined: 6月 2019
Offline
animatrix_
You could probably do a simple geometry traversal using VEX like this:





@P.y = getbbox_max ( 0 ).y;

vector center = getbbox_center ( 0 );
@N = normalize ( @P - center );
@N.y = 0;

int hitprim = -1;
vector hituv = 0;

float threshold = 0.1;
float d = xyzdist ( 1, @P + @N * threshold, hitprim, hituv );
vector p = primuv ( 1, "P", hitprim, hituv );
vector n = primuv ( 1, "N", hitprim, hituv );

n = normalize ( n );
@N = normalize ( p - @P );

float dist = ch("distance");
float stepsize = 0.01;

int iterations = floor ( dist / stepsize );
float laststepsize = dist - stepsize * iterations;

p = @P;
vector v = @N;
for ( int i = 0; i < iterations; ++i )
{
    d = xyzdist ( 1, p + v * stepsize, hitprim, hituv );
    vector p2 = primuv ( 1, "P", hitprim, hituv );
    
    //v = normalize ( p2 - p );
    p = p2;
}

if ( laststepsize > 0 )
{
    d = xyzdist ( 1, p + v * laststepsize, hitprim, hituv );
    vector p2 = primuv ( 1, "P", hitprim, hituv );
    
    //v = normalize ( p2 - p );
    p = p2;
}

@P = p;
@v = v;

After this you can use the Boolean SOP but depending on the geometry and how smooth you want to animate the carving, you might get artifacts on some frames.

The most robust way using the above method would be to delete the inner polygons and reconstruct the ones on the border from scratch using VEX. This is a lot of work

There might be simpler ways though.
Thank you very much. I think your method is the closest of what I want. However, your code seems only work for the more "concave" shape. I'm trying to adjust a bit of your code to make it work for more shapes. But that's a great insight from you
User Avatar
Member
8045 posts
Joined: 9月 2011
Offline
hinsunlee
How would you implement clipping combined with distance along geometry node? It sounds interesting but I'm not sure how to do that excactly.

Create a group of points from the points on the edge of the hole. Then use those as the seed points for "Distance along Geometry". Create vector attribute with the distance v@temp = set(@dist, 0, 0);Use attribute swap with P and the vector attribute. Then clip with direction (1, 0, 0). Attribute swap it back again.

Attachments:
distance_clip.png (1.1 MB)
surfdistance_clip.hip (790.9 KB)

User Avatar
Member
35 posts
Joined: 6月 2019
Offline
Jsmack your method is simply incredible.
User Avatar
Member
8045 posts
Joined: 9月 2011
Offline
hinsunlee
Jsmack your method is simply incredible.

it's okay. the edge can get a little jaggy when the mesh doesn't have enough resolution.
User Avatar
Member
13 posts
Joined: 6月 2014
Offline
jsmack, this is awesome!
  • Quick Links