How to carve (cut) a continuous primitive in houdini?
4407 13 0- hinsunlee
- Member
- 35 posts
- Joined: 6月 2019
- Offline
- jsmack
- Member
- 8037 posts
- Joined: 9月 2011
- Offline
- hinsunlee
- Member
- 35 posts
- Joined: 6月 2019
- Offline
- asche
- Member
- 13 posts
- Joined: 6月 2014
- Offline
- animatrix_
- Member
- 4680 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:
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
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- hinsunlee
- Member
- 35 posts
- Joined: 6月 2019
- Offline
ascheThank 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.
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 ...
- animatrix_
- Member
- 4680 posts
- Joined: 2月 2012
- Offline
You could probably do a simple geometry traversal using VEX like this:
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.
@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
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Aizatulin
- Member
- 493 posts
- Joined: 7月 2005
- Offline
- hinsunlee
- Member
- 35 posts
- Joined: 6月 2019
- Offline
AizatulinThis 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.)
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.
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
- hinsunlee
- Member
- 35 posts
- Joined: 6月 2019
- Offline
animatrix_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
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.
- jsmack
- Member
- 8037 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.
- hinsunlee
- Member
- 35 posts
- Joined: 6月 2019
- Offline
- jsmack
- Member
- 8037 posts
- Joined: 9月 2011
- Offline
- asche
- Member
- 13 posts
- Joined: 6月 2014
- Offline
-
- Quick Links