Add-ons

Some convenient add-ons #

Blender has many add-on features which are not enabled by default. Here are a few which are useful for mathematical drawings. There are probably others that would also be useful but which I have not explored. (This tutorial is less tutorially than the others.)

Installing add-ons #

There are three kinds of add-ons: ones that are included with Blender but simply not enabled by default, ones in Blender’s online extension library, and ones you can download and install. Most of the add-ons discussed here are from the second category. (Blenderkit, discussed briefly at the end, is in the third category.)

To enable an add-on that came with Blender, select Edit:Preferences and click on the Add-ons tab on the left. Find the add-on you want in the list and click the checkbox next to it. (If you know the add-on’s name, typing it in the search bar is faster than finding it in the list.) There’s not much there in recent versions of Blender.

To get extensions from Blender’s online extension library, in Edit:Preferences click on Get Extensions and then select Allow Online Access. You can then search for and install the extensions you want, like Extra Mesh Objects and Extra Curve Objects discussed below. Once you install them, they should be automatically enabled. (You can disable them from the Add-ons tab.)

Getting extensions

To install an add-on that did not come with Blender, download it as a .zip file. Do not unzip the file. Back in Blender, in Edit:Preferences:Add-ons click Install and find the .zip file; it should then be installed. (Some add-ons have some preferences to configure after installation.)

To make sure the add-on is enabled next time you open blender, from the menu in the lower-left of the preferences pane either select Save Preferences or click the Auto-Save Preferences check-box.

Different add-ons show up in different ways; it may not be immediately obvious you successfully enabled the add-on.

Extra Mesh Objects #

This expands the Mesh sub-menu of the Add menu with several new options. Some of the most useful are in the Math Function sub-menu: Z Math Surface is a graph z=f(x,y). “XYZ Math Surface” is for parametrically-defined surfaces x=x(u,v), y=y(u,v), z=z(u,v). It will also generate a tubes around torus knots (see Extra Curve Objects), a twisted parametrization of a standard torus, regular solid, single vertices (which can be useful), approximations to the Menger sponge, and some other stuff.

Most of this is self-explanatory, but some comments about graph and parametric surface creation might be useful.

Graphs #

The “Z Math Surface” works like plot3d in Sage. It’s convenient: for instance, you can get nice line drawings of plots to use in teaching easily.

When you select Add:Mesh:Math Function:Z Math Surface you will get a piece of a paraboloid z=1-x2-y2 and a temporary dialogue in the lower-left:

Adding a graph Opening panel to set the graph Panel open

This is your only opportunity to change the function being plotted or the resolution of the plot. The rules are that you can click on menus or menu items or use the navigation widgets, but if you do anything else this dialog disappears. After that, the plot forgets it was a plot and only remembers it’s a mesh. If you hadn’t finished specifying the function, delete the mesh object you created and add a new Z Math Surface. (Fortunately, it remembers the function you typed last time.)

Second warning: in python, a carrot ^ does not mean exponentiation, it means and. So, if you want x3 either write x*x*x or write pow(x,3).

X Subdivisions and Y Subdivisions control the resolution of the plot. You don’t have to set them as high as you will think: after creating the plot, right-click or control-click on it and choose shade smooth and it will smooth out.

The variables are x and y. The plot range is $[-X Size/2, X Size/2]\times [-Y Size/2, Y Size/2]$. That controls both the range of the variables x and y and the size of the resulting object.

It’s easy to scale objects after creation. If you didn’t want your plot to be symmetric around the origin, you can cut it down later using a “Boolean” modifier and a cube, say – or shift your function, obviously.

Blender knows about π and e: you can type them in like numbers. For example, it’s fine to set X Size as 2*pi.

Graph of a function f(x,y)

(Note that the 6.3s are Blender’s: I typed 2*pi.)

Parametric plots #

The XYZ Math Surface is like parametric_plot3d in Sage. Like Z Math Surface, after selecting Add:Mesh:Math Function:XYZ Math Surface you have to click the tab in the lower-left to type in your function and plot range.

The parameters are u and v (lower case), the range of parameters is controlled with U min, U max, etc., and U step and V step control the number of subdivisions (number of steps, not the size of the steps). Note that U min must be ≤0, and U max must be ≥0.

Enabeling U wrap means you’re thinking of u as lying on a circle, so connects r(umin,v) and r(umax,v) (and similarly V wrap). (I usually want them disabled.)

The A helper function etc. help with typing complicated or repetitive expressions: if you type a function a(u,v) there you can then use a in the expressions for X, Y, and Z and it will substitute in your a(u,v). For example, here’s an unreasonably complicated way to produce a sphere:

Plotting a parametric surface

Line drawings of plots #

The basics of creating a line drawing from one of these plots are the same as in the first tutorial: select the object and then from the menu choose Add:Grease Pencil:Object Line Art. Here’s a fancier drawing than you’ll immediately get like that, and steps to produce it:

Line Drawing of a Graph

  1. Change the image resolution so the aspect ratio is square. Select Output Properties (the printer icon) and then change the Resolution X to 1080, say.
  2. Add the shape you want to graph. I added a Z Math Surface and set the function to sin(x)+cos(y) with 32 subdivisions in each direction and X size and Y size 2*pi.
  3. Tweak the camera so the whole object shows up in the frame. Select the camera, click the camera tab, and set the Focal Length to something lower (40 mm worked for me).
  4. Select the plot and add Object Line Art. This will be the visible outlines.
  5. On the Object Line Art’s modifiers tab, in Edge Types de-select everything except Contour.
  6. Select the plot again and add a second Object Line Art. This will be the hidden contours. Change Occlusion to the Range 1 to 3. De-select edge-types except contour.
  7. In the Materials tab, change the Base Color to something else – a light gray, say.
  8. Now we’ll add a couple of specific contours in the middle, by using Edge Marks. On the navigation widget, click z so we’re looking down from above. (The plot should look like a square, divided into sub-squares.) Select the plot and hit tab to switch to Edit Mode. Select the middle horizontal line in the square and from the menus select Edge:Mark Freestyle Edge. Do the same with the middle vertical line. (Those edges will turn green.) Do the same with the 1/4 and 3/4 horizontal and vertical lines.
  9. Hit tab to return to Object Mode and go back to the camera view. Add yet another object line art, for visible edge marks. In the modifiers tab, de-select all Edge Types except Edge Marks. Make it visibly different from the others, maybe by opening Style in the modifiers tab and changing the Thickness down to 15.
  10. Add one more Object Line Art, just like 9, but with occlusion set to a Range 1 to 3, for hidden marked edges. Make sure to give it a distinct style.
  11. Let’s add the frame. Add a cube (Add:Mesh:Cube). In its object properties, change Scale X to pi, Scale Y to pi, and Scale Z to 2.
  12. We only want the frame of the cube, so go to its modifiers tab and select Add Modifier:Wire Frame. Change the thickness down to .005.
  13. Add an object line art for the cube. Let’s not mess around with showing the hidden lines of the cube, but give this modifier yet another style.
  14. Realize your scene collection is a mess. Add a new Collection (right-click on Scene Collection and select New Collection), call it Line Art, and move all the linear art to it.
  15. Translate the camera down a bit (in the camera’s object properties) so the whole frame is visible. Optionally, set the camera to Orthographic, realize that looks worse, and set it back to Perspective.
  16. If you don’t like where the edge marks are, tweak them. Then select all the line art objects and select File:Export:Grease Pencil as svg.
  17. Clean up the result in a vector graphics program, to make the hidden lines dashed and maybe delete any lines you find distracting.

It’s somewhat faster than it sounds, and a lot of the steps weren’t really needed (depending on what you want the final version to look like).

The graph line art scene

Curve Extra Objects #

This add-on provides:

  • Lots of ways to add torus knots.
  • Some basic curves that can be useful, like helices.
  • Some basic shapes under “curve profiles”, like arrows, that are perhaps intended to be used with the curve modifier, or perhaps extruded.
  • A variety of other stuff.

It’s all in the Add:Curve submenu.

Add Curve: Curve Tools #

These show up in the tool shelf (press N), under “Edit”. One notable thing it lets you do quickly is splitting a curve at a vertex. Many of the other tools are likely useful, as well, though I have not experimented with them so far.

3D View: Precision Drawing Tools (PDT) #

Like the Curve Tools add-on, this shows up in the tool shelf (N). It lets you do things like extending a segment until it hits a given plane or create angle bisectors. There is documentation on the Blender website and a video demonstrating some of its uses on its developer’s website.

Other add-ons useful for rendering #

If in addition to line art you want to make rendered pictures (for teaching or talks, say), there are several other convenient add-ons. The Tri-lighting creator lets you add basic 3-point lighting in one step, from the Add:Light:3 Point Lights. It’s fairly self-explanatory, but note that the base energy is set very low by default – to see an effect, you probably want to increase it from 3 to 100 or more. Also, when figuring out lighting, it’s helpful to be viewing the scene in rendered mode (the right-most view option), of course.

The BlenderKit add-on is no longer included with Blender, but can be downloaded from their website. It allows you to download a huge number of textures, models (not usually useful for mathematics, though their kitten is cute), and backgrounds. The HDRI backgrounds are the easiest way to get realistic lighting and reflections. Choose one and click on it to download it, then in the Scene settings set the Film to Transparent. Then, your objects will be lit by the lighting in the scene you downloaded, but the scene itself won’t show up (except in reflections on shiny objects).

Adding an HDRI background

Depending on where you set up the camera, it can be convenient to rotate the HDRI background; to do that, go to the Shading tab, where it says Object change that to World, and then adjust the rotation in the Mapping node. (To see what’s going on, you probably want to be in the rendered view, in camera view, with non-transparent Film.)

Adding an HDRI background