# Smooth out curve shape (Geometry Nodes)

I'm working on something where I create cables that overlap each other. The way I do it now:

• I use two empties, one for the starting point and one for the end point, they float above the plane
• I create a Curve Line between those two points with enough points
• I raycast down from there, the hit position is the new position for the points of the curve (with the radius as offset)

I can add this node group multiple times to have curves going over curves.

This is the result:

As you can see the cable going over the other cable looks very unnatural. It should float a little bit on the left and the right before touching the plane again. Does anyone have any idea of how to make this more natural?

One important thing is that cables don't intersect each other (in an unnatural way).

# Smoothed Geometry Nodes Noodles

I don't want to claim to have solved the task optimally, but the following result is the best I was able to accomplish with Geometry Nodes.

Also, I think that Geometry Nodes are not the optimal tool here. Maybe there are other/better solutions with Physics, but that would be another question...

It should also be noted that this is not a "high precision" solution, but rather a trick/hack, but with a bit of trial and error it can definitely give a convincing result.

In this solution, I use a reusable node group that first projects a curve onto a terrain via raycast. But before I convert this curve into a mesh, I save this curve as a temporary object in the same geometry so that it can be processed with another modifier.

In this step, I use the curve to capture the values for the radius of the cable, as well as the soft transition, which I've called the "falloff" here.

With each subsequent Geometry Nodes modifier that adds another curve on top of it, I also create an additional mesh that I cut out of the terrain and smooth over the existing curve from the previous modifier, using it as the basis for each subsequent raycast. I also save this mesh for the further Geometry Nodes modifiers to be able to create further curves.

Since raycasting alone is not enough here, a combination of raycasting and geometry proximity is used to achieve this smooth transition.

In this way, any number of these Geometry Nodes modifiers can be nested on top of each other.

Only at the end I remove the temporary objects from the geometry.

## The solution step by step

Unfortunately, the node group is not very clear, because it was designed to remain cascadable (so the modifier can be applied as many times in a row as you like).

1. In the first step I simply use the node Raycast to project the first curve onto the terrain. I save this to the geometry so that it can be used in the next modifier. At the same time, of course, I create the cable from this curve (hidden in this image).

2. In the second step (and in all subsequent repetitions) I use the terrain for this, and a placeholder that I create from the previous curve.

This placeholder can be controlled with a value for the falloff and is cut out of the part of the terrain that is relevant for the curve.

3. In all further steps I use the terrain as well as all previous placeholders for projecting the curve, whereby the elevations add up more and more.

## The result

To better illustrate this with the cables, I applied four of these Geometry Nodes modifiers here:

First Cable
(Raycast to Terrain).

Second Cable
(Raycast to the terrain and the placeholder created from the previous curve):.

Third cable
(Raycast to the terrain, the existing placeholder, and the placeholder created from the previous curve):

Fourth cable
(Raycast to the terrain, the existing placeholder, and the placeholder created from the previous curve):

Removing the placeholders

## Rendered Scene

This is how the scene looks rendered:

Of course, it can be further refined if more precision is needed.

And instead of using Empties to create the curves, as a bonus I've also attached a variant that uses Bezier Curves instead:

## The node tree at a glance

• hey thanks, I tried something like this before but using a convex hull, which obviously didn't work. I will dive into what you did so I can replicate it. I probably choose your answer as the accepted one later, but i'm also in the progress of another solution, and I want to compare them eventually if that one succeeds. (I will post it here). Jul 22, 2022 at 13:55
• Second, a small suggestion for your tree (not related to my problem), in the "Create Cable" part of your node, if you add the [Set Material] node there instead of after the [Join Geometry] and expose the Material to the group input, then you can have each cable a different material. Jul 22, 2022 at 13:56
• @clankill3r Good point, thanks for your feedback! ...I am curious about your solution! Jul 22, 2022 at 17:44
• Hi @clankill3r Do you have any news for me? I am really interested in how you solved the task. ;-) Jul 25, 2022 at 19:08
• My way seems not possible. I can detect when a curve is going up or down. I know what to do when this would be programming with syntax. But with the nodes to my disposal I can't tackle this. Here is some of the progress: blend-exchange.com/b/LY5VaEoN Jul 30, 2022 at 19:55