BenjaminSauder / EdgeFlow

Blender tools for working with edgeloops
GNU General Public License v3.0
1.34k stars 95 forks source link

EdgeFlow

This addon adds operators to blender which help when dealing with curved shaped meshes.

Feel free to create issues, file requests etc. but be aware of that I might not find time to work on this as much as I'd probably need to.

Installation

Master is stable - adventures are in the Dev branch.

The addon should work from blender 3.5+ and also work in the current blender release.

Where are these located in blender?

The operators can be accessed via the 3D View in the Mesh>Edge and Mesh>Vertex menu, the corresponding
rightclick viewport context menus or the default shortcut Ctrl-E / Ctrl-V.

grafik

Tools

Set Flow:

grafik

My stab at implementing a set flow operator for blender, which is a popular tool in many 3d applications. This adjusts the edgeloop via a spline interpolation such that it respects the flow of the surrounding geometry. The tool operates orthogonal to the direction of the flow of the edgeloop, indicated by the orange in the image.

Mix: Blend between intial vertex positions and the interpolated result.
Tension: Controls the strengh of offset.
Iterations: How often the operation will be repeated.
Min Angle: Cut off angle of the smoothing. Falls back to a linearely extrapolated position if the angle is beyond threshold.

In this example the control points for the spline smoothing are around the corner - which creates a nasty bulge. With the min angle one can force the alghorithm to find a better solution.

grafik

Blend Mode:

Blend Start: Number of vertices from the start of the edgeloop | The partial length from the start of the edgeloop.
Blend End: Number of vertices from the end of the edgeloop | The partial length from the end of the edgeloop.
Blend Curve: Linear or Smoothstep blend of the values along the edgeloop.

Notice how the shape changes from straight to curved at the right image. This obviously only works for edgeloops which are not cyclic.

grafik

Set Linear:

This makes each selected edge loop a straight line between start and end point. The spacing of all the other points can either be spaced evenly, or projected from the original distances. The tool operates in the direction of the flow of the edgeloop, indicated by the green in the image.

grafik

Space evenly: Place the vertices on the loop in regular distances.

Set Curve:

This tool curves each selected edge loop onto a spline which is controled by the first and the last edge of the edgeloop. The tool operates in the direction of the flow of the edgeloop, indicated by the green in the image.

grafik

Mix: Blend between intial vertex positions and the interpolated result
Tension: Controls the strengh of offset
Use Rail: The first and last edge of the edgeloop stay in place

Set Vertex Curve:

This tool moves vertices to a curve based on vertex selections. The picking order of the selected vertices defines the outcome of the tool. So it's very important to select in the correct order.

grafik

Tension: Controls the strengh of offset
Use Topology Distance: Force the path search to ignore edge lenghts, so only topological distance is used to find the inbetween vertices.
Flip Half Circle: (only for 2 vertices) Flip the direction of the half circle.
Space evenly: (only for 3 or more vertices) Place the vertices in even distances.

How Set Flow works

Back when I first got to see this in action I did quite not understand how it all worked - so I thought it might be well worth adding a quick description to better understand how the underlaying mechanics work.

grafik

The tool goes over each edge from an edgeloop, and then goes over each vert for this edge. For every vert it searches the points C1-C4 which are used as 'control points' for the spline interpolation - quite similar to how every vector drawing programm works. So its all depending on the surrounding geometry - which also means if we have multiple neighbouring edgeloops they all influence each other once we start applying this smoothing. Doing the same operation a few times helps to balance it all out and converges quickly into something stable after a few iterations - so hence the need for such an option.

Developer Notes

I had to reimplement the edge loop selection from blender because I needed to go from a spaghetti edge selection to sorted edgeloops. While I like that I was able to reproduce blenders selection behaviour I still think I might have overlooked something on how to do it with the regular api - any hints?

I tried different spline interpolation implementations but settled with a hermite interpolation from http://paulbourke.net/miscellaneous/interpolation/ as it has this nice tension variable.