The following is a step-by-step written tutorial of the Blender "Donut" video tutorial
Adding A New Object
- Add new objects with “Shift + A”
- Try to choose an object that is as close to the finished shape you’re shooting for as possible (in this case, a torus is pretty close to a donut):
When you add a new shape, a menu will come up at the bottom that allows you to edit the shape’s properties. If you accidentally close this menu, you can bring it back up with “F9”:
Tip: When setting the number of “Major segments” and “Minor segments” for the torus, keep the numbers relatively low. Making things high resolution at the start of a project is more work for blender and more work for you, since you will be stuck editing object meshes that have a huge number of faces and vertices.
You should also try to choose a number of major and minor segments that results in relatively square faces on the surface of the object, like this:
Scaling
It’s important to keep things as close as possible to their real-life scale. The donut above has a radius of about one meter, so it’s enormous. Use the “s” key to scale down to a more appropriate size. Say, 0.1 meters (10 centimeters) for a start.
Hitting the “n” key will bring out a side menu like the one shown here. You’ll see that the scale of the object is now around “0.033”. You pretty much always want this to be “1”. We can “apply” our object’s new scale with “Control + A”, then choose “Scale” from the menu that pops up, as shown here:
Shading
Blender has two types of object shading: flat and smooth. Our donut looks “blocky” because by default blender uses flat shading. If we right-click on the donut and choose “Shade smooth”, blender will switch to using smooth shading:
Which gives us a much nicer-looking result:
Note: Shade smooth doesn’t “add any geometry”. It simply makes the object appear smooth in the viewport. We can make the object actually smoother using a “sub surf” operation:
Editing
Tip: To switch into edit mode, hit the “Tab” key. Edit mode allows you to edit the object’s mesh (“skeleton”).
Edit mode looks like this:
Clicking on a face or a vertex allows you to modify it. We can (for instance) grab a vertex and then drag it away from the donut:
Tip: Hold down “Shift” to select multiple points (vertices).
A better way to change shapes is to enable proportional editing which will automatically grab vertices around your selected vertex, and will modify them as a group. Like this:
Notice the circle in the screenshot above: this is the area-of-effect for proportional editing.
You might not be able to see the circle (the default area-of-effect is far, far larger than the donut). You can use the scroll wheel to scroll up, which will reduce the area-of-effect until you can see it.
If you are on a laptop or a desktop, you can first:
- Select a vertex on the donut
- Left-click once
- A “Move” menu will show up in the bottom left hand corner of the screen (see the screenshot above)
- Open that menu, and change the proportional scale to something reasonable (say 0.04 or 0.05), at which point you should be able to see a little gray ring as in the screenshot above
- On a multitouch trackpad, use two fingers to scale the ring in and out to control the area-of-effect
Note, you can also turn proportional editing on and off from a “Move” menu that appears in the lower-left when grabbing a part of the mesh:
The “Shrink And Fatten” Tool
Rather than grabbing a vertex and moving it away from the surface of the donut, “Alt + S” (“Fn + S” on a mac) will open the “shrink and fatten” tool, which will move faces towards (or away) from the surface of the donut based on their direction (in other 3D software, this is called “move along normals” or something similar).
Select Random
You can also select vertices on your shape entirely at random, like this:
This can be used to add some random imperfections to the donut. Grab the randomly selected vertices and move them in or out from the donut for a bumpy effect!
Selecting Things In Edit Mode
We need to select the top of our donut (we will duplicate this and make it thicker: it will be our icing).
To do this, from edit mode select “X-Ray mode”, which will make the donut appear “see through”:
When we select things in X-Ray mode, we can be sure we’re selecting all the way “through” the object (i.e. vertices on the other side of the object will also be selected). Also, make sure you’re looking at the object directly ON, say from the X or Y axis (as above).
Duplicate
Duplicate the top half of the donut by selecting it and hitting “Shift + D”. This will make a copy of the selected part of the mesh and lock it to your cursor:
We want the mesh right on top of its original position, so we can hit “Esc” to put it back where it belongs:
Next, we hit the “p” key and choose “Selection”, to convert our duplicated mesh into its own object:
If we cancel out of edit mode and return to the object viewer by hitting “Tab”, we’ll see two objects (as indicated by the outlines in two different colors):
Helpful tip: You can double-click on things in the layer editor at the upper right-hand corner, to rename them. Here, I have renamed my two objects to “Donut” and “Icing”:
Another good tip: If you accidentally clicked away from your selection before hitting “p” to make your mesh into a separate object, you can also hit “Control + L” to select the “linked” vertices that make up your icing, then you can hit “p” to separate it.
You can also rename by hitting “F2” while you have one of your object selected in the object viewer.
Next, add a “Solidify” modifier to the icing:
Then, choose “Wireframe” mode, so you can see through the wire mesh:
Dealing With Inverted Normals
You might find that when changing the offset to a positive value, the icing layer appears to be thickening into the donut rather than outwards. This is because the “normals” for the icing are facing the wrong way (i.e. they are facing into the donut).
You can check this by entering edit mode, then turning on “Face Orientation” from “Viewport Overlays”:
You can flip the normals from the “Mesh” menu near the top of the screen, like so:
Afterwards, the color of the mesh should change:
This should fix any issues with the icing appearing to “offset” into the donut when the “Solidify” modifier is applied.
If the icing still looks funny, try changing the order of the modifiers, so that solidify is applied first:
Hiding Modifiers
We want to hide the solidify modifier we added to the icing, so that it doesn’t cover up our mesh while we’re in edit mode (otherwise, it’s quite hard to edit the mesh since we can’t select it).
With solidify turned on in the viewport, edit mode for our icing looks like this:
With solidify turned off in the viewport, we see this (much better!):
Snapping Our Icing To The Face Of The Donut
We now want to give our icing some “dribbly bits” that droop down the donut (like real icing tends to do as it cools). From edit mode, if we grab a vertex on the icing mesh and simply drag it down (with proportional editing turned on), the rest of the mesh will tend to end up “inside” the donut, like this:
You can fix this using the “Snap” tool at the top of the viewport. Make sure you select “Snap to Face” and “Project Individual Elements”, as shown here:
Dragging the mesh now keeps the icing snapped to the surface of the donut:
Note: The option “Project Individual Elements” in the snap tool is actually what causes all of our selection to snap to the surface of the donut, rather than just the single vertex we selected.
Adding A Reference Image
It’s always a good idea to “work from reference”, so go find a donut that you like.
In my case, I am using a freely available image from the Wikimedia Commons. I've reproduce it here, as well:
We can pull this image into Blender for use as a reference. We can do this by “splitting” the viewport.
First, place your cursor on the border between two windows in the viewport:
Then choose “Vertical Split”:
Drag the new window into place, until it is as wide (or narrow) as you feel is appropriate:
Now, we switch the new window to “Image Editor”, and pull in our donut:
Note: Images pulled into blender in this way do not become part of your
.blend
file, so if you move the image, you’ll have to re-import it!
Shape The Icing
Now we can start shaping the icing to match our reference image. Before we do this, we want to apply our “Subsurface” modifier to the icing to increase the level of detail in the grid. Do this by moving “Subsurface” to the top of the modifiers list and hitting “Control + A” (or “Command + A” on a Mac) to apply it. In edit mode, the icing mesh should now appear to have more faces than before:
Tip: From time to time you might want to hide stuff. You can do this by selecting an object and hitting “H”. “Control + H” will un-hide.
We can now shape the icing by grabbing and dragging. We can also make small “drippy” bits by selecting one two or more vertices and hitting “E” to extrude:
You can rotate and scale the extruded sections with the usual “R” and “S”.
Here, I do my best to get my donut to match the reference image a bit better (I actually deleted my icing and started over with a “smaller” icing, created by selecting a smaller section at the top of my donut, to better match my reference):
I now have a nice “bumpy” donut that is a rough match to my reference image. Some parts of the icing don’t seem to be properly “shaped” to the surface of the donut, though. We’ll fix that in the next step.
Changing The Shape Of The Donut
You’ll notice that a lot of donuts have a section near their middle that is “less cooked” than the rest of the donut. This part has a lighter color, and usually forms a sort of “indent” around the center of the donut.
Hitting “1” to go into front view, turning on X-ray mode, and then selecting the middle portion of the donut mesh and hitting “S” will let you scale the mesh in to create this effect.
Note: Screenshots below were taken without this modification, so if the donut still appears “fat around the middle”, that’s why!
The “Shrink Wrap” Modifier
Once you shrink the center of your donut, you’ll notice that the icing no longer hugs the surface of the donut. We can force the icing to adhere to the donut using the “Shrinkwrap” modifier.
With the icing selected, go to the modifiers pane and add a “Shrinkwrap” modifier:
You’ll need to click on the little “eye dropper” and select the donut (the object we want to “shrink wrap” on to):
Next, change the order of the icing modifiers so “Shrinkwrap” comes first, which will get rid of this weird “patterning” that appears:
Tip: Weird display artifacts are usually a sign that you need to change the order of your modifiers!
Sculpting
We now need to make some more “organic” changes to our mesh by sculpting it (i.e. using brush strokes to adjust our mesh).
Warning: You need to apply your modifiers before you start sculpting. It’s also important to make sure the modifiers get applied in the correct order. In this case, for the icing, that means:
- Shrinkwrap
- Solidify
- Subdivision Subsurface
You can apply modifiers by clicking the little arrow next to each modifier item, or by using “Control + A” with the modifier selected (“Command + A” on Mac).
But First, A Note On Closing Windows In Blender
Like me, you might still have your reference image loaded up:
You might want to hide this so that you can more easily see what you’re doing when you start sculpting.
There are two ways to do this:
- Place your cursor just between the two views (image editor and layout view) at the top of the screen, then click and drag to the right to close the image editor window.
- Place your cursor along the left edge of the image editor window, until it becomes a double-headed arrow (<->), then right click and choose “Join Areas”. Next, click on the image editor window, which will then close.
First Approach: Click And Drag From The Top Corner
Second Approach: Right Click From Between The Two Windows
Start Sculpting
We will need to switch to the “Sculpting” mode from the top menu bar:
Sculpting Basics
Clicking on any part of the icing and moving the mouse (or trackpad) will start “drawing” on the mesh (i.e. “pulling” it out).
Holding down “Control” while you click and drag will “push” into the mesh (making a dent or concave area).
Grab Tool
Tip: You can grab things in sculpt mode by tapping the “G” key, then dragging on a portion of your mesh.
You can also enable the “Grab” tool from the sidebar:
You can change the brush size using the “Radius” tool in the upper left-hand corner:
Changing this will change the size of the area that’s affected by your brush strokes (mouse movements). The hot key to change brush size is “F”.
- “F” key changes brush size
- “Shift + F” changes brush strength (the intensity of the sculpt tool’s effect)
Note: you can also set strength from the upper left-hand corner of the UI, right next to radius (see screenshot above).
Smooth Tool
You can also use the Smooth tool, which will smooth out details in your mesh:
Tip: You can temporarily activate the smooth tool, regardless of what other sculpt tool you are using, by holding down “Shift”
Inflate Tool
This is the tool that will help us make the ends of or icing “blobs” look more pronounced.
Tip: You need to turn on “airbrush” from the inflate tool settings, otherwise clicking on the mesh won’t cause it to inflate. Without “airbrush” turned on, only clicking and dragging inflates the mesh, which can make small “touch up” work more difficult.
Hit “N” to open properties, then go to “Tool” to see the tool’s properties, like this:
You can enable “airbrush” from here:
You can now shape your icing by alternating between the “grab”, “inflate”, and “smooth” tools.
The common keyboard shortcuts for sculpting are:
- “G” for grab
- “I” for inflate
- Hold down “Shift” to smooth
You can also switch back to object mode temporarily to select your donut, and do some sculpting on the donut as well.
After a little sculpting, I ended up with this “lumpy”, organic looking donut (at least, I think it looks OK):
Rendering
Choosing “Render -> Render Image” from the top menu bar in Blender will produce a “snapshot” of our 3D scene, from the camera’s perspective:
Tip: You can also render the scene with “F12”. On newer Macs, you can hold down the “Fn” key then tap on “F12” on the smart bar.
Moving The Camera
There are a few ways to move the camera. One of the easiest ways is to adjust your viewing angle and position from the Layout window, then hit “Control + Alt + Number pad 0”.
An alternative to that is to hit “N” to bring up properties, then under “View” choose “Camera to View”, which will lock your camera to your current view (i.e. the camera moves with you):
If we now render again, we should see something like this (assuming we moved closer to the donut before repositioning the camera with one of the two techniques above):
Tip: You can grab the camera and light(s) just like any other object, with “G”, then move them around. So that’s another way to reposition the camera!
Moving The Light
We haven’t moved our light yet, either. We should move it in a little, since the default position assumes a much bigger scene than the one we are creating:
Tip: Don’t forget, you can hit “X”, “Y”, or “Z” after hitting “G”, if you want to move your light along a specific axis.
Of course, we haven’t adjusted the intensity of the light, so if we render now, we’ll get something like this:
We can adjust the “Power” of the light down, to get a something more reasonable:
Our render now looks a lot more reasonable:
Rendering In The Viewport
You can switch your “Viewport Shading” mode to “Rendered”, which will automatically render your scene in the viewport, re-rendering whenever you change your location in the viewport:
Tip: Play around with the different “Viewport Shading” modes.
Other Viewport Modes
Wireframe (makes it easy to see your model’s mesh):
Solid (the default - good for shaping your objects, and for sculpting):
Material Preview (good for checking how reflections will look, what materials will look like with more natural lighting):
How Is Stuff Rendered In The Viewport?
A special tool called a “Rendering Engine” is used. There are many open source and commercial rendering engines: they take your model and apply a set of rules to calculate what your final animation or image should look like, based on lighting and material properties set for the objects in your scene.
There are many commercial and open source rendering engines, but the ones Blender comes with are “Eevee” and “Cycles”. By default, rendering in the viewport is done with “Eevee”.
“Eevee” is a realtime rendering engine, something like what would be used in a video game, to produce instantaneous results.
“Cycles” is NOT real time, rather it is a “path tracer” or “ray tracer”. This means cycles actually calculates how light “bounces” around your scene. This means Cycles is not as fast as Eevee, but produces more accurate, realistic renders.
You can turn on Cycles from the rendering menu:
Speeding Up Renders
Rendering using a GPU will pretty much always be faster than rendering with a CPU. You can make sure Cycles uses your GPU by going to Edit -> Preferences -> System, and changing your “Cycles Render Devices” to your GPU(s).
Normally, you’ll see options for CUDA, OptiX, and HIP. If you’ve got a NVIDIA GPU, you’ll use CUDA or OptiX (use OptiX if possible). If you have an AMD GPU, you’ll use HIP.
Note: If you are on a newer MacBook Pro (like me: I have an M1), you won’t see any cycles preferences at all, like this:
You can confirm that the issue is a missing graphics card by clicking on “Graphics”, then searching for “Cycles”. As you can see here, when I click on “CUDA” the system warns me that I don’t have a compatible GPU:
If you don’t have a compatible GPU don’t worry, Cycles will work fine, it’ll just render using the CPU which will be significantly slower.
What To Do If You Don’t Have A GPU
You can use Eevee instead of Cycles (it’ll be much faster), but you’ll need to make adjustments to get Eevee to do a good job, especially with shadows.
Note: I have added a plane underneath the donut to make shadows more obvious.
Here’s Cycles trying to render a shadow behind the donut:
Here’s that same render with Eevee:
Big difference, yes? If we want to get a more realistic render with Eevee, we need to make some adjustments to Eevee’s render settings.
Adjusting “Cube Size”
Changing the “Cube Size” in the “Shadows” settings will make shadows appear much less “jagged”:
Adjusting Lamp Settings
We can make the shadow appear still more realistic by changing our Lamp’s bias settings. This will change the way Eevee treats shadows around smaller parts of our scene (like the “hole” in our donut). Here it is turned down to zero:
Playing with “contact shadows” can also help, but we’ll ignore that for now!
Adjusting “Ambient Occlusion”
We can also get better shadowing in crevices and “occluded” (covered or obstructed) spaces by turning on Eevee’s “Ambient Occlusion” feature:
However, the bottom line is that Cycles is always going to generate more realistic results!.
Materials
We can associate one or more “materials” with each of our objects. This is really what gives objects a realistic look when they are rendered (fur, glass, hair, etc…).
Let’s add a new material to the icing:
The new material is a “Principled BSDF”. This lets us set things like roughness, specularity, etc…
This actually comes from Disney! You can read more in the blender documentation
The first and most obvious thing to change is the “base color”. Let’s make it pink:
We can also make our icing appear more “moist” by adjusting the “roughness”:
Doing Multiple Renders
After hitting “F12” or “Fn + F12” you’ll notice that you have more than one “Slot” available from the rendering window:
You can use these “slots” to perform multiple renders and compare your results. For instance, here I use Slot 1 to perform a render with “Cycles”:
And here’s a render with Eevee, in Slot 2:
The reflections here don’t look quite as good. We can improve things by turning on “Screen Space Reflections” and “Bloom”, which will (sort of) change the amount of “glare” in the render:
Feel free to open up the “Bloom” and “Screen Space Reflections” menus and play around a bit to see what kind of results you can get!
Improving The Icing Further
Many real-world objects exhibit “scattering” (i.e. light bounces around inside the object, or passes through it).
Without scattering, our icing will look “hard”, almost like a shiny metal surface. We need scattering to give the light bouncing off the donut a softer, more diffuse feel (and a sense of depth).
From the icing’s material properties, we need to adjust “Subsurface Scattering” and “Subsurface Color” to get this effect:
The weird “plastic” look we are now getting is caused by the fact that the “Subsurface Radius” values are too high. We should probably also adjust the Subsurface Color (now a light gray) to something that matches our icing better.
Basically, we need to do a few different things:
- Adjust the subsurface radius values to something smaller, like “0.002”
- Adjust the subsurface color to something closer to the color of our icing (so a pink or purple color, in this case)
- Play with the “Subsurface” effect strength
After twiddling those values and adjusting my colors a couple of times, I wound up with this:
Tip: Some of these finer adjustments (like subsurface scattering) are going to be tough to see when using Eevee. Cycles will pretty much always give more satisfactory results.
Using Material Preview
We can use Material Preview to get a quick idea of what our materials are going to look like, without doing a render. It will use default lighting and background settings, as long as “Scene Lights” and “Scene World” are unchecked:
If we check those boxes, we’ll see a preview that uses our world and light settings (good in our case, since we’ll be rendering using our own background and lighting):
Note: Actually, Material Preview uses Eevee to render, so with “Scene Lights” and “Scene World” checked, what we’re seeing in the Materail Preview is the same as what we would get by rendering the scene with Eevee.
So what’s the point? We can now swap between “Material Preview” (to see a fast render in Eevee) and “Rendered”, to see results from Cycles:
Why Does Cycles Make “Grainy” Looking Renders?
Cycles is doing “ray tracing”, meaning it actually traces the path each ray of light would take through the scene before reaching the camera (in reality it is actually “working backwards” from the camera to the light, but the effect is the same).
This is an incredibly computationally intensive process, so Cycles has to choose a random “subset” of rays to trace. This is what causes the “grainy” effect. Tracing more rays (letting Cycles run for longer) and allowing more “bounces” off of objects in the scene will both improve the quality of the render, at the expense of taking more time.
How Can We Improve Things?
We can improve render speed by lowering the “Max Samples” used when Cycles renders things in the Viewport. This will speed up Viewport rendering:
We can improve render quality by turning on “Denoising”, which will “smooth out” some of the noise:
Note: If you’re using your CPU for rendering, turning on denoising will slow things down significantly. Unfortunately hardware accelerated denoising only works when you’ve got a GPU!
Note: In Blender 3.0 there is a “time limit” feature for rendering, so you can force rendering to complete within a given time, regardless of quality:
Texturing
If you take a look at some photographs of donuts, you’ll notice that they aren’t a consistent color “all the way through”. Most donuts have a light ring around the center and will typically also have dark “speckles” throughout (probably because bits protruding from the surface of the donut tend to get cooked more, since they have more surface area in contact with the cooking oil).
We need to replicate this look with texturing.
First, let’s hide the icing. Select the icing and click on the little “eye” in the “Outliner”, at the top right-hand corner of the Blender window, as shown here:
Now it will be much easier to see what we’re doing.
Tip: You can also hide with “H” and un-hide with “Alt + H”
Tip: For the most part, the only settings you need to adjust to get good looking textures are “Base Color”, “Roughness”, and “Normal Map”. Other settings are rarely needed (well, maybe “Subsurface”).
Using The “Shading” View
We will now need to start giving the donut a texture, which we will do from the “Shading” view:
By default, the Shading View is going to open up with the viewport set to “Material Preview” with the default lighting settings, and it’ll also open up some side menus that aren’t needed for the blender donut tutorial.
Let’s close all that, change our lighting settings, and disable the plane underneath the donut as well.
First, with the donut selected, hit “~” and click on “View Selected” (or hit “3”) to zoom in on the donut:
This will zoom us in:
Next, close the two windows to the left side of the screen by right-clicking on their rightmost window borders, then choosing “Join Areas”. This will cause the cursor to change to an arrow head shape: “<”. Place the cursor inside the window you want to close, and left click once. Your screen should now look something like this:
Next, click on the plane underneath the donut and press “H” to hide it:
Finally, adjust the lighting settings for the Viewport, like this:
Great! Now we can start texturing (you might want to turn up the brightness of your in-scene lamp for this part, as well).
We’ll be using the bottom window (the node editor) to help us:
The boxes you can see in that bottom window are called nodes. Basically, nodes let you modify your objects by taking data from your shader (Principled BSDF) and modifying it. The nodes “flow” into each other from left to right.
Adding nodes and plugging them into the Principled BSDF inputs will change how our donut looks.
For instance, you could add a “Voronoi Texture”, like this (note: you add nodes the same way you would add objects, with “Shift + A”):
The big advantage of texturing with geometry nodes is that you can easily change things later. If you hand-paint a texture, it’s a lot of work to change it later on!
Texturing The Donut
I’ll now delete the “Voronoi Color” node, and replace it with a “Noise Texture” node, like this:
Tip: If you use “Control + Right Mouse Button” then drag the mouse, this will “cut” the wires you create when you connect geometry nodes. You can also simply grab one end of a wire and move it away from a node, then let go.
You can see that the “Noise Texture” node is creating a mottled (noisy) pattern on the donut, but we have lost our original colors. We need to get those back.
To do that, we need to add a ‘ColorRamp" node between the “Noise Texture” and “Principled BSDF” nodes. Dragging it onto the line between those two will insert it into the workflow, like this:
Pay close attention to which inputs and outputs are wired up here. It’s important.
We now need to change the color range that the ColorRamp is using:
Playing around a little, I end up with something like this:
“Preview” Node Effects More Easily With Node Wrangler
Turning on the “Node Wrangler” plugin will let you “Control + Shift + Left Click” on a node, to “preview” its effect on your object.
You can turn it on from Edit -> Preferences -> Add-ons, by searching for “Node Wrangler”. Check the box next to the plugin to enable it:
If we now “Control + Shift + Left Click” on the “Noise Texture”, we can see the raw output of just that node. This is helpful when trying to figure out which node is doing what:
Adjusting Our Texture Coordinates
If you look closely at that first result (the noise texture, in black and white above), you’ll see that the “splotches” appear stretched around the middle of the donut, but look more uniform on top.
This is because the texture map that corresponds to our donut is “stretched” to fit our donut’s irregular shape.
This has to do with the way Blender “fits” textures to 3D objects. We can make things look a little better by adding a “Texture Coordinate” node in front of the “Noise Texture”, like this:
Now our donut’s texture looks too uniform. This is because the scale of our noise texture needs to be updated, now that we’ve changed the way we are handling “stretching” our texture over the donut. A higher value (200 in my case) should help:
Play with that value until you get something you like. I went for 50:
Making The Donut “Bumpy”
We can add another node to change not only the color of the donut, but its shape as well (i.e. we can make little bumps and imperfections appear).
Basically, we want to pass something in to the “normal” input on the “Principled BSDF” shader node. This will change the directions of the faces on the model.
We can add a “Bump” node between our “Noise Texture” and the “Normal” input on the “Principled BSDF” node. Wire it up like this:
Our donut now looks like a crumpled piece of paper. This is because the “Distance” setting in the “Bump” node is too high. The distance units are meters. We need to pick something way smaller, like maybe 0.005. We may also need to increase the “Detail” setting in the “Noise Texture” node. Play with both until you get something you like:
Tip: Don’t go too crazy with the details. If you do this, everything else we add to our scene later on will need to be at more or less the same level of detail, so that everything “fits together”. Sticking with a lower-res, more stylized donut will save us work later on.
After some tweaking, I adjusted my detail back down to “5” and the “Distance” for the Bump node to “0.002”. I put the icing back to help me judge how well the donut’s new details “fit” with my stylized icing:
Texture Painting
So far, all the detail on the surface of the donut has been procedurally generated.
However, sometimes you need to create (or “paint”) textures by hand. In our case, we’re going to be painting a texture by hand to create the “white ring” that you can see around the center of most donuts (a quick google search should show you what I mean).
We’ll be using the “Texture Paint” workspace for this:
Because the donut has no texture data assigned to it yet, it will show up in purple:
Purple is how Blender normally indicates missing texture data.
Adding An Image Texture
We need to add an “image texture” to our donut.
We don’t want to lose our existing node setup, so we want to add an image texture in our Shading workspace (to add a new “Image Texture” node to our workflow, hit “Shift + A” to add):
Search for “Image Texture”:
Connect the “Image Texture” node’s “Color” output to the “Base Color” input on the “Principled BSDF” shader node:
From the Image Texture node, we can use the “open” button to map an existing texture onto an object, or we can hit “New” to create a new, blank texture. This is what we will be doing.
Clicking on “New” will open a “New Image” popup:
Tip: As shown above, blender can do math for you in text fields. Simply putting a “/2” after the height and width fields and hitting “Enter” will cut them in half…for a final size of 512x512.
Because our scene is not going to be super high resolution, we’ll keep the height and width of our texture very small (512x512 pixels). Choosing a higher texture resolution means working with our donut in Blender will be slower (more resources required to render the texture in the viewport) and renders will be slower.
Same principle as before: only include as much detail as is needed, not more than that.
We now need to set the color of the image texture:
Finally, we should see the new color showing up in the viewport:
Painting On Our New Texture
Switch back to “Texture Paint”. Clicking on “Active Tool” should show the Texture Paint options:
We can now “paint” on our donut:
You can paint on the texture (left window) or on the model (right window). Of course, it’s usually easier to paint on the model!
Tip: You can use the same hot keys as you would for sculpting: “F” is brush size and “Shift + F” is brush strength.
You can use the “X” key to swap back and forth between a primary and secondary colors while painting. This can be handy when you’re painting in more than one color.
After painting for an embarrassingly long time, I ended up with this:
Combining Image Texture With Noise Texture
We want to combine our Image Texture with our Noise Texture so that we can keep the “bumpy” surface effects we worked on in part 7.
To do this, we need a new node called “MixRGB”:
From the dropdown on the MixRGB node, choose “Overlay”:
Play with the “Fac” slider until the Noise Texture and Image Texture are nicely balanced.
Note: The Image Texture’s Color output should be fed into MixRGB, while the Noise Texture’s Fac output should be fed into MixRGB.
Saving The Texture
Super important note: Because we have added an Image Texture, a dialog like this one should show up when we exit blender:
Make absolutely sure that box is checked before you exit! If you fail to do this, all your texture painting work will be gone!
Geometry Nodes
Next, we want to add some sprinkles to the donut. We’ll use “geometry nodes” for this. In previous versions of the donut tutorial, “particles” were used, but “geometry nodes” are a better option in Blender 3.x.
Much like the nodes we’ve used so far to create texture, geometry nodes allow use to procedurally generate changes to the mesh (changes to our objects).
This enables all sorts of cool stuff, from the ability to dynamically generate frost or icicles on a surface, to the ability to create buildings whose height, window position, and number of floors are all procedurally controlled.
Start Using Geometry Nodes
We’ll create a new Workspace (tab) at the top of blender, which will allow us to see our geometry node setup alongside our donut:
If you don’t see this, look for a little down arrow near the top right corner of the top menu bar. Click on that, and choose “General -> Geometry Nodes”.
We won’t be needing the window in the upper left that shows the positions of all our vertices, so we can close that:
Now, we click on “New” to create a new geometry node setup:
Note that if your nodes disappear, you can get them back by clicking on the “Geometry Nodes” modifier in the right-hand pane:
The node on the left (Group Input) reads in the existing data for our mesh (for the donut, in this case).
The node on the right is the final mesh, after any changes made by our geometry nodes. For instance, if we add a “set position” node and add a Z offset, the donut now moves (the output mesh position has been changed):
We don’t want to alter the donut, but rather the icing (we are adding sprinkles). I now delete the Geometry Nodes I created for the Donut, and switch to the Icing instead:
We now need to add a “Distribute Points On Faces” node. Hit “Shift + A” to add a new node, then start searching using the search bar that opens:
You can see there’s a single enormous “point” sticking to the icing. We need to toggle the density to adjust this, which we will do later.
The icing also appears to have “disappeared”. This is because we have replaced our icing mesh with the output from “Distribute Points on Faces”. We need to add a “Join Geometry” node to combine our points with the original icing mesh, like this:
For the time being, we also set the density of our points to “0”, which will hide the giant “blobs” that Blender is currently rendering in the viewport:
Now we take a break from Geometry Nodes to create a model for the sprinkles we want to distribute over the surface of the icing. From the viewport, we hit “Shift + A” then go to “Mesh -> Cylinder” to add a new cylinder to the scene. You might have to zoom out to see it: the default size is way too big!
We need to scale down the sprinkle and reduce its level of detail. Because there will be dozens or hundreds of sprinkles scattered over the icing, we don’t want or need excessive detail (which will slow down renders and also slow down editing in the viewport). Setting the vertex count for the sprinkle to “8” should be OK, as here:
We now need to add a new geometry node, “Instance on Points” to our Icing’s Geometry Node setup:
Next, we can click on our sprinkle in the Outline view at the top right, then click and drag it onto the Geometry Nodes view at the bottom. This will generate a new “Object Info” node, like this:
We then connect the “Geometry” output of the Object Info node to the “Instance” input on the Instance on Points node:
One last step: we scaled our sprinkle cylinder, and we now need to “apply” its new scale, before it will start showing up on the icing correctly. Click on the sprinkle, hit “Control + A”, and then choose “Scale”:
You may need to play with the density a bit before you start seeing sprinkles on your icing:
Of course, the sprinkles are now rotated the wrong way. Rotate your sprinkle so that it’s sitting horizontally (-90 degrees).
Again, after you do this you have to apply the rotation with “Control + A”, this time choosing “Rotation”:
Things now look a little better, but all the sprinkles are pointing in a uniform direction and sticking out from the icing very unnaturally:
We can fix this by making the sprinkles follow the geometry of the faces nearest each sprinkle (i.e. the sprinkle should be aligned with the icing mesh itself).
To do this, we take the “Rotation” output from “Distribute Points on Faces”, and feed it into the “Rotation” input on “Instance on Points”:
We also need to increase the density. Because we are working at a very small scale, we need very high densities in order to see enough sprinkles showing up!
In my case, a density of about “10,000” gets me the results I’m looking for:
Note: The reason for this is that the units for “density” are “density per meter”.
We still have a problem, though. Our sprinkles are all sort of uniformly “brushed” onto the surface of the donut. We need a way to adjust the rotation for each sprinkle to get a more organic look.
We can do this by adding a “Rotate Euler” node, like this:
We need to make some adjustments to this node to get the results we want. We need to change the rotation effect from “Object” to “Local”, and we also need to tweak the “Z” value until we get a nice-looking result:
However, we still want to have some randomness in the rotation value for each sprinkle, so we need to add a “Random Value” node, as shown here:
Tip: As shown here, you can type in the name of a mathematical constant such as “tau”, and hit enter. Blender will convert that to its numerical value for you. Neat!
There’s a lot going on here, so let’s explain:
We have set the Random Value node to “Vector”, meaning it will produce [X,Y,Z] vectors as output. Setting the min and max
values for X and Y to zero means we won’t generate any rotation in X or
Y when we input our vector to the “Rotate Euler” node. We set “Z” to
“tau” because “tau” is equal to 2pi
(360 degrees). This
means our “Z” values can range from 0 degrees to 360 degrees, so our
sprinkles can be rotated any direction along the Z axis.
This gives us a much nicer, much more natural-looking set of sprinkles, like this:
We now need to fix two more problems:
- We don’t want sprinkles showing up on the “globs” of icing at the edges:
- We also don’t want sprinkles showing up “underneath” the icing:
To solve these issues, we are going to use Blender’s “weight paint” tool. This will let us “paint in” the areas on the icing where we want sprinkles to appear.
Select the icing and hit “Control + Tab” (not “Command + Tab”, even if you’re on a Mac), then choose “Weight Paint”:
We will hide our sprinkles in the viewport, so we can more easily see what we’re doing:
Tip: When weight painting, a blue color indicates a value of “0”, while red represents a value of “1”. Higher values will end up with more sprinkles.
We then paint the surface of the donut. Try to avoid painting it in a completely uniform way, as we want a more “organic” distribution for the sprinkles:
Tip: As with other painting and sculpting tools, you can change the brush size with “F” and the brush strength with “Control + F”
How can we get the sprinkles to use the new “Vertex Group” that was created by Weight Painting? We can see it in the “Vertex Groups” side-pane, as shown here:
It might be a good idea to rename it, too!
Now, we need a way to take the results of our Weight Paint and apply them to the sprinkles. We start by dragging a new wire from “Density” on the “Distribute Points on Faces” node, over to one of the blank inputs on “Group input”, like this:
What this does is “expose” this density value, so it shows up in your modifier stack on the right-hand side of the window, along with all our other modifiers. This means we can adjust the “Density” setting of “Distribute Points on Faces” directly, from the “modifiers” pane:
Better, using the little box next to “Density” in the “modifiers” pane, we can change the density from a constant value to the value of the Weight Paint:
After doing this, nothing appears to happen! Why is this? Because the Weight Paint assigns weightings from 0 to 1, and we need values at or above 10,000.
We can fix this by adjusting the settings of the “Distribute Points on Faces” node. We’ll switch from “Random” to “Poisson Disk”:
You can see this gives us additional options to play with, including:
- Density Max, which allows us to choose the maximum density value (we can set a high value here - like 40,000 - to generate more sprinkles)
- Density Factor, which allows you to multiply the “Density Max” value by some other factor: in this case, we can set the Density Factor to the output of our Weight Paint!
- Distance Min, which allows us to set a radius around each sprinkle, inside which other points (meaning other sprinkles) will not be generated: this helps us avoid having sprinkles “clip” through one another
- Seed, which chooses a random seed which affects how the sprinkles will be distributed (you can play with this value until you get a distribution of sprinkles that you like the look of!)
However, we’re still not done. If you look closely, you’ll see that the sprinkles are nicely distributed and rotated now, but we still aren’t using our Weight Paint from earlier. We need to add a few more nodes to make that happen.
- Drag a wire from “Density Max” on the “Distribute Points on Faces” node, to the empty input at the bottom of the “Group Input node”
- Hit “N” from the Geometry Nodes editor window to bring up the side panel, then click on “Groups”
- Rename the two inputs that appear there: the “Density” input from earlier can be renamed to “Weight Paint” to make its function clearer, and the new input can be called something like “Density Max”
I do my best to show all 4 steps in the two screenshots below:
As once more “nice thing” just to clean up a little more and make the “Density Max” values easier to change, we can set Density Max to a smaller value (say “2”), and add a “Math Node” between the “Density” output on our “Group Input” node and the “Density Max” input on our “Distribute Points on Faces” node, like this:
Randomizing Colors
First, Improve The Sprinkle
Our next task is to improve our sprinkles a little bit. They should be rounded at the ends (less “sharp”) and should be different colors as well.
We can change their shape with a subsurface modifier (in this case, “Subdivision Subsurface”):
Our sprinkle looks a bit too “pointy”. We can fix this by altering our mesh with “Control + R”, which will let us add a “loop cut” to the sprinkle’s mesh.
The process is:
- Switch to Edit Mode (hit “Tab”)
- “Control + R” to start the loop cut, which will bring up a small yellow ring at the point where the loop cut will be inserted:
- Left-click to confirm, then slide the loop cut towards the end of the sprinkle, and left-click again to set the final position:
Follow these steps twice, to create loop cuts near both ends of the sprinkle:
Our sprinkle is now looking a lot better. We can also right-click on the sprinkle and choose “shade smooth” to make it look a little bit nicer:
Next, Add Some Variations
With the sprinkle selected in Object Mode, hit “Shift + D” to duplicate the sprinkle.
Switch back to edit mode by hitting “Tab”, then start making changes to the new sprinkle by grabbing (“G”), scaling (“S”), and rotating (“R”) the mesh to change the sprinkle’s length and curvature. It might also help to add several more loop cuts with “Control + R”.
Here are my results after playing around a bit (I added two new loop cuts and used grab (“G”) to pull the mesh around):
Tip: You can change the way Blender selects parts of the object’s mesh using the “1”, “2” and “3” hotkeys, while in Edit Mode. “1” selects vertices, “2” selects edges, and “3” selects faces. If you are on a laptop without a number pad, you can select these modes from the top menu bar:
Repeat the steps above a few more times, to produce a set of different looking sprinkles (curved and long, straight, short and fat, etc…), like so:
Tip: You can use the scroll wheel to decide how many loop cuts get created when you hit “Control + R”. This lets you place multiple loop cuts at once.
Creating A Collection
We now need our donut to reference the new sprinkles we have created. If we go back to the “Geometry Nodes” view, we see that our “Object Info” node references just the first sprinkle we created.
We will need to:
- Rename our sprinkles so they are easier to differentiate
- Create a “collection” to hold them
- Reference this collection in our Geometry Nodes
Let’s start by renaming our sprinkles:
![Renaming](/images/blender/10_media/renaming 1.png)
Select the sprinkles and hit “M” for “move”, to add them to a new collection (I have named the collection “Sprinkles”):
We now need to delete the “Object Info” node from our Geometry Nodes, and replace it with a “Collection Info” node, as here:
Tip: As usual, “Shift + A” can be used to add a new node to the Geometry Nodes workflow
If you have accidentally added other things to the collection (like I have), you might get something like this:
In my case, I have accidentally added the plane to the “Sprinkles” collection. Removing it (by clicking and dragging it out of the “Sprinkles” collection from the overview at the upper right-hand corner of the screen, as above) fixes the problem. However, this creates several new problems:
We can fix these problems by checking a couple of boxes on the “Collection Info” and “Instance on Points” nodes:
- Check “Pick Instance” on the “Instance on Points” node, which will improve render times
- Check “Separate Children” on “Collection Info”, which will make sure each point references a single sprinkle rather than the whole set
- Check “Reset Children” on “Collection Info”, which will essentially reset the origin point for each sprinkle, so they are rendered properly on the icing rather than some distance from it.
We should now have something much nicer looking:
Returning to the Render view, we’ll see something like this:
Next, we need to assign colors to our sprinkles. We could manually assign a material to each of the sprinkles in our collection, but a better way to do things is to allow Blender to assign colors at random from a range.
We will start by assigning a single material to all of our sprinkles. First, create a new material called “Sprinkles” and associate it with one of the sprinkles in the collection (any sprinkle will do):
Now, switch to the “Shading” view, choose the “Sprinkles” collection from the collections menu at the upper right-hand corner, and hit “Shift + A” to add an “Object Info” node, as shown here:
Unfortunately, this still looks pretty lame! By hitting “Shift + A” again from the Nodes view and selecting “Converter -> ColorRamp”, we can get some nicer colors going on:
Of course, we will have to tweak things a bit to get more interesting colors. Change the ColorRamp’s type to “Constant”, click on each of the sliders at the ends of the color scale, and change them to something more interesting. I’ve gone for green and yellow:
Finishing Touches
I ended up adding a few more colors, then adding a “UV Sphere” to my Sprinkles collection. I also linked the sphere to the Sprinkles material, following the same steps used to do that for the other sprinkles.
In the video, Blender Guru doesn’t do that second step (adding the sphere to the “Sprinkles” collection), because he wants to limit the number of balls. I chose to leave it in: I want more balls!
Continue tweaking colors and adding sprinkle types until your own creative urges are satisfied!
Tip: If you change the sizes of any of your sprinkles in your collection, you might notice that the sprinkles on top of your icing do not change size. This is because you must apply the new scale. To do this, select the sprinkle you have just scaled, hit “Control + A”, and choose “Scale” from the menu that pops up.
NOTE: This section below is EXTRA CREDIT - Animating The Donut
Camera Settings
We will need to adjust the camera settings and the rotation of the donut, to get things set up the way we want.
Tip: You can set the camera to your current viewing angle by clicking “View -> Align View -> Align Camera To View” (from the “View” menu)
To make it easier to rotate the donut around, we want to “parent” the icing to the donut, meaning that objects will track (follow) each other when rotated or moved.
Setting the icing’s “parent” to be the body of the donut means that the icing will rotate and move with the donut, whenever the donut is rotated or moved.
We “parent” one object to another like this:
- Click on the “child” object, by left-clicking on it in the viewport
- “Shift + Left Click” on the object we want to set as the “parent”
- Hit “Control + P” to confirm the relationship
- Choose “Object” from the menu that comes up (see below)
Orient the donut at an angle to the camera, like so:
Next, we adjust the camera settings to change the aspect ratio and resolution. Let’s try 1080 by 1440:
We will also adjust the focal length of the camera to 40mm to give the donut an enhanced sense of “depth” as it rotates:
In general “high” focal length “flattens” things by compressing the depth of the scene, while you can get a more exaggerated “fisheye” look (emphasize the depth) by setting a “low” focal length.
Using The Timeline (Playback) Editor
When animating, we will need the ability to see and manipulate the timeline for the animation.
To show the playback view, I switched to “Layout” from Blender’s top menu bar, dragged the bottom window up to enlarge it, and chose “Timeline” as shown here:
Before we start editing, we should choose a framerate (measured in FPS - frames per second) as well.
- 24 FPS is standard for big-budget movies
- 29.97 or 30 FPS for television and films (and a lot of phones and cameras)
- 60 FPS for some new equipment
Blender Guru used 60 FPS for his animation because he likes the “hyper-real” feel of it, but it’s very taxing to render 60 FPS, so he recommends 30 FPS, as a reasonable alternative:
Inserting “Keyframes”
The start and end frames on the timeline window at the bottom show the total number of frames in the animation (you can adjust this as needed). By default, there are 250 frames. At 30 FPS, this will result in an 8.3-second animation.
Along the timeline, we can insert “Keyframes”, which - among other things - mark the location an object should be at when a given frame is reached:
You should move the donut and then set another keyframe (again by hitting “I”), perhaps 30 or 40 frames after your initial keyframe:
Tip: You can return to the start of the playback timeline with “Shift + Left Arrow”, then hit “Spacebar” to start the animation
Playing the animation back should now show something like this (if you are reading this in PDF format, the below image is a .GIF. You can find the original post on https://jeremypedersen.com/categories/blender-donut/ along with others in this series):
If you paid very close attention, you might notice that the donut moves more slowly than we would expect for 30 FPS (in my case, the whole movement should be completed in under 2 seconds, but appears to take longer when previewing in Blender).
Going to “Playback” and changing “Sync” from “Play Every Frame” to “Frame Dropping” will play the animation back at full speed, dropping frames that cannot be rendered in time:
Blender may struggle to do rendering in real-time, so the on-screen movement may be slower than the expected 30 FPS unless we turn on frame-dropping.
Tip: With the timeline at the bottom of the window selected, you can hit “Control + T” to switch from Frames to Seconds (and back).
Setting Up The Animation
I hit “Shift + Left Arrow” to return to the first frame, rotate my donut to a nice-looking angle along the Z-axis (10 degrees in my case), and hit “I” to add a keyframe at frame 1. This time I choose Rotation not Location:
I then rotate my donut to just the point where the back of the donut would start to come into focus, and set another keyframe near the end of the timeline (around frame 200), like this:
You might notice that the donut appears to “speed up” and “slow down” as it moves between the two keyframes. This is because the keyframes are “bezier” keyframes, and Blender is trying to blend smoothly from one frame into the next.
This will be easier to see from the “Animation” view, so let’s switch to that. We will also set the lefthand window to “Graph Editor”:
Note that we can delete the “object transformations” along the X and Y axis, as all of our motion is a rotational motion about the Z-axis:
Next, we add a new keyframe right around our last keyframe, like so:
Choosing a keyframe from the “Graph Editor” and hitting “N” will show us the properties of that keyframe. Here, I can see the rotation value for the first keyframe (-320 degrees):
From -320 degrees, we want to do TWO revolutions of the donut. First, we drag the last keyframe out past the final frame in the animation (frame 250):
Then we set the angle value for the rotation at that keyframe to -320 + 360 + 360. This should give us two full rotations and return us to our original position:
If you look at the Graph Editor window, you’ll see that the speed of motion is not constant, since the rotational change from the second keyframe to the third keyframe is larger than that from the first keyframe to the second keyframe.
This is what we are going for (we want to see more of the front of the donut than the back, so the rotation “around the back” should be fast), but we still want the motion to be a little less abrupt.
We can do this by adjusting the “bezier handles” associated with the first two keyframes. Adjusting their length will affect “speed”, while adjusting their position will affect “smoothness”. You’ll get a feel for exactly what that means by playing with things yourself:
Continue tweaking until you get an animated loop that you think looks right.
No comments:
Post a Comment