WIP - Poly Slice [Houdini Utility]

   3710   15   1
User Avatar
Member
25 posts
Joined: May 2013
Offline
Hello everyone,

Over the past few years I've been working on a masterclass for Houdini and one of the problems that I often ran into
is the general lack of a reliable method to cut polygon surfaces using a simple input curve, surface or even just a point.

Yes there are several nodes that do this to some extent, but they all have their issues.

  • The Boolean SOP can cut Seams but requires an intersecting surface to do so and it has serious issues with coincident faces.
  • The Intersect Stitch SOP can cut points into edges but lacks precision when working with surfaces that are not on a cardinal plane.
  • The Knife SOP lacks the ability to make fine cuts because it just cuts in an infinite slice.
  • And the PolySplit while powerful, can only handle one cut at a time, and is designed to function with a handle in the interface.

None of these nodes are flexible enough and always require some form of wrapper or support structure to actually do what I needed them to do...

Cut very specific edges and points into surfaces using points, curves or cutting surfaces... without breaking, over-cutting or creating bad geometry.

So I analysed and combined together the best of the above to create the PolySlice SOP






Here is a list of features - UPDATED:

  • This node can inject points or cut a polyline or surface, with a second point, line or surface.
  • It can cut surfaces at any angle, it has no problems with non-cardinal angles.
  • It ignores coincident faces, so no zero space errors like with the boolean node.
  • It automatically cleans up overlapping cuts.
  • It generates groups to mark points and edges that are newly cut.
  • It work at various levels of precision and can Snap the cutting input to the target geometry's edges if required.
  • It keeps Attributes and Groups intact and propagates them through.
  • It can cusp the edges on cuts on if enabled.



It also includes a high precision mode, which presets the snap and cutting tolerances to work very well at cutting complex geometry at very fine sizes

It works mainly by utilizing the capabilities of the PolySplit SOP and the Intersect Stitch SOP.
I'm currently working on refining the tool, testing and cleaning up edge cases.
But it is especially powerful when precision cuts and or point insertions have to be made with a secondary input.

Some weaknesses of the node:

  • Its slower than some other nodes when cutting surfaces, because the Poly Split is not compilable.
  • Should be ran through a for-each loop per connected piece when dealing with intersecting masses of polygons because the non-connected intersection between these primitive surfaces can not always be properly resolved. - Solved
  • It can't cut through the double edge connecting the inside and outside of a single hole polygon (still working on fixing this). - Solved

Here are a few GIF files to show it in action.

- This example shows how it can cut two complex polygon surfaces with one another.



- In this example you can see how we can using partial slices, but also layer slices to create multi-directional splits.
Even if they end in the middle of a primitive.



- This example shows how the snapping feature works to help cut up a cube, using a simple curve SOP as an input.



- Here the utility is in Curve mode, and is set to cut the curve using a polygon surface.

Edited by Erwin Heyms - Sept. 25, 2021 18:58:46

Attachments:
Polyslice.png (168.4 KB)
PolycutHoleFace.gif (4.8 MB)
SlicePartial.gif (1.1 MB)
CuttingACubeWithACurve3.gif (6.7 MB)
AttribsAndCuts.PNG (241.1 KB)
SliceCurve.gif (1.6 MB)
PolySliceToy.PNG (115.9 KB)
PolySliceToy2.PNG (260.7 KB)
FloorLayoutCut2.PNG (343.6 KB)

User Avatar
Member
11 posts
Joined: Oct. 2020
Offline
Awesome work!
If I properly understood the description, a possible usecase would be interesting recursive greeble patterns(if used inside of a for each loop), similar to this unreleased tool by Simon Holmeda [youtu.be].
User Avatar
Member
25 posts
Joined: May 2013
Offline
volodXYZ
Awesome work!
If I properly understood the description, a possible usecase would be interesting recursive greeble patterns(if used inside of a for each loop), similar to this unreleased tool by Simon Holmeda [youtu.be].

It can be used to recursively cut geometry, yes ​

Its one of the first reasons I created a tool like this.

Initially I used booleans, and this works well enough but only if you cut lines into a surface and this cut intersects with and to some extent overlaps the plane you are cutting.

I needed it to cut rooms into the floor shape of my building using curves:



The boolean method worked well for cutting walls into floors if both ends of the cut were in empty space, outside the mesh surface.

But its tends to over-cut or under-cut due to precision issues if you end it on an edge in the middle of your surface.
And sometimes, unpredictably doesn't even cut at all, if the surface is not flat or at a non-cardinal orientation.

Plus the boolean method simply lacks the ability to inject points on the edges of a mesh. The intersect stitch can do this but only works reliably on poly edges for similar reasons, it tends to fail on non cardinal surfaces :/


So the PolySlice Utility includes a snapping feature for edges and points to help ensure proper cuts.

It processes each primitive of the mesh separately in a step by step manner, cut by cut.
Which is required to make the PolySplit SOP work procedurally.

But it also ensures primitives are properly injected points before they are cut, so it always ends a cut on an edge and at its desired point positions.

The other issue with the native SOPS is that if you want to only inject points or make cuts in a complex 3D environment, it quickly runs into issues. Here is an example of an earlier version of the tool before I decided to remake it into its current form.

I built it to solve this specific problem, but this early version could only cut horizontally aligned surfaces.



I needed it to cut rooms adjacent to one another. If one room had a corner or a cut in the wall, the adjacent room also needed to have this.

Plus as you can see above, it had some other issues with hole polygons I wanted to avoid.

So I did some more testing of the nodes I was using, re-designed it to tackle each part of the cutting process separately.
To make sure it had more flexibility in what it can process and added more methods to control the cuts.


Edited by Erwin Heyms - Sept. 24, 2021 05:13:41

Attachments:
CleanPrimSurfaceCutting.gif (1.8 MB)
cuttingV2_3.gif (4.3 MB)
buildiongProject.PNG (789.1 KB)

User Avatar
Member
25 posts
Joined: May 2013
Offline
A quick update, this evening I fixed the hole polygon issue as far as my tests have shown.
I'll do more testing to be certain it is fixed.




It basically has to identify every location a cut intersects with a double edge.
This is an edge where a hole polygon connects the inside and the outside of the single primitive surface.




The old method didn't keep this edge separated for the PolySplit SOP to identify so I could connect to the vertex on either side.
Which would result in this:




Now it does.

Attachments:
holePolygon.PNG (444.0 KB)
unknown - 2021-09-24T232045.727.png (313.0 KB)
unknown - 2021-09-24T232322.620.png (231.5 KB)
unknown - 2021-09-24T232410.548.png (579.7 KB)

User Avatar
Member
25 posts
Joined: May 2013
Offline
Here is the latest version of the Poly-slice.

Since the contest thread is now closed I will update it here.

Changelog - v1.2:

I fixed a bug which could crash the poly split sop in the asset when cutting consecutive cuts on the same primitive, if a secondary cut ended on the edge from a previous cut. In this specific situation the poly-split node could potentially be assigned the wrong primitive to cut. It should now properly assign the correct primitive.
Edited by Erwin Heyms - Oct. 1, 2021 16:40:26

Attachments:
EHA.UTIL_PolySlice.1.2.hda (260.4 KB)

User Avatar
Member
699 posts
Joined: Feb. 2016
Offline
Hello Herwyn,
I'm experiencing a weird issue with 1.1

In some occasion it's weirdly slow: for example if I load up the example project you provided and I let cook one of the example, even a very simple one, the first time it would take quite a while (almost 1 second).
Now, if I disconnect all the inputs, and reconnect them, without changing any parm, the re-cook would take a breeze, like expected for such a simple geometry. Even when I move the input curve with a transform node, the cutting is real-time.
If I instead change the name of the polyslice node, it would cook again pretty SLOW.

Very weird issue.

Attachments:
polyslice_random_slowness.JPG (211.3 KB)

User Avatar
Member
699 posts
Joined: Feb. 2016
Offline
I'm also testing Polyslice with some high-res polyline cutter, like shown in the image.
I can't get it work properly: it seems to skip some cuts.
Would you please have a look at the attached example file and see if I set it up correctly?

cheers

Attachments:
polyslice_test_setup.JPG (59.9 KB)
polyslice_test.hiplc (175.7 KB)

User Avatar
Member
25 posts
Joined: May 2013
Offline
Andr
Hello Herwyn,
I'm experiencing a weird issue with 1.1

In some occasion it's weirdly slow: for example if I load up the example project you provided and I let cook one of the example, even a very simple one, the first time it would take quite a while (almost 1 second).
Now, if I disconnect all the inputs, and reconnect them, without changing any parm, the re-cook would take a breeze, like expected for such a simple geometry. Even when I move the input curve with a transform node, the cutting is real-time.
If I instead change the name of the polyslice node, it would cook again pretty SLOW.

Very weird issue.

I'm not sure, I've noticed this as well, but this may be due to the compiled network inside the node re-compiling and validating its code. Afterwards as long as the node remains unchanged the node is faster. You can try to disable the compiled toggle on the asset, it will slow down general cooking but will bypass the compiled code.
User Avatar
Member
25 posts
Joined: May 2013
Offline
Andr
I'm also testing Polyslice with some high-res polyline cutter, like shown in the image.
I can't get it work properly: it seems to skip some cuts.
Would you please have a look at the attached example file and see if I set it up correctly?

cheers

There are two main problems I found.

1 - An issue with the level of precision, and that's something i'm trying to fix using your example. as some curves were not detected as being on an edge point or valid surface.


2 - When using High Precision mode, the tools snapping and detection range for intersections is greatly decreased.
This works fine with cutting surfaces, but not so well with splines. as a result the intersect stitch misses some intersections.
I'm going to build a limitation into the tool so high-precision mode won't be available when not cutting with surfaces. Or ill change the tolerances it sets.

Here below is a result as it stands now, but i'm still looking into it.
This kind of geometry intersection is probably still better when done with the boolean node as you showed in your picture. Because in the end your goal is to cut out the overlap at a cardinal angle, something the boolean is pretty much specialized in. However, I do want my asset to be able to tackle this kind of situation.

I'll work a bit more on this and get a new version out when I get a proper fix.

Edited by Erwin Heyms - Oct. 3, 2021 18:01:30

Attachments:
solution.PNG (310.2 KB)

User Avatar
Member
699 posts
Joined: Feb. 2016
Offline
Erwin Heyms
I'm not sure, I've noticed this as well, but this may be due to the compiled network inside the node re-compiling and validating its code. Afterwards as long as the node remains unchanged the node is faster. You can try to disable the compiled toggle on the asset, it will slow down general cooking but will bypass the compiled code.
Maybe it's also about all those wrangles?
If you look at Performance Monitor in the image, all those wrangles add up to a considerable time. If I rmb correctly, when Polyslice performs as expected, those wrangles have 0.0000s cooking time).

Erwin Heyms
This kind of geometry intersection is probably still better when done with the boolean node as you showed in your picture. Because in the end your goal is to cut out the overlap at a cardinal angle, something the boolean is pretty much specialized in. However, I do want my asset to be able to tackle this kind of situation.

I'll work a bit more on this and get a new version out when I get a proper fix.

For now I'll use Boolean, but eventually I'd like to use your tool, as I need to perform this kind of operation on 3D surfaces, not simple planes, and also I need some reliability with coinciding borders, which, I if understand well, your tool already have.
User Avatar
Member
25 posts
Joined: May 2013
Offline
Andr
For now I'll use Boolean, but eventually I'd like to use your tool, as I need to perform this kind of operation on 3D surfaces, not simple planes, and also I need some reliability with coinciding borders, which, I if understand well, your tool already have.


The Polyslice tries to snap cuts to edges, if a cut overlaps (parallel) to an edge it will either ignore it or insert points.
The main issue is the tolerances and the scale of primitives and density of the elements used to cut.
If the snapping/tolerance is set strong enough, the snapping feature will simply snap cuts to edges which often ensures clean cuts. But at higher strength this may result in undesired snapping if the cuts are very dense in detail.

The lower the snapping distance/strength, the more precise the tolerances have to be to compensate to make correct cuts.
However, at a certain scale the Poly Split SOP and the Intersect Stitch SOP both start losing accuracy. The Boolean SOP can deal with a higher degree of precision but there are still limits.

Due to these inherent limitations with the default sops in Houdini, the tool needs to be configured to work at the scale of the geometry you are cutting and the resolution of the cutting geometry, so the snapping and cutting precision needs to be set accordingly.

I'm working on a V 1.3 and I've managed to make your example work well enough, however I still need to make sure my alterations can scale, so it will be a few more days before I can release this version.

Edited by Erwin Heyms - Oct. 5, 2021 15:07:05

Attachments:
curveCut.PNG (153.4 KB)

User Avatar
Member
191 posts
Joined: Sept. 2012
Offline
Im satisfied of the polycut for precise cutting, have to use tricks and most of time increase resolution. Using a signed distance and dot product could help but it's not always applicable, so I gave a try after reading your note.

Thanks for your effort, your tool computes way slower (maybe 5 or 6times) and output result of the right.
My previous method output left. No crease subdivision level was used, I also tried the high precision mode in your HDA but to my surprise result were worse. So for now, I'm afraid will stick with how i did before

Attachments:
bugs.PNG (710.7 KB)

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
25 posts
Joined: May 2013
Offline
vinyvince
I also tried the high precision mode in your HDA but to my surprise result were worse. So for now, I'm afraid will stick with how i did before

I've not had much time to work on 1.3 since my last update. I'm going to try to get back to it this week.

The polyslice's main purpose is to allow for precision cuts. Like cutting floors, walls or curves and cleanly injecting points, For this, it works very well and at this resolution the snapping features work at their best.




The node works per primitive to inject points, and then performs a slice per affected primitive if required in a second stage. Because it runs per primitive, cutting high resolution geometry for this reason is slower.
I've also constrained the data I feed to the poly-split SOP to allow it to perform sequential cuts cleanly.


However, if set to a low snapping strength, the tiny segments that are created in corners and on near perpendicular edges are harder to keep clean. This is why I created the high precision mode preset. But even with that,its a tricky issue.
So as a result, slices like in your example picture really push the cutting capabilities to their limits.

You could probably get your above example with a VDB to polygon tube shape, and then use a boolean to cut out the overlap with the original mesh.

Also I notice that in the example picture you seem to have set the Poly-slice into Poly line mode as your input source; because every cut is output as a polygon edge... Which won't give you the result you are looking for either way...
Maybe you did this to visualize the issue better ?




In the the end though...

The Poly slice's main purpose isn't to replicate the Boolean sops raw speed and cutting capabilities.
But to create specific, precise cuts, such as on many of the low res cases in the example file.

The high resolution cutting of complex surfaces like in your picture is slower and more sensitive to errors, because the lowered snapping strength and tolerances make the final result less predictable. It could run into tiny cuts that are below the snapping precision of some of the component nodes, like the intersect stitch, or the poly-slice itself and this is a hard limit where the node becomes more prone to errors.

I'm working on making cutting like this more reliable.
But I won't be able to make it any faster, at least, not without overhauling the node for this specific purpose or creating an alternative cutting method in the asset...

So basically, the Poly-Slice works best with higher snapping strength and tolerance values to guide the cutting behavior, so it avoids creating these tiny cuts altogether.
Edited by Erwin Heyms - Oct. 11, 2021 05:19:33

Attachments:
FloorLayoutCut2.PNG (343.6 KB)
PolylineCutSource.PNG (250.8 KB)

User Avatar
Member
25 posts
Joined: May 2013
Offline
Thanks so much for 3rd Place



I'll try to finish up my adjustments on V1.3 this week and publish it here.
Edited by Erwin Heyms - Nov. 2, 2021 07:57:53

Attachments:
Thanks SideFX.PNG (157.0 KB)

User Avatar
Member
25 posts
Joined: May 2013
Offline
Now releasing the V1.3 PolySlice

--------------------------------------------



--------------------------------------------

See the attached file :

New Poly Split v1.3 features:

I noticed there was a big demand to cut complex cuts into larger and denser surfaces.
But the original PolySplit method was not always suitable for this due to its slower processing speed.
So I integrated a new cutting method using the Boolean Shatter,
So the tool now has two output methods for Surface to Surface Cutting, the PolySplit and the Boolean Shatter Cutting Methods.


- The PolySplit Method:

Is very versatile and can cut with polylines or surfaces.
It also supports snapping to make cutting surfaces easier with input curves that are provided procedurally to the Utility.
While it's slower, and not well suited to cut larger geometries, it excels at making very precise cuts for precision tasks.
And thanks to its polyline cutting feature, it can handle surface cuts that no other SOP in Houdini can handle.

- The Boolean Shatter Method:

This new method is much faster, very accurate and can cut shapes and edges into surfaces without touching the edge of the shape.
It automatically runs a cleaning pass on the boolean to ensure clean cuts, and supports the same features as the Polysplit method, like masked cutting.
While it, does not support snapping like the PolySplit method, it works great to cut large dense polygon meshes with surfaces.


- Auto Precision Limiter:

When dealing with very small or large geometry, some of Houdini's nodes become unstable.
The Auto Precision Limiter feature analyzes the input geometry provided to set some sensible limits on the tool.
Edited by Erwin Heyms - Feb. 11, 2022 17:53:28

Attachments:
EHA_PolySlice_v_1.3.rar (1.7 MB)
PolysliceV1.3.png (1.3 MB)

f4xc0rp
Member
4 posts
Joined: Oct. 2019
Offline
Super nice work, super thanks!
  • Quick Links