Book Image

Blender 3D Cookbook

By : Enrico Valenza
Book Image

Blender 3D Cookbook

By: Enrico Valenza

Overview of this book

Table of Contents (21 chapters)
Blender 3D Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting templates with the Images as Planes add-on


In this recipe, we'll set the character's templates by using the Images as Planes add-on.

Getting ready

The first thing to do is to be sure that all the required add-ons are enabled in the preferences; in this first recipe, we need the Images as Planes and Copy Attributes Menu add-ons. When starting Blender with the factory settings, they appear gray in the User Preferences panel's Add-ons list, meaning that they are not enabled yet. So, we'll do the following:

  1. Call the User Preferences panel (Ctrl + Alt + U) and go to the Add-ons tab.

  2. Under the Categories item on the left-hand side of the panel, click on 3D View.

  3. Check the empty little checkbox on the right-hand side of the 3D View: Copy Attributes Menu add-on to enable it.

  4. Go back to the Categories item on the left-hand side of the panel and click on Import-Export.

  5. Scroll down the add-ons list to the right-hand side to find the Import-Export: Import Images as Planes add-on (usually, towards the middle of the long list).

  6. Enable it, and then click on the Save User Settings button to the left-bottom of the panel and close it.

    The User Preferences panel with the Categories list and the Addons tab to enable the several add-ons

    There are still a few things we should do to prepare the 3D scene and make our life easier:

  7. Delete the already selected Cube primitive.

  8. Select the Lamp and the Camera and move them on to a different layer; I usually have them on the sixth layer (M key), in order to keep free and empty both the first and second rows of the left layer's block.

  9. The Outliner can be found in the top-right corner of the default workspace. It shows a list view of the scene. Set Display Mode of the Outliner to Visible Layers.

  10. Lastly, save the file as Gidiosaurus_base_mesh.blend.

How to do it…

Although not strictly necessary, it would be better to have the three (at least in the case of a biped character, the Front, Side, and Back view) templates as separated images. This will allow us to load a specific one for each view, if necessary. Also, to facilitate the process, all these images should be the same height in pixels.

In our case, the required three views are provided for you in the files that accompany this book. You will find them in the templates folder. The Import Images as Planes add-on will take care of loading them into the scene:

  1. Left-click on File | Import | Images as Planes in the top-left menu on the main header of the Blender UI.

  2. On the page that just opened, go to the Material Settings column on the left-hand side (under the Import Images as Planes options) and enable the Shadeless item. Then, browse to the location where you placed your templates folder and load the gidiosaurus_front.png image:

    The Import pop-up menu and the material settings subpanel of the Import Images as Planes add-on

  3. Rotate 90 degrees on the x axis (R | X | 90 | Enter) of the Plane that just appeared at the center of the scene (at the 3D Cursor location, actually; to reset the position of the 3D Cursor at the center of the scene, press the Shift + C keys).

  4. Press N to call the Properties sidepanel on the right-hand side of the active 3D window, and then go to the Shading subpanel and enable the Textured Solid item.

  5. Press 1 on the numpad to go to the Front view:

    The imported plane with the relative UV-mapped image

    Now, we know that our Gidiosaurus is a 2.5 meters tall beast. So, assuming that 1 Blender Unit is equal to 1 meter, we must scale the plane to make the character's front template two and a half Blender Units tall (Note that it is not the plane that must be 2.5 units tall, it's the character's shape inside the plane).

  6. Add an Empty to the scene (Shift + A | Empty | Plain Axes).

  7. Duplicate it and move it 2.5 units up on the z axis (Shift + D | Z | 2.5 | Enter).

  8. Go to the Outliner and click on the arrows on the side of the names of the two Empties (Empty and Empty.001), in order to make them gray and the Empties not selectable.

  9. Select the Plane and move it to align the bottom (feet) guideline to the horizontal arm of the first Empty (you actually have to move it on the z axis by 0.4470, but note that by pressing the Ctrl key, you can restrict movements to the grid and with Ctrl + Shift, you can have even finer control).

  10. Be sure that the 3D Cursor is at the object origin, and press the period key to switch Pivot center for rotation/scaling to the 3D Cursor.

  11. Press S to scale the Plane bigger and align the top-head guideline to the horizontal arm of the second Empty (you have to scale it to a value of 2.8300):

    The properly scaled plane in the 3D scene

  12. Left-click again on File | Import | Images as Planes in the top-left menu on the main header of the Blender UI.

  13. Browse to the location where you placed your templates folder and this time load the gidiosaurus_side.png image.

  14. Shift + right-click on the first Plane (gidiosaurus_front.png) to select it and make it the active one. Then, press Ctrl + C and from the Copy Attributes pop-up menu, select Copy Location.

  15. Press Ctrl + C again and this time select Copy Rotation; press Ctrl + C one more time and select Copy Scale.

  16. Right-click to select the second Plane (gidiosaurus_side.png) in the 3D view, or click on its name in the Outliner, and rotate it 90 degrees on the z axis (R | Z | 90 | Enter).

  17. Optionally, you can move the second Plane to the second layer (M | second button on the Move to Layer panel).

  18. Again, left-click on File | Import | Images as Planes, browse to the templates folder, and load the gidiosaurus_back.png image.

  19. Repeat from step 12 to step 15 and move the third Plane on a different layer.

  20. Save the file.

How it works…

We used a Python script, which is an add-on, to import planes into our scene that are automatically UV-mapped with the selected image, and inherit the images' height/width aspect ratio.

To have the textures/templates clearly visible from any angle in the 3D view, we have enabled the Shadeless option for the Planes materials; we did this directly in the importer preferences. We can also set each material to shadeless later in the Material window.

We then used another add-on to copy the attributes from a selected object, in order to quickly match common parameters such as location, scale, and rotation:

The template planes aligned to the x and y axis (Front and Side views)

The imported Planes can be placed on different layers for practicality; they can also be on a single layer and their visibility can be toggled on and off by clicking on the eye icon in the Outliner.