Curve basics #
In this tutorial, we will create a couple of diagrams for the trefoil: a sloppy one, and then a tidier one that witnesses several of its symmetries:
We will then create a diagram for the knot 946, and from it, a cable of 946:
(Click for .svg versions.)
Working through this tutorial takes 40 to 60 minutes. It’s divided into three parts.
A sloppy trefoil #
There are (at least) four sometimes-useful ways to create curves in Blender:
- By using one of its built-in curves, perhaps from the
Curve Extra Objects
extension. - By starting with a simple curve, adding points to it (perhaps by extruding), and positioning those points. We will do this in the first and third parts of this tutorial.
- By drawing a 2D curve in a vector graphics program, saving it as an .svg file, importing that .svg file to Blender, and then adjusting the z-coordinates of the control points by hand. We will do this in the second part of the tutorial.
- By using Python to create a curve programatically. This is discussed in another tutorial.
Blender also supports two kinds of curves: Bézier curves and NURBS curves. This tutorial will only discuss Bézier curves.
In this first part of the tutorial, we will build a not-very-elegant trefoil, by hand.
Start by creating a new scene and deleting the default cube (highlight it and push x
). Then, choose Add:Curve:Bezier
. You get a little squiggle. We’re going to delete all its vertices and start from scratch. Hit tab to switch to Edit Mode
. Then either hit a
to select all of the points or select them by dragging the mouse, and hit x
to delete them, and select Vertices
.
Now, we’ll draw the knot projection first, using the pen tool. Click on the z
in the navigation widget to switch to a view where you’re looking down the z-axis (1). Then select the curve pen tool (2) and click around to draw a rough piecewise-linear trefoil projection (3). Don’t use too many points – it will make the next step painful. To close up the trefoil, you can either click on the first point again at the end, or select Curve:Toggle Cyclic
from the menu. If your trefoil went awry, select all the points again (a
), delete them (x
), and start again; or type x
to delete the most recent (selected) point and then click the pen on the last point you still have and resume drawing.
(If you were doing this for real and wanted to have any kind of symmetry, you probably want to use the grid and some snapping. This is the magnet icon in the top bar.)
Next, we want to spread out the points in the z direction. It’s extremely hard to parse where thin curves are. So, we’ll pause to give the curve some thickness. Click on the “curve properties” tab (1), scroll down until you see Bevel
under Geometry
(you might need to expand the Geometry
group), and set the depth to something non-zero (2); .08 looks pretty visible to me.
Now, we’ll move the points around. Rotate the view so you’re close to edge-on (looking roughly but not perfectly parallel to the xy-plane). (It’s easiest to see what you’re doing when you move points orthogonal to the direction you’re looking, for obvious reasons.) Select the Move tool (1), click on a point you want to move (2), and move it with the blue vertical arrow (3).
You can also control points’ precise coordinates, from the right panel. Select another point and hit n
to open the right panel (1). Under Item
(2) you should see the control point’s coordinates. Change the z value (3). This gives you nice, precise control.
Move the rest of the points to try to get a 3D trefoil, using either method. You should probably rotate your view frequently to get a sense of what’s going on, and may want to move points’ x and y coordinates as well. (When using the move tool, blue square lets you move points just in the xy-plane.)
Next, we’ll smooth the trefoil. Select all the control points with a
and then select Control Points:Set Handle Type:Automatic
.
Your control points now have handles which you can use to tilt them. To do that, using the Move tool, select an endpoint of a handle and move it around. Or, select an endpoint of a handle and adjust its location in the right panel.
Hit Tab to switch back to Object Mode
and Add:Grease Pencil:Object Line Art
. If you’re not in Camera View it will look crazy; switching back to Camera View and de-selecting the new Grease Pencil object you’ll probably have a plausible line drawing of a trefoil.
(You can make it a little smoother by increasing the Resolution
value
in the curve properties tab, if you like.)
If you’re going to export it and want single rather than doubled lines, make the curve much thinner. If your projection wasn’t generic (mine wasn’t), move your view around and then View:Align View:Align Active Camera to View
. If you did make the line very thin, after exporting the .svg you’ll have to edit it and put in breaks at the crossings.
Importing a trefoil from an SVG #
Blender doesn’t just export .svg files: it also imports them as curves. Of course, the curves start out 2D, so one has to manually adjust their z-coordinates.
Here is a quick .svg for a flattened trefoil. I arranged that it consists of a single continous curve, but didn’t smooth out the handles: we’ll do that at the end, in Blender, after setting the z-coordinates. (I made the .svg in Illustrator, but any vector graphics program will do.) I arranged that there are two vertices at each crossing; this will be convenient.
To import it, select File:Import:Scalable Vector Graphics (.svg)
(not SVG as Grease Pencil
).
You’ll get a new Curve object (and a new collection), but you won’t see it because it’s too small. Select the curve object and scale it up by a factor of 100 in all directions. It will still look wrong, because Blender thinks it’s a 2D curve. Go to the Curve Properties
tab and change the Shape
from 2D
to 3D
. It should now look like a piecewise-linear, flattened trefoil (drawn as a braid).
The scaling is going to make all our measurements later very small. So, let’s apply the scale, to lock it in. Select the curve in the viewport and type control-a
(for Apply
) and select Scale
to apply the scale (or All Transformations
; it doesn’t matter).
In the Geometry
group in Curve Properties, set Bevel Depth to .001. The bevel will look hollow; you can fix that by changing the Fill Mode
(near the top of the Curve Options
tab) from Half
to Full
. I would also change the twist method from Minimum
to Z-Up
, though it doesn’t make much difference here. (This controls what framing Blender uses when wrapping things around the curve; Z-Up uses the blackboard framing.)
Select the curve and hit tab to enter edit mode. We’ll get the crossings by just selecting the two vertices at each crossing and moving one up and one down. We can be precise by using the right side panel (n
). Set one vertex at each crossing to have z-coordinate 1 and the other to have z-coordinate -1, in such a way as to get a trefoil.
Select all the control points (a
) and select Control Points:Set Handle Type:Automatic
. Then select Control Points:Smooth
which will smooth out the curve and make it look more natural. (Another tool you can try is Curve:Clean Up:Decimate
, which reduces the number of control points. The percentage to reduce it to is in the adjustments tab in the lower-left after you select Decimate. For this knot, it doesn’t give useful results, so I undid it after taking a screenshot.)
We’re done. Add Object Line Art
and set up the camera to capture a nice view if desired. (For symmetric pictures like this, the Orthographic camera can look nice.)
A clean knot built in Blender and a cable of it #
Another nice way to build knots in Blender is from simple pieces. We will build a crossing and a cap (precisely, by using snapping) and then glue several copies together to get a nice closed curve. We’ll demonstrate by building a a (-3,5,7) pretzel knot and then a cable of it.
We will start by building a basic crossing (see a few shots down).
Starting with a new scene (minus the default cube), click on the z
in the rotation widget to look straight along the z-axis. Add a new Bézier curve (Add:Curve:Bezier
) and click the magnet in the top bar to turn on snapping. In the menu next to the snapping control, select Grid
Enter edit mode (tab
).
We’ll work with straight lines for the moment, so select both vertices (a
) if they’re not already selected and set their handle types to vector
(meaning sharp corners).
We’ll build the top and bottom out of three segments, so subdivide the segment from Segments:Subdivide
. You only want one cut. Then move the endpoints to (1,1,0) and (-1,-1,0) and the middle point to (0,0,.5). You can do this precisely using the move tool (since we enabled snapping), or you can hit ’n’ and type coordinates for the points.
We’ll make the under-arc using the curve pen. Click at approximately (-1,1), (-.2,.2), and (1,-1) and then move the points to the desired locations (-1,1,0), (0,0,-.5), and (1,-1,0), either with the move tool (the “Absolute Grid Snap” makes this possible) or with the sidebar. (We avoided clicking at (0,0) because that selects the existing arc.) Hit tab
to exit edit mode and give the curve some diameter (from Geometry in the Curve Properties tab) so you can see it’s a crossing. Rename it something memorable, like “Pos Crossing”.
Select the curve and copy it. Call the new copy “Neg Crossing”, rotate it by 90 degrees around the z-axis, and apply the rotation (ctrl-a
). Move “Pos Crossing” and “Neg Crossing” somewhere out of the way: we will build the knot from copies of these model crossings.
Next, a cup. Build a piecewise-linear curve with vertices at (-1,0,0), (0,-1,0), and (1,0,0) and call it “Cup”. Make a copy rotated 90 degrees around the z-axis and call it “Cap”. Move them out of the way.
Now we’re ready to sketch our knot. Make 3 copies of the negative crossing, 12 copies of the positive crossing, 3 copies of the cup, and 3 copies of the cap and arrange them as shown using the move tool (in Object Mode, not Edit Mode). The snapping should make this easy.
(If I were doing this without guidance, I would keep spare copies of the crossings, cup, and cap around in a separate, hidden collection, in case I needed them. In fact, I’ve done that here.)
Select all of the curves and select Object:Join
. (It might be more convenient to do this in a couple of steps, rather than selecting all of them at once.) Give your new proto-knot an appropriate name, like “Pretzel”.
At present, the different strands of the pretzel with the same endpoints are not joined together – the coincident endpoints are still separate. Enable the plug-in Curve Tools
. Then, in the side bar, select Edit
and open the Sanitize
section. Click Join Neighboring Splines
. This will join all of the endpoints, so you have a single continuous curve. (Without the plug-in, you have to manually join each pair of endpoints that you want identified, by selecting them and typing f
. That leaves you with two control points at the same place, which you can fix by selecting one of them, typing x
, and selecting Dissolve Vertices
. The plug-in saves a lot of time.)
Two more steps to complete the knot. We want to join together some of these vertices with line segments, and we want to extend some of them before joining them together. You can join vertices by selecting a pair and pressing f
or selecting Control Points:Make Segment
. To extend segments, you can either use the Curve Pen or the Extrude Tool If you use the Extrude Tool, set the mode from “Normal” to “XYZ”. You only need to extrude two segments to finish the knot.
If you look around, you’ll notice the knot is a bit flat; we’ll scale the z-coordinate later. It’s also not smooth, of course. Select all control points (a
) and go to Control Points:Set Handle Type:Automatic
.
Other than being too flat, I find the result already fairly attractive. Two quick improvements. There’s a top vertex and then two vertices adjacent to it, coming from the cap at the top. Delete those two extra vertices (select them and press x
and then select either “Vertices” or “Dissolve Vertices”. (The two have different effects; see which you prefer.) Do the same at the bottom. (I used “dissolve” at the top and “delete” at the bottom, so the difference is visible.) Then, leave edit mode, scale the z-coordinate by a factor of 2, and apply the scale (ctrl-a
). (If you don’t apply it, the scale will also affect the tube around the knot, so you end up with a tube with oval instead of circular cross section. Scaling and taking tubular neighborhoods doesn’t commute…)
The result looks okay, but a little artificial. To make it more natural, we can try going back to Edit mode, selecting some or all of the control points, and using Control Points:Smooth
. I wasn’t particularly taken with the results of smooth. Another option is to use Curve:Clean Up:Decimate Curve
. Setting the ratio down to .4 has a nice effect.
After that, maybe dissolve a few more vertices, play with the locations of the vertices and handles a bit, and declare victory, with a perfectly reasonable preztel knot.
(I increased the radius, aligned the camera to a view I liked, and added a line art object with line thickness 125, to make the result pop a bit in the screenshot.)
The cable #
Cables of knots are easy to create, by using an Object bevel instead of a Round one and using the Tilt entry of some vertices.
Continuing with our pretzel knot, add a new Bézier circle (not part of the knot). Call it, say, “Pattern” (or “Bevel”). If we go into its edit mode, it’s a little hard to see with the knot in the way, so select View:Local View:Toggle Local View
to hide the other objects.
We’ll create a 3-cable, so add two more circles (from the “Add” menu in Edit Mode) and move them to the left and right of this one (or arrange them in a perfect equilatral triangle if you prefer that, though it takes a little bit more work). I have spaced the circles one radius apart.
Exit Edit Mode and toggle off Local View. Select the original knot and under bevel select Object and then the Pattern you created. The result is a mess:
The problem is that the pattern is too large. Scale the pattern down to .1 of its original size (you don’t have to apply the transformation) and the result looks good.
This is a cable link, however, and I promised a knot. Go into edit mode for the Pretzel, select one of the vertices – call it v – and bring up the side panel (n
). Under “Item”, set the “Tilt” to 180.
The result is still not what we want: it tilts to 180 degrees and then tilts back. To fix that, select v and one of the adjacent vertices to it, type an x
, and delete the Segment between them.
Now, select only the non-tilted vertex and extrude it to create a new vertex w:
Move w onto the tilted vertex.
Now, we just need to make the tangent vector at w agree with the one at v. Select v and then select one of it handles. Note the location of that handle (for me, (-6.9702, 3, -1)). Then select w and its corresponding handle and set that vector as its location. Do the same with the other corresponding handles. Now, the cable should close up, as a knot – the (3,1)-cable of the pretzel you started with.
Note: you’ll get a little artifact in the Grease Pencil drawing where the two endpoints of the curve meet. I don’t have a great solution to that at present, other than cleaning it up in a vector graphics program after exporting.