5
$\begingroup$

I'm looking for a way to generate bunch of cables chaotically crossing each other in a cluster, something like this ...

enter image description here

... but there is a principal for start / end points. All cables should start from a specific point and end inside a specific places. There are also some obstacle objects. Something like here ...

enter image description here

Originally I used geo-nodes with Simulation Zone to let spline grow from certain place, but it ended up with splines penetrating a boundary or slow down growing close to obstacle or accumulate at some places.

So ... I used another approach ... I generated a point cloud, connected them by curve, that seems to be a promising direction.

enter image description here enter image description here

Now I wanted to use obstacle objects (based on Geometry Proximity) to move curve points from areas of obstacles to let cables lay around obstacles, but I don't know how.

Notes:

  • if there is completely different efficient way to reach the result I'm open to it
  • cables will be used statics (not animated)
  • visually they are a simple wires (no special ends)
  • also I would like to avoid cable penetrating each other if possible

I thought it could be just enough to use Geometry Proximity just to push some points away. Thanks to Markus von Broady's answer, it worked for my study case ...

enter image description here

... but there is was quite a lot of intersections in real project ...

enter image description here

... it means a lot of manual adjustments ... and when adjustments are done the client changed obstacles position :)

enter image description here

So my Q for GN solution persists :)

$\endgroup$
6
  • 1
    $\begingroup$ Not an answer, but you're looking for pathfinding algorithms. This is a complex topic, but well-researched. Here is a link to get you started : redblobgames.com/pathfinding/a-star/introduction.html Also look up Djikstra for a starter on shortest path algorithms. $\endgroup$
    – Hadriscus
    Oct 23, 2023 at 17:28
  • $\begingroup$ Back in 2020 I did something similar: twitter.com/Syziph/status/1329860910920437760 I mentioned something about Grease pencil and probably Soft body physics. If I remember how it was done I'll get back to you. $\endgroup$ Oct 23, 2023 at 21:00
  • $\begingroup$ i am not sure how the "should not penetrate" fits too "should all start from a specific point"? What is the more important rule? if it is "should not penetrate" i would try it with softbody + pin group and some randomization. For that i would use animation nodes because GN isn't really usable to animate empties. Another advantage is that AN can also use script nodes which makes other things also much easier + quicker. $\endgroup$
    – Chris
    Oct 24, 2023 at 4:56
  • $\begingroup$ @Hadriscus Thanks, are you sure the "pathfinding" or "shortest path" (already implemented in blender) is the right way? Cables should be randomly curved on their way, so it doesn't seems to be done by this approach ... Am'I wrong? $\endgroup$
    – vklidu
    Oct 24, 2023 at 11:18
  • $\begingroup$ @RumenBelev Thanks, yes I tried it with Cloth Sim that works better for this objects imgur.com/TLTrCVl ... it works kinda, but it is not too much flexible and wasn't an easy to avoid penetration (and keep flexibility). I wanted to use this technique, to make it more flexible, but it doesn't collide. $\endgroup$
    – vklidu
    Oct 24, 2023 at 11:18

1 Answer 1

8
+100
$\begingroup$

Although it's most likely possible to simulate cable tangling with Geometry Nodes it is currently too complicated to set up due to lack of physics simulation operators. I would love seeing it executed in Geometry nodes in this thread at some point in the near future.

In this solution we are going to use the currently available Soft Body Physics simulation. It is preferred due to the availability of Collision settings for the points of the simulated mesh. (Soft Body is basically collision balls connected with springs).

Although it looks quite complicated the concept is fairly easy to understand and developed further. Back in the days - I designed the tangling in such a way that the colored wires form the year 2020:

enter image description here

Simulating the whole tangling process is not possible due to time and program limitations so we will take an artistic shortcut and draw our approximately desired look of the cables from the Top View using Grease Pencil.

  1. First let's block out the Scene by placing a floor plane and some cylinders:

enter image description here

They will also participate in the simulation so add Collision Modifier for each one of them. You could leave the default collision settings and adjust them later - mostly the Thickness Outer parameter.

  1. Now go to Top View, choose an appropriate Viewport display and draw a continuous squiggly line. The main idea is just to draw while avoiding intersections with the cylinders. You can cross the line itself as many times as you want. You can draw multiple lines based on how many individual cables you want. In this case I drew 2 separate lines. The coloring is optional and I did it for illustration purposes:

enter image description here

[Easy Mode] To make things easier one can skip the Cylinders part and work with the Floor as the only collision object.

  1. You can sculpt the Grease Pencil Strokes using Grab and Smooth brushes correcting intersections with the collision objects and making the curved lines smoother. [Note] This look will not remain exactly the same due to the simulation so don't spend too much time sculpting. Once you are happy with the look you can proceed to converting the Grease Pencil object to Curve object.

  2. The Curve object needs to be resampled using Geometry Nodes. Imagine this Curve as a bead string and each bead has a constant radius slightly larger than the radius of the cable. I created a small circle to help me decide the resampling Length value which is double the circle radius - in this case 6.66 cm. The node setup is Applied to the Curve object:

enter image description here

  1. Apply the Geometry Nodes modifier to the Curve. Usually this works by choosing in the 3D View - Object > Apply > Visual Geometry To Mesh. This will convert the Curve to Mesh:

enter image description here

  1. [Optional] Add Hook Modifiers to both end vertices of each string inside the Mesh. In my case there are 4 Hook Modifiers in total. You could add more vertices to the Hooks if needed. Make sure to add the vertices assigned to the hooks - all into a single Vertex Group and name it "Goal". This way we can animate the ends of the cables during the simulation and position them where we want.

  2. We can now add Soft Body Modifier to the Mesh The Soft Body Settings are shown bellow, but these can be tweaked according to your scene dimensions and preferences:

enter image description here

The most important setting is turning on the Self Collision and setting the Calculation Type to Manual with Ball Size set to slightly less than the radius of the small circle we used for choosing the resampling length.

  1. Now you can push the Floor slightly down. You can play with the distance. [Optionally] Add a Force Field Empty of type Force, Shape - Plane and animate the Strength from 0.1 to 0 and Noise Amount from 3 to 0 for the first 10 frames of the simulation. Also animate the Hook Empties to place the ends of the cables at the desired final positions:

enter image description here

  1. Run the simulation. Usually in 50 frames the result becomes stable. The simulation is a bit slow due to the enabled self collisions of the balls ("beads"). The balls will try to push themselves away from each other while tangling the strings along the process. The end frame should looks something like this:

enter image description here

  1. To generate the cables we are going to add Geometry Node Modifier to convert the Mesh back to Curve, smooth it out a little bit and add some thickness to the Curve. Here is the node set up, which also includes adding different materials to the cables:

enter image description here

Examining the simulation from all sides shows variety of tangles:

enter image description here

One can apply the simulated result and edit the mesh refining it even further, before applying the final Geometry Node Modifier.

enter image description here

Lastly you can download and study the .blend file from the tutorial:

$\endgroup$
6
  • $\begingroup$ OK :) Right, Soft Body works very well ... I didn't notice it can sim edges (those make it much easier than Cloth Sim, thanks for that) ... Also thanks for detailed step by step tut :) Very descriptive. I'm not going to mark as accepted (not yet ... I still believe in more generative solution) ... but definitely I'm going to reward you by a bounty (since available). Thank you for your help and time I'm going to use it for my project :) $\endgroup$
    – vklidu
    Oct 25, 2023 at 10:19
  • $\begingroup$ Hi vklidu, thank you for rewarding my efforts :) Do you think there is a better approach than using Soft Body physics? Anything specific in mind? There are a lot of Geometry Nodes experts that may get interested in joining if pointed at the correct direction. $\endgroup$ Oct 25, 2023 at 17:10
  • 1
    $\begingroup$ Although lacking some constraints - here is brilliant example of string physics with Geometry Nodes by Seanterelle - youtube.com/watch?v=h5_uA9sOw7g $\endgroup$ Oct 28, 2023 at 0:53
  • $\begingroup$ Thanks :) I will check that, I also saw some basics ... in my case I can fake it (it doesnt has to be super real sim) I just need to avoid intersecting (so I asked also here that partly works). I'm also on a way to play with "shortest path" ... $\endgroup$
    – vklidu
    Oct 28, 2023 at 20:58
  • $\begingroup$ Плюс едно for combining grease pencil with soft body physics, and with geo nodes. $\endgroup$ Dec 16, 2023 at 5:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .