How to use blender for 3D printing

how to 3d print in blender and how to model for 3d printing in blender and how to 3d print blender models and 3d printing blender tutorial
Dr.MohitBansal Profile Pic
Dr.MohitBansal,Canada,Teacher
Published Date:26-10-2017
Your Website URL(Optional)
Comment
Measuring and Texturing Techniques for 3D Printing You have been given a general introduction to 3D printing. Now it's time to dive into preparing a file to be used in 3D printing. We will cover using the Ruler/Protractor to measure objects and texturing the model. We'll be covering the following topics in this chapter: • Precision modeling in Blender • Using the Ruler/Protractor tool • UV unwrapping • Texture painting • External textures Precision modeling in Blender With 3D printing, every object comes out of Blender into the real world. It must fit on the printing bed of a real 3D printer. It has real walls that must support the weight of the object; it's got real limits on how small or large the detail can be.Measuring and Texturing Techniques for 3D Printing Nothing in the real world is perfect. One note on the instructions in this book. Sometimes several keys need to be pressed at the same time. These will be represented with a plus between them such as Shift + D. Press both keys at the same time. Pressing several keys in sequence will be represented by the word "press" followed by the keys separated by spaces, such as press S Y 0 Enter. You would press the S key, then the Y key, then the 0 key, and finally the Enter key. Some commands may use both, such as press Shift + D Enter. Here, you would press the Shift and the D key at the same time. Then you would press the Enter key. 1. Open Blender or open a new file by navigating to File New File in the upper-left corner of the Blender window. 2. With the mouse over the 3D View, press Z to get into wireframe mode. 3. Press Shift + D Enter to copy the default cube. Press S and use the mouse to scale up the cube. Do it quickly; don't worry about exact size. Select the original cube with the RMB (Right Mouse Button) and scale it quickly. Press A to deselect them. 4. Press Shift + A and navigate to Mesh UV Sphere. Select UV Sphere. Press Shift + D Enter. Press G and move the sphere quickly in a direction. Select the other sphere and move it quickly in the same direction. Press A. 5. Press Shift + A. Navigate to Mesh Monkey. Select Monkey. Press Shift + D Enter. Press R and rotate the monkey quickly. Select the other monkey and rotate it quickly. Press the Home key. You notice that your cubes are not quite the same size. Your spheres did not end up in quite the same place and your monkeys did not rotate to quite the same angle. Unlike usual Blender 3D modeling where dimensions are precise, with 3D printing, there is always some variation in conditions that affect the 3D print. Different printers, different batches of plastic, different materials, and different temperatures all cause variations in the final print. Allowing for these differences is called tolerance. It means that a measurement should be X but we'll accept it within a certain closeness of X. Some of the things that can create this tolerance were discussed in the Factors affecting precision section Chapter 1, Designing Objects for 3D Printing. 20 Chapter 2 Look at the header at the bottom of the 3D View. Note the 20 small boxes, arranged in groups of five. These boxes control the display of individual layers. The top 10 boxes control layers 1 to 10. The bottom 10 boxes control layers 11 to 20. Layer 11 is on the left and layer 20 is on the right. A dark grey box means that the level is visible. A light grey box means that the level is not visible. A grey dot indicates that there are objects in that level. An orange dot indicates that an active object is in that level. Pressing the Shift key while making a selection allows multiple levels to be selected. For any questions about Blender's controls, the Blender 3D Basics book has an excellent introduction to the Blender user interface; check out Chapter 2, Getting Comfortable Using the 3D View, to learn how to set up and use basic controls such as the numpad, mouse, or keyboard on Mac, PC, and Linux. In this book, we will be giving instructions using the standard Blender controls. Using the Ruler/Protractor When building objects, you have to keep their dimensions and the ability of the 3D printer to reproduce them in mind. One of the handiest tools is a new tool called the Ruler/Protractor. It gives you a lot of power for measuring items, but can also be a bit tricky. Its operation may improve as it becomes more mature. To learn how to use the Ruler/Protractor tool, let's use it to check how well a sword fits into its scabbard: 1. Load the file 4597OS_02_Sword.blend from the code bundle of this chapter. Press Z for wireframe display. Press the Shift button and select layer 11 to see the scabbard. At this point, the hilt is not important, so press Shift and select layer 2 to hide it. 2. Press 7 on the numpad to view the blade from the end. Look at the upper- left corner of the 3D View. If you are not in Ortho mode, then press 5 on the numpad. Zoom in so you can see the scabbard and the blade clearly. It looks pretty good. The scabbard and the blade don't interfere with each other, and there is a little room all around the blade. 21 Measuring and Texturing Techniques for 3D Printing 3. In the Object Tools subpanel of the 3D View tool shelf, click on the Ruler/ Protractor button. Move to the left edge of the blade and press Ctrl + LMB (Left Mouse Button). With the LMB pressed, move the cursor to the right edge of the blade. Then release the LMB. You will see a readout of the distance measured as seen in the following screenshot: Don't worry if the readout that you see is not the same as in the screenshot. The Ruler/Protractor tool can be a little bit quirky, and we will discover how to get reliable measurements from it. 4. Press 1 on the numpad. Look at the left-hand end of the ruler. Zoom out so you can see to the end of the blade. Obviously, the ruler, as seen in the left-side of the following screenshot, isn't just measuring across the blade. 5. Select the left end of the ruler with the LMB and move it toward the top end of the blade. When you get it close, release the LMB and zoom in again. Pick up the end again with the LMB and move it close to the end of the blade. Press and hold the LMB and now press the Ctrl button and move the ruler end into place at the end of the blade. When you already have the LMB pressed, pressing the Ctrl button snaps the cursor to the nearest edge or vertex as seen on the right of the following screenshot. 6. Repeat this with the right end of the ruler if needed. 22 Chapter 2 7. Press 7 on the numpad to see the end view again. Adjust the ends of the ruler if needed. I measured just over 3.3 mm as seen in the following screenshot: 8. Now, move the cursor to the top of the blade. Press Ctrl + LMB and move down to the bottom of the blade. Move the cursor a little below the blade and notice how the cursor jumps between the blade and the scabbard. The Ctrl button snaps the end of the ruler to the nearest edge or vertex. 9. Press 1 on the numpad. Look at the new ruler carefully. Notice that the new ruler started at the same Z measurement that the first ruler was at. The last point has snapped to the corner of the blade. Rotate the view a little so you can see the first point separately from the first ruler. Select the first point and move it toward the end of the sword as seen on the right of the following screenshot. Press 7 on the numpad. Select the point again and start moving it. Then press Ctrl as you move it, and move it to the top of the blade. Then, after it snaps in place, press 7 and 1 on the numpad alternately to make sure it's in place. It's a little tricky, but now you can get an accurate measurement. Ctrl + Z to undo an operation does not work with the Ruler/Protractor tool. If you want to delete a ruler, press the Delete button. The ruler is not associated with any specific object. You can snap its measurement between two different objects. Now that you have some idea of how the ruler works, try it for measuring the gap between the blade of the sword and the scabbard. 23 Measuring and Texturing Techniques for 3D Printing 10. Now, check the vertical gap between the blade and the scabbard. Since you already have a measurement on the blade, start measuring from the scabbard. You'll notice that the numerical readouts are not in mm or cm. These readings are in µm (micrometers or microns). I measured about 22 microns, or 0.022mm; that's tiny. The specic fi ations from one 3D printing service say that the accuracy for a detail-plastic copy of the sword would be ± 0.1 mm or 100 µm. Remember the last section, where you moved, rotated, and scaled the objects. The accuracy means that the measurement for the thickness of the sword could be 0.1 mm bigger than you intended, or it could be 0.1 mm smaller than you intended. The same holds true of the scabbard. You could get the sword turning out smaller and the scabbard turning out bigger; in this case, you'd have no problem. But if the sword turned out bigger and the scabbard turned out smaller, it wouldn't t fi . This is called stacking tolerances, and must always be considered when making a multipart assembly. The following table lists possible outcomes of variations in the sword and scabbard: SWORD Bigger Correct Smaller Bigger ??? Okay Okay SCABBARD Correct Bad Okay Okay Smaller Bad Bad ??? Do you think that the scabbard should be enlarged? Remember that the clearance between the sword and scabbard is about 1/5 of the minimum accuracy that the printing service might guarantee. Using the Protractor The Ruler/Protractor tool measures angles as well as lengths. Let's see how to do that: 1. Move the cursor to the middle of the ruler that you used to measure the distance from the top of the blade to the bottom of the blade. 24 Chapter 2 2. Click the LMB and move the cursor toward the edge of the blade. The ruler becomes a protractor as seen in the following screenshot. It tells you the angle in degrees: Measuring the thickness of an object The Ruler/Protractor tool has one more trick. It will measure the thickness of an object: 1. Press the Enter key to get out of the Ruler/Protractor mode and save your rulers. Go to the Visible Layers display on the 3D View header. Press Shift and click on layer 2 to display the hilt of the sword. Zoom out so you can see the hilt well. 2. In the Object Tools subpanel of the 3D View tool shelf, click on the Ruler/ Protractor button. Then choose an end of one of the rulers you have made. As you move it, press the Shift key and watch it automatically measuring the thickness of the object. Press the Esc key when you are done. Remember that you can save these rulers and protractors or dispose of them. I have told you about deleting individual rulers. To get rid of all of them, just press Esc and the Ruler/Protractor mode will turn off and not save any of your tools. Press Enter and the rulers and protractors will be saved and Blender will exit Ruler/Protractor mode. 25 Measuring and Texturing Techniques for 3D Printing Preparing the model for coloring The first difference to realize between making colors in Blender for 3D printing and the usual way of making colors in Blender is that you have less control. All you can control is the diffuse color. You cannot make the object shinier by adjusting the specularity, you cannot add transparency, or any of the other controls. In this respect, a 3D printer is like a regular printer. All it understands is a colored pixel. If you use transparency, at best it will show you the bare physical material underneath. Shininess, specularity, and so on are all properties of the material that you are printing with. There are three ways to color your model: • Leave the model uncolored and select a colored material when printing • Assign colors to the polygons • Assign a texture map to the polygons Leaving the object uncolored Many 3D printers do not handle color. This includes printers that print metal, extruded plastic, or liquid resins. The final color of the object comes from the material selected. Many colors and materials are available. You can dye or paint the objects after they are printed. The lunar lander in Chapter 1, Designing Objects for 3D Printing, was printed in this way. It was printed in white nylon then dyed yellow and grey. Next, the joystick was painted red and black with acrylic paint and a small image of the lander's touchscreen from a standard color copier was glued into place. Blender exports an STL file for printers like these. Vertex colors Assigning color to the polygons is the easiest way, but it's also the most limited because your minimum detail is constrained by the size of the polygon. When you select a polygon and assign a color to it, the color is assigned to all vertices of the polygon: 1. Open Blender or press Ctrl + N for a new file. With the default cube selected, press the Tab key to go into edit mode. 2. In the Properties panel header on the right, select the shiny ball. This opens the Materials panel. 3. In the Diffuse subpanel, set the color tored. 26 Chapter 2 4. Click on Assign. The first material assigned to an object is assigned to all polygons by default. 5. Click on the plus sign to the right of your red material. Click on the New button. Set the Diffuse color toyellow. 6. Press A to deselect all of the vertices. Press C and then move the mouse over four vertices in a polygon while pressing the LMB. Press the RMB when you are done and click on the Assign button. 7. Press F12 to render the scene and view it. Then return to the 3D View window by pressing Esc. That's pretty simple, and when it is printed, you will have a red cube with one yellow side. Vertex painting Blender has painting tools included to do vertex painting, which is much easier than just selecting faces and assigning them colors and produces a better result. Vertex painting allows you to set the colors vertex-by-vertex. Then, the computer blends the color between the vertices. So, between a blue vertex and a white vertex, the edge and part of the face will go from blue to light blue to white. Let's see how vertex painting works: 1. Press Tab to go from Edit Mode to Object Mode. Press A to deselect the cube. Press Shift + A and navigate to Mesh UVSphere from the menu. Select UV Sphere. Press G and use the mouse to move the sphere to the right of the cube. Press the LMB to stop moving the sphere. Zoom in so you can see the sphere better. 2. Press V to go into vertex paint mode. The sphere turns white, and in the toolbox on the left of the 3D View, there is a color palette and paint brush controls. Choose a color and set the radius of the paint brush to15. Put the cursor over the sphere. Press the LMB and move the mouse to paint some of the sphere. 3. Change the color and paint more of the sphere. Choose a third color and just press the LMB to do small dabs of paint. Notice how it only paints at the vertices, not everywhere. 4. Go to the Properties panel. Make a new material. Scroll down to the Options subpanel and check Vertex Color Paint. Press F12 to render. Pretty easy You can see how the colors are centered at the vertices and blended between them. Feel free to play a little more with coloring and rendering. 27 Measuring and Texturing Techniques for 3D Printing Building texture maps The most powerful way of adding a texture to your object is by using a texture map. Do not use a texture map and vertex colors on the same object, especially if the two methods share a vertex. The 3D printer may not choose the right material. Make sure you delete any unwanted materials before exporting your object for 3D printing. This is easy. With your object selected, just select the materials button on the Properties window header. It's the one that looks like a chrome ball. At the top will be a list of the materials assigned to the active object. If you click on them, the Preview window will display a preview of that material. To delete the material, simply click on the minus button to the right of the list of materials. Texture mapping gives you the best control over the color of any part of the surface. It also gives you controls so you can assign the locations of different regions of the texture and use another program such as Gimp or Photoshop to create fine details. Choosing colors for printing The most common colored 3D printing material is gypsum, sometimes called sandstone. The following graphic is a chart of colors used in printing full color sandstone: 28 Chapter 2 You get them from the printing service. The chart on the left-hand side of the preceding diagram shows you a range of colors. The bars on the right-hand side are 3D-printed samples printed with the same colors. Look at the printed samples to choose the printed color you want. Read the index number off of the samples. Then, use a program such as Gimp or Photoshop to get the exact RGB values of the indexed color which you can use to specify the exact color in Blender. This is a useful tool because the colors printed are not always exactly as you specify them. You can see this if you look at one color in the previous chart and samples. And indeed, the printing service specifies that no two samples may be exactly the same. So it's a rough guide, not an exact one. A copy of the chart on the left-hand side is in your download kit as4597OS_02_01.png. UV unwrapping UV mapping is a way of assigning a section of a graphic image to the face of a polygon. This is done by a process called unwrapping the UV mapping. The letters U and V describe the horizontal and vertical axes of a bitmap image. The letters U and V are used to avoid confusion with the X, Y, and Z geometry coordinates. Creating UV maps may seem intimidating, but it's not that difficult. To unwrap the UV mapping, you select a polygon and press the UV Unwrap button. Then, Blender assigns a pair of UV coordinates to each vertex of the polygon and gives them an initial value. Next, in the UV/Image editor window, an image is displayed with an overlay that shows where the UV coordinates for the polygon are with respect to the image. You then move these coordinates around until they are over the section of the image that you want to be displayed on the face of that polygon. Next, you will do some texture mapping onto a model of a dragon that we will be working on for most of the rest of the book. We will decorate its wings, its chest, and its head. UV mapping the wings We will start by applying UV maps to the wings. This will give us good practice in moving the UV coordinates as groups: 1. Open4597OS_02_Dragon_Untextured.blend from the code bundle. 2. In the Properties panel, turn the visibility controls for the Mirror and Subsurf modie fi rs off; they look like eyes. Half of the dragon will disappear and it will look very blocky. The Mirror and Subsurf modie fi rs will be used in Chapter 3, Making a Blender Model that's Ready to Print, and Chapter 4, Making Strong, Light Objects with the Solidify Modie fi r , but they are not needed now. 29 Measuring and Texturing Techniques for 3D Printing 3. Press Tab to get into Edit Mode. Press 3 on the numpad to get a side view. Click on the Face Select button. 4. The lower-left window is the UV/Image Editor. Select Image from the header and then choose New Image from the popup menu. 5. For the dragon's general color, I chose the color square D12 from the chart in the preceding image. Its value is 0.224 Red, 0.58 Green, and 0 Blue. Use those values for the background color of the image. The size should be 1024 x 1024. Then, click on OK. Press Home to see the entire image. 6. In the 3D View, pan down and zoom in so you can see all of the leading edge of the wing as shown in the next screenshot. Press C and select the faces of the front of the wing as seen in the next screenshot. Do not select the faces of the very edge of the wing, just these 5 faces on the side of the wing. Press the RMB to stop selecting. 7. This is the membrane of the wing. The narrow sections on either side of the membrane are the dragon's fingers. Select the rest of the membrane areas, as seen in the following screenshot: 30 Chapter 2 8. Select Mesh from the 3D View header. Then, navigate to UV Unwrap Unwrap from the pop-up menus. Select Unwrap. In the UV/Image Editor, your green image disappears and is replaced by the UV coordinates of the polygons that you have just unwrapped, as seen in the following screenshot: 9. To get your image back, select the Browse Image to be linked button which is to the left-hand side of the New button, as seen in the previous screenshot, and select your green Untitled image from the pop-up menu. Press Home to see the whole image. 10. In the Properties panel, select the Object Data button that looks like a triangle. In the Vertex Groups subpanel, click on the plus button and create a new vertex group. Name itTexture - Outer Wing. Assign the faces to it. This assigns all the faces that are currently selected in the 3D View to the vertex group. Using Vertex Groups to organize your sections of texture is very important. It means you will never have to go through selecting the faces again. This gives you a lot of e fl xibility if you make a mistake and greater control when working with the UV maps. The first thing that you notice when you look at the UV/Image Editor is that the mapping of the UV coordinates does not resemble the shape of the wing. You want to reorganize the UV coordinates so that they do: 1. Find the section that resembles the first membrane that you selected. Select one UV coordinate on it with the RMB. Press L and the whole membrane section is selected, as seen on the left-hand side of the following screenshot: 31 Measuring and Texturing Techniques for 3D Printing 2. Now, rotate this group of UV coordinates into the same orientation that the faces are in the 3D View window. Press R and rotate the coordinates so they are at the same angle as in the 3D View. Press S and scale them so they cover a little less than a quarter of the height of the green image. Press G to move them to the top-left corner of the image as seen in the right-hand side of the preceding screenshot. 3. Select the next section of membrane in the same way as you selected the first. It's the upper-left one that you have not modified, as seen on the left-hand side of the following screenshot: 4. Rotate, scale, and move it so it is snug with the first membrane section as seen on the right-hand side of the preceding screenshot. Leave a gap between them where the fingers of the wing should be. 5. Next, repeat this with the third membrane. It's the one in the lower-left corner. There is a trick with this one. If you look carefully, you'll see it's backwards in X. So, first press S X -1 Enter. This will flip the UV coordinates along the x axis. Then rotate, scale, and move it into place next to the other two membranes. 6. Now move, rotate, and scale the fourth membrane into place. 32 Chapter 2 7. Repeat this with the membrane between a finger and the dragon's body. Now it looks like a wing, as seen on the left-hand side of the following screenshot: Good. Since the UV coordinates are now laid over the image in a shape like the faces of the wing, when you paint the wing, you will know which part of your image is mapped to which part of the wing. Now, to help us remember which section of the image has already been used, let's outline it: 1. There are two buttons labeled View in the UV/Image Editor header. Choose the one in the center of the header with the icon of an image. Select Paint from the pop-up menu. 2. Press N to get the UV/Image Editor properties panel. Scroll down to the Paint subpanel. Set the color to red. Set the radius of the brush to5. 3. Use the Ctrl + MMB (Middle Mouse Button) to zoom into the part of the image where you see the UV faces and Shift + MMB to pan. Outline the faces as done in the preceding screenshot. You are just marking the area where the UV coordinates of the outer wing are so you will know what areas of the image are still available to put the other UV coordinates that you create. 4. Click on the button labeled Paint and choose View from the pop-up menu. 33 Measuring and Texturing Techniques for 3D Printing Congratulations, you have texture mapped the outer side of the wing. Now it's time to do the inner side: 1. Move the cursor over the 3D View window. Press Ctrl + 3 on the numpad to see the other side of the dragon. In the Vertex Groups subpanel of the Properties panel, click on the plus button and create a vertex group named Texture - Inner Wing. 2. Press A to deselect all the faces. Press C and select the faces of the inner side of the wing membrane. 3. Assign these vertices to theTexture - Inner Wing group. Now, UV unwrap the inner side of the wing membranes just as you did for the outer side. Use theUV Unwrap command, display your Untitled image, and move the UV coordinates. Be sure to start building your mapping from the upper-right corner of the image at about the same size as the outer wing was mapped. Do each section as before. 4. If you get stuck and you can't figure out which of the membranes is which, make sure you have assigned the vertices to theTexture - Inner Wing group. Then, in the 3D View, press A to deselect all faces and then select a face from the membrane whose UV coordinates you want to move. They will appear in the UV/Image Editor and you can note where they are. Then, go to the Vertex Groups subpanel and click on Select to have all the faces of the inner wing appear. 5. Once all of the membranes are in place relative to each other, press A in the UV/Image Editor to select all of them then scale the whole so it is about as large as the outer wing as seen in the following screenshot: 34 Chapter 2 6. Paint an outline around the inner wing to mark where it is. 7. Save your Blender file. Then, go down to the UV/Image editor header. There is an next to the word Image. This means that the image in the UV/Image editor has been changed since it was last saved. Click on Image then choose Save As Image from the pop-up menu. Save it in the same folder as your Blender file. You never know what kind of folder structure the printer is using, so it's best to keep them together. UV mapping the belly Now we map the dragon's belly. This will give us practice in modifying individual UV coordinates. Now, it's time to texture the dragon's belly: 1. Press A to deselect all the polygons. Press C and select the column of polygons from the dragons, chin down to his bottom as seen in the following screenshot. Don't select the polygons on his tail. 2. Make a new vertex group namedTexture - Belly and assign the vertices to it. 3. Unwrap the UVs and display your image again. 35 Measuring and Texturing Techniques for 3D Printing 4. Move the cursor over the top row of edges in the UV/Image Editor. Press Alt + RMB to select the top row of edges. Press S Y 0 Enter. This will put all of the selected UV coordinates at the same height. 5. Repeat these steps for the bottom edges. The edges will now be parallel. 6. Now, move the UV coordinates of the bottom row one-by-one so that the vertical edges are straight up and down. After selecting a UV coordinate, pressing G X before you move it will limit your motion to the X direction and make control much easier. 7. Select all of the UV coordinates. Move them almost to the bottom as seen in the following screenshot. Leave a little room below them though. 8. Go into Paint mode and outline where the top row of UV coordinates are. Return to View mode from Paint mode. 9. The reason for making the top and bottom rows parallel is that now if you make scales all of the same size in your art, they will appear smaller when they are at the neck than at the bottom of the dragon's belly. 36 Chapter 2 UV mapping the edges of the wing Mapping the edges of the wings is very similar to mapping the belly and the wings. First you work with groups of UV coordinates, then you work with individual UV coordinates: 1. In the 3D View window, press A to deselect all polygons. Rotate your view so you can see the edge of the dragon's wing. Select the edge of the membranes as seen in the following screenshot. Do not select the edge of the n fi gers: 2. In the Properties panel, make aTexture - Edge Wing vertex group. Assign the faces to it. 3. UV unwrap them. What a mess. What we want to do is line all of the UV coordinates into two nice rows. Remember about deselecting all of them and choosing some faces in the 3D View as a way to get your bearings? Start at the front of the wing and work your way to the back. 37 www.allitebooks.comMeasuring and Texturing Techniques for 3D Printing 4. Move the faces of the edge so that they are in an approximate line. With the mouse over the UV/Image editor, press A to deselect all the UV coordinates. Press Shift + Alt + RMB to select the entire top row section-by-section as seen in the following screenshot: 5. Press S Y 0 Enter. Then, press G Y and move the top row up a little so that the two rows do not overlap. 6. Select the bottom row only. Press S Y 0 Enter. Press G Y and move that row up so it is about as thick as the UV coordinates were originally. 7. Select all of the UV coordinates. Get your image background displayed in the UV/Image Editor. 8. Scale the UV coordinates so that they fit in the image area. Move them just above the area for the belly, as seen in the following screenshot. Paint a red line on the graphic at the top of the area they occupy to mark where they are. Note the solitary orange dot near the lower-left corner of the following screenshot. This is a quirk of Blender. You selected only the faces of the edge of the membranes. But, since the faces on the end of the fingers shared vertices with the edges of the membranes, Blender also picked them up. Since you did not choose them, it did not assign them any area on the UV map. It just lumped them all together in one spot. This will work; just make sure that they are all mapped to an area with the background green. Use the C or B command to select them if you want to move them. UV mapping the head With the UV coordinates of the head, we will learn to adjust the UV coordinates to emphasize certain details, giving us more of the texture map to use on these details and allowing us more creative control: 1. Save your image file and your Blender file. 38