Pages

Senin, 05 September 2011

BLENDER 3D TUTORIAL

INTRODUCTION

The purpose of this blender scene file is to provide a quick path with a very shallow learning curve for users of the Blender Creator software to publish a 3D model of an architectural (or other) environment on a web site using the Blender 3D Plugin. It has all of the interactive logic necessary to enable visitors to walk through a scene in 3D.

Preparing the Model

The 3D model necessary for using this template can come from any software capable of producing 3D models as VRML (Virtual Reality Modeling Language) or DXF (AutoDesk's Drawing Exchange Format). This includes most popular modeling, animation, and 3D design software. Blender Creator itself is quite well suited to this purpose, with a full set of modeling tools and a radiosity solver. Modeling an environment is outside the scope of this tutorial however, so we will assume that the reader already has a 3D model of their environment.

While DXF and VRML 1.0 format import are supported in Blender Creator, the recommended format for import is VRML 2.0. DXF and VRML 1.0 models imported into Blender will not have some information important for being displayed nicely, such as texture information. They typically require a bit of processing after being imported before they are useful.

If possible, save the model from your creation package using the VRML 2.0 format (also known as VRML 97).

Importing the Model into Blender


Start Blender Creator and open the scene file walkthrough_template.blend. To do this, press the F1 key or select Open from the File menu. A file browser window will appear. Navigate to the directory which contains the file, and select the file name from the list with the middle mouse button to load the file. If you don't have a middle mouse button, you can select the file name with the left mouse button, then click the LOAD FILE button.

You will see a 3D window with some objects diplayed in wireframe. The round object labeled "viewer" will represent the viewer as they walk through your model. You will need to locate this object in a later step as you position your model. Import your environment model by opening the VRML or DXF file in the same way you opened the Blender scene file.

When opening a VRML or DXF file, Blender Creator will append the model data to the current scene, so you will see everything which was already there, with the addition of your model. If no error message appears but you do not see your model, it might be outside of the camera's view due to its scale or location. In such cases you can assume a viewpoint which includes everything in the scene by pressing the Home key.

The author of the Blender VRML import tool has prepared a document with more detailed information about its use, including tips and known limitations. It is not avalible at this time.

Orienting, Scaling, and Positioning the Model

For the navigation system to work correctly, the model must have the correct orientation, scale, and location. This is easily accomplished using the orthogonal views available in Blender. The hotkeys for these views are located on the number pad of the keyboard. Make sure you have the NumLock key engaged. Press 7 for a top view, 3 for a right side view, and 1 for a front view. Make sure your model is selected (at least the root object if you imported a hierarchy). Objects can be selected by clicking on them with the right mouse button. Holding the Shift key will allow you to select multiple objects. Pressing the B key will allow you to drag a selection box around objects. The A key will select or deselect all objects.

Viewing your model in the front view, make sure your model appears as an elevation. In other words, make sure the floor is toward the bottom of the viewport and the ceiling is toward the top. If it isn't, you can rotate the model by pressing the R key and moving the mouse. Rotation is viewpoint-dependent; the axis of rotation is parallel to the viewport's line of sight (If the meaning of this isn't clear, try rotating in each of the different views and it will quickly become obvious). Holding the Control key constrains the rotation to 5� increments. Clicking the left mouse button applies the changes to the object. Pressing the Esc key at any time before applying the changes will cancel the operation, resetting the object's rotation.

The S key is used for scaling. Blender Creator has no innate concept of real-world units, so 1 "Blender Unit " can be considered equal to any size you like. When using your model in this template, however, 1 meter of your model should be equal to 1 Blender Unit. If the scale is incorrect, the participant will not have a human eye-level perspective and the navigation system may not work at all. The grid which is visible in the 3D window shows the size of these units in relation to your model. You can use it as a reference as you scale your model in Blender Creator. If you know the ratio of meters to the original units of the model, you can press the N key and type the scale factor into each of the SizeX, SizeY, and SizeZ number buttons. It might be easier for you to scale your model to meters in your creation package before saving it as DXF or VRML for Blender. In any case, visually verify the size against the grid in the 3D window and be sure the grid units look like they represent meters in your model.

Your model should be positioned so that the object representing the viewer sits on the floor of the model in the part of the model where you want the tour to begin. The positioning doesn't have to be precise, but if the object is not approximately on the floor the viewer will experience some jerky movement as the physics system settles the object into place. The G key (think �grab�) is used to position your model. Again, use the orthogonal views to get a clear idea of its position in all 3 dimensions. The Control key will constrain the movement to unit increments. Tapping the middle mouse button while you are moving the model will toggle orthogonal constraint of the movement. This constraint can be turned on and off at any time while moving the model.

The same methods can also be used to position and rotate the spherical viewer object so that the viewer begins with a very specific location and orientation. To select it, click on it with the right mouse button. Be sure to select the spherical object rather than selecting the triangular camera object (Figure 3). Also, only rotate it in top view, or your visitors will see your model from a tilted perspective.

Testing the Scene

Press 0 on your keyboard number pad to see the scene through the camera. Press the P key to start the game engine. To navigate through your model, click on the plugin content. Then, drag with the mouse to turn left/right and look up/down, and use the arrow keys to move forward/backward/left/right. The space bar will toggle flying mode. If everything appears okay in wireframe, press Esc to stop the game engine. Press Alt Z to see the scene with solid faces, textures (if the model has textures), and lights. The scene has some default lights so that there will be something to see even if your model has no textures and no variation in the colors. You will probably want to adjust or remove the lamps, apply some vertex colors, and apply textures to achieve the desired appearance. Start the game engine again. This is the way the scene will appear in the Blender 3D Web Plugin.

Saving the Scene to Disk and Publishing it to the Web

Stop the game engine, then save the file by pressing F2 or selecting Save As from the File menu. Type a filename then press Enter twice or click on the SAVE FILE button. The scene is ready to be embedded in your web pages. Insert the following code into your HTML document, replacing both occurrences of �myscene.blend� with the name of the Blender file you just saved. Be sure to put instructions on your page so your visitors understand how to use the navigation controls.