Create curve inside existing tube center

I’m not married to the idea of doing this inside geo nodes, but it’d be a plus. In maya there are plugins to generate a curve inside the center of a curve with a single click.

No clue how I’d approach something like this in blender without many manual steps, but maybe someone here has an idea?
The geometry looks something like this, and unfortunately I need to create the curves after the geo is done and not the other way around.

2 Likes

What are we looking at here? What is the curve that was generated? The squiggly ones or the thicker one?

Again, which ones and why can’t it be done at the start?

the white and green lines inside the wireframe is the curve,

Project midway through, scene already past rigging department, geo has various bindings that do not transfer. I’d rather not go into lengthy pipeline limitations, unfortunately it is what it is. Curves need to be derived from the geo, not the other way around.

1 Like

Select all rings and merge collapse.

2 Likes

Yep, that should do it :slight_smile: I’ll leave the thread open just in case someone done something like this via geo nodes, but this works well enough for me. Thanks!

I think this can be done with geonodes especially if you have the inner tubes in there. The only problem is that while geonodes produces curves within, there is no way to convert those virtual curves to actual “curves” geometry with the geonodes. I really wish that was not the case.

I only have the cylindrical meshes, I’d need to generate the curves inside those geo tubes. I don’t mind converting the geo in the end, it’s just getting the curves (either as edges and verts or actual curves) which was an issue.

The semi manual way above worked fine, I combined a couple of the steps and made it into a button.

Not sure how I’d do it in geo nodes though without selections… it’s a quad mesh, technically I may be able to isolate the ends via topo nodes, but not sure where to go from there. The sides of the tubes varies from model to model to make things more complicated.

1 Like

You can try this setup, but results will depend on face corner indices, so I don’t know if it’s gonna work with mesh generated in different software.

Also try different Index Offset values and adjust Epsilon value in Equal node

tube_to_curve.blend (186.1 KB)

6 Likes

Works wonderfully - for “beveled” curves the sort index just needs to be 0 and it will work. Found a epsilon of .25 will deal with sharp corners… Another caveat is that this can’t deal with triangulated end-caps.

Could not figure this out myself and loving the simplicity of your solution… you’re basically getting vector describing the center of face to mid-point of edge and shrinking any edge that points in roughly the same direction. Very clever.

Thanks!

4 Likes

Building on your example, here is a slightly simplified version using Edges of Corner:


(requires a different Sort Index than other method but seems to work)

Thanks again!

4 Likes

This is amazing! Works like a charm, even with the jumbled mess I had to work with. You rock!

curvespline

2 Likes

Just want to add, this node https://projects.blender.org/blender/blender/pulls/104623
And blender build with this https://builder.blender.org/download/patch/archive/blender-4.0.0-alpha+main-PR104623.e54e504146cb-windows.amd64-release.zip
Is designed probably for the same task as in here/
But it has not yet been accepted, as it is considered too little applicable in procedural modeling

3 Likes

Thanks for the link! Well, I hope they change their minds, I sure would use a ring select node from time to time.

Thanks, very good. Is there a way to also merge the caps of a tube? If it happens to be created with caps.

1 Like

I’d just delete anything that’s not quads beforehand.

1 Like

Hey everyone,

Thanks a lot for posting this information, very helpful.
I’m doing some tests in 4.0 but I’m getting some really funky results (using the file higgsas provided). When I open up the scene the tubes are being converted perfectly fine as expected. However, as soon as I apply the modifier to any different tube geo that wasn’t included in the demo file or introduce any new geo to the existing pipes in the provided scene via extrude, the setup seems to break. Am I missing something here?

Thanks

I’m using it on cylindrical geo that was derived from curves originally and for those cases it works very well - for other custom geo try the solution from Zeroskilz, that seems to work as well if tubes have been extruded


spline

I cant seem to replicate that effect on my end no matter what I try, (even with Zeroskilz setup) if I use the modifier on geometry made from a curve it works, but as soon as I extrude it breaks. For my setup I am also not wanting to generate curves from perfect pipes, I want to generate a curve down the centre of any geometry that has “pipe-like” topology even if the topology is non-uniform Like the image below:

Apologies, I am not quite good enough at nodes to fully understand the inner workings of the setup and if this is even possible. I am also not sure what you are using for your “sort index.” I have tried numbers 0 and above it does not generate the desired result for me.

I don’t know why it wouldn’t work on certain topos to be honest, Higgsas or Zeroskilz are way more knowledgeable. There’s an epsilon value that you can play with but in most cases .5 or whatever works well enough for me. I extruded this one on both ends and pulled it around but it’s holding up alright -
spline2
To be honest I only have a vague idea how the setups work, but I never went into the nittygritty as it worked for what I needed it for (plus, I’m don’t have heaps of experience with geo nodes)

With open ended cylinders you can always just use python though -

import bpy

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
bpy.ops.mesh.select_non_manifold(extend=False, use_wire=True)
bpy.ops.mesh.loop_multi_select(ring=True)
bpy.ops.mesh.edge_collapse()
bpy.ops.object.mode_set(mode='OBJECT')

Need it to work in geo nodes unfortunately.
Just to confirm, if you manually create a cylinder using shift + A, delete the caps and extrude it a few times, then add the modifier, does it work for you?

This is the situation that I would need the setup to work for. But for the life of me cant seem to get it functioning reliably on custom tube geometry.

Here’s a scene with a few examples of it failing on even the most simple pipe geometry:

test_01.blend (1.1 MB)