Working with 3D Objects
This is Chapter 7 of the OpenOffice.org 3 Draw Guide, produced by the OOoAuthors group. A PDF of this chapter is available from this wiki page.
- 1 Creating 3D bodies
- 2 3D scenes
- 3 Producing 3D shapes
- 4 Editing 3D objects
- 4.1 Rotating 3D objects
- 4.2 3D settings for 3D bodies
- 4.3 3D settings for 3D shapes
- 5 Combining objects in 3D scenes
Although Draw does not match the functionality of leading drawing or picture editing programs, it is capable of producing and editing very good 3D drawings and pictures.
Draw offers two different types of 3D objects: 3D bodies and 3D shapes. Depending on which type you choose, there are different possibilities for further editing of the object (rotation, illumination, perspective). 3D shapes are simpler to set up and edit than 3D bodies, but 3D bodies currently allow for more customization.
Creating 3D bodies
You can produce 3D bodies in three ways: extrusion, body rotation, and using ready made objects. In this chapter, these methods are called Variation 1, 2, and 3.
Variation 1: Extrusion
First, draw one of the common Draw objects, for example a square/rectangle, circle/ellipse or a text box using the or icons on the Drawing toolbar. Next, choose Modify > Convert > To 3D (or right-click on the object and choose Convert > To 3D, or click the icon) to produce a 3D object from the 2D surface.
The procedure by which parallel surfaces are moved to create a 3D object is known as extrusion. In this case the 2D surface is moved forwards "out of" the drawing level. At the same time the object is slightly tilted and central projection turned on so that one can better recognize the object. Draw uses a default value for the extrusion (the body depth) based on the size of the 2D object. The value can be changed after the extrusion; see Editing 3D objects.
Variation 2: Body rotation
Choose a common drawing object, for example a (non-black) line. Then change this into a rotation body. Draw provides two methods to do this.
Method 1. Click the icon in the Drawing toolbar (this icon is also usually not visible) or choose Modify > Convert > To 3D Rotation object. With this rotation method, the axis of rotation coincides with the left edge of the enclosing selection rectangle, through the green rectangle handles.
|Rotation body created using variation 2.1|
Method 2. Click the icon on the Effects pulldown menu on the Drawing toolbar. This icon can also be accessed from the Mode menu, accessible from View > Toolbars > Mode. Notice that this icon lacks the curved red arrow of the fixed-axis rotation icon.
With this method, you can change the location of the rotation axis, which appears as a dotted line with two white circular endpoints.
Click one of the white endpoints and drag it so that the axis moves to the desired position. You may need to move both ends to achieve this. The outline shows how the figure will be rotated. When you click on the figure again, the rotation is carried out and the new 3D body is produced.
Variation 3: Using ready-made objects
Use the 3D Objects toolbar/pulldown menu. To activate this toolbar, click View > Toolbars > 3D Objects).
After choosing the type of object, left-click on the starting point and drag the mouse diagonally until the outline of the object is the size you want.
After releasing the mouse button, the 3D object appears. To change the height:width ratio of the object, keep the Shift key pressed while dragging the mouse. Most of these objects are constructed by rotation. Cubes and spheres are special types of 3D objects that are directly defined in the OOo program code.
Variations 1-3 all produce a result known as a 3D scene. If you click on a 3D scene, the status bar text shows 3D scene selected. Such a scene is actually a group of objects.
If you constructed the scene using one of the above methods, it consists of the 3D body as a single element. 3D scenes can, however, be extended to include other 3D objects, as described in Combining objects in 3D scenes.
As mentioned in Combining Multiple Objects, you can access individual elements of the group using Modify > Enter group or the context menu. The status bar text then changes and shows the type of each individual element selected, for example Sphere selected or Extrusion object selected.
Producing 3D shapes
Since the release of Version 2.0 of OpenOffice.org, Draw contains a type of drawing object known as a Shape. A special method of extrusion exists for these shapes.
Variation 4: Extrusion of shapes
You use the Basic Shapes toolbar (or another shape toolbar) to produce 2D surfaces. Shapes such as cylinders or cubes are technically possible but not very useful, because they produce curiously curved images. If you have drawn a shape, the last icon on the Drawing toolbar is active. A click on this icon can transform a 2D surface into a 3D object.
Extrusion of a shape does not create a new object type but just changes the shape's appearance. All the object's properties and settings are retained. You can use this button to toggle between a 2D and a 3D view. The actual object properties and settings are not lost in the switching operation from one view to another.
If you click on such an object, the 3D-Settings toolbar is available. If this is not automatically opened, switch it on with View > Toolbars > 3D-Settings.
The first icon corresponds to the icon on the Drawing toolbar. This icon also works as a toggle switch. After changing to 2D, the 3D-Settings toolbar is again hidden. To change the object back to 3D, you must use the icon on the Drawing toolbar.
Variation 5: Fontwork
For text you can also use the shapes from the Fontwork Gallery. These produce a similar type of extrusion objects to those from Variation 4.
|Draw objects of the type "Shape" cannot be viewed with OpenOffice.org Version 1.x. They are simply missing from the drawing. If you save a document with extruded shapes in the older *.sxw format, the shapes will be converted to 3D scenes.|
Editing 3D objects
Rotating 3D objects
Procedure for 3D bodies
The Rotation command used for 2D objects also works with 3D objects, but due to the additional axis, there are a few differences with the editing of 3D objects. The procedure for selecting the object is identical to that used for a 2D object.
You can rotate the object about each axis (X,Y,Z). The X and Y axes are those parallel to the edges of the drawing layer, while the Z axis comes out of the page. It is not possible to change the axis orientation.
These rotations can be carried out on a 3D scene as a whole or on individual objects within a 3D scene.
Procedure for 3D shapes
Objects produced using variations 4 and 5 (see above) can only be rotated about the Z axis when using the three methods described in the previous section. This rotation is carried out on the underlying 2D object. It is also possible to rotate the 3D object in the same way as with a 2D object using Format > Position and Size > Rotation (shortcut key for Position and Size is F4) and specifying the pivot point location and the number of degrees of rotation desired.
Shape objects have their own procedure for rotation about the X and Y axes. If you have activated the 3D-Settings toolbar (under View > Toolbars ), this becomes active when you select the 3D object; icons 2 to 5 on this toolbar rotate the object in 5 degree increments about the X and Y axes.
3D settings for 3D bodies
The 3D Effects dialog offers a wide range of possible settings for 3D objects produced with variations 1 to 3 (see previous sections). To open the dialog, right-click on the object and choose 3D Effects from the pop-up menu. You can also activate a 3D Effects icon on the Standard toolbar or add it to another toolbar using Customize Toolbar > Add > Category Options > 3D Effects.
The dialog can be docked in a similar manner to the Navigator or Template windows.
The possible settings are arranged in various thematic categories on separate pages, accessible through the buttons at the top of the window, which act in a similar way to tabs. To apply the settings you have altered, click the Assign button . This applies all the changes you have made to the object on the other pages of the dialog as well as the current one.
In order for the Effects dialog to take over all the current properties of the object, you must click the button. If you deactivate this button before you leave an object and click on it again when you open the Effects dialog for another object, the settings are carried over from the first object to the second object. You can use this to transfer favorite settings from one object to another, as all the settings are brought over to the new object. In normal use, however, the icon should be left activated.
At the bottom left of the dialog is another row of buttons, which are available on each page.
The first two buttons correspond to the menu commands Modify > Convert > To 3D / To 3D Rotation Object. When the Effects dialog for a 3D object is called up, these buttons are inactive. The third icon switches on or off a perspective view of the object.
|Converts the selected 2D object to an extrusion body.|
|Converts the selected 2D object to a rotation body.|
|Switches between a central projection and a perspective projection.|
With a central projection parallel edges are shown as meeting at some common point in the distance, as shown on the button symbol. Parallel projection retains all parallel edges as parallel, as is often used to produce oblique figures in school. The switching process is carried out on the entire 3D scene.
With central projection, Draw creates the object with three vanishing points. The parameters for central projection are set (indirectly) through the camera settings on the Shading dialog page.
3D Effects - Geometry
In the first example, the depth (length) of a body is to be changed. This is possible only if you created it through extrusion. To illustrate: draw a circle and convert it according to Variation 1 into a 3D object (a flat cylinder); see Figures a and b below.
If necessary, select the cylinder, open the 3D Effects dialog, make sure the Geometry page is active, change the parameter Depth to 3.5cm and click on the Assign icon . The cylinder should now resemble the figure in Figure c.
This parameter has no effect on a rotation body or on ready-made 3D objects, although the input field remains active.
With the Rounding parameter you can specify how strongly the edges of the 3D object are rounded. Select (if necessary) the lengthened cylinder again and use the 3D Effects dialog to change the rounding to 30%. The cylinder should now resemble that below.
This parameter also has interesting effects when you convert text into a 3D object.
The Scaled Depth parameter sets the size ratio of the front to the back for a 3D object produced by extrusion. The front side of such an object always protrudes out from the original surface; the rear side is the original surface of the 2D object (that is, the 2D exit surface) even if the object has been rotated in the meantime.
By default the scaling is set to 100%, which results in both surfaces being scaled by the same amount. If you set this scaling to 50% the cylinder becomes a truncated cone.
The diameter of the front side is 50% that of the rear side. It is also possible to create the reverse effect, with the rear side smaller than the front, by using a scaling depth greater than 100%.
With rotation bodies this parameter influences the width of the surface parallel to the axis of rotation. At the end of the rotation the surface width of the figure is given by the scaling depth. The distance to the rotation axis remains unchanged. In the figure below, a line is rotated to create a 3D object with a scaling depth figure of 0%.
The Rotation Angle parameter is only available for rotation bodies. With this parameter you can create a segment of a complete rotation body by choosing an angle less than 360 degrees.
The Horizontal and Vertical Segments parameters define the number of segments out of which Draw builds spheres and rotation objects. For rotation objects, the horizontal segments are more important. The vertical segments influence the degree of edge rounding.
In this figure, the left sphere is made up of 10 horizontal and vertical segments while the right sphere has 25 segments. More segments give a smoother surface, but it will take longer to generate the figure on the screen. By default, spheres and hemispheres are constructed with 24 segments. For a square pyramid you need four horizontal segments.
These are properties belonging to individual objects. If you use the setting for segments on a 3D scene, all the objects contained in the scene are modified accordingly.
If you extrude an unfilled circle or intersecting lines with a filling the result may not be what you expect. In this case the Double-Sided tool, on the lower part of the dialog page, may be able to help. It changes the line properties of an object from invisible to continuous and so enables all edges to be seen. Otherwise it may happen that some surfaces receive no filling. For lines without filling the effect is switched on by default and cannot be switched off. This is also a property of single objects.
Use the buttons in the section Normals to modify the normals of a 3D object.
A Normal is a straight line which is perpendicular to the surface of an object (in the same way that a vector, starting from an inner point and extending outwards, is at right angles to the surface of the object at the point where it exits). The figure below shows some normals extending outwards from a sphere made up of 10 segments.
Using normals, the display of the object surface and the variation in colors, textures and lighting can be controlled, influencing directly how the surface of the object is rendered.
The first three icons in the Geometry dialog (shown at the beginning of this paragraph) work as "either-or" switches. Only one of the effects can be active at a given time; an effect can be switched off by clicking on one of the other icons.
The settings belong to individual objects, not scenes; every object can have its own setting. The rest of the icons are normal toggle "on-off" switches. The following effects are available:
The following table shows the linkage between double-sided illumination and inverted normals.
|The light source is on the right.||Normals not inverted||Normals inverted|
|No double sided illumination|
|With double sided illumination|
3D Effects - Shading
The Shading page offers functions for shading the object surface, adding shadows and choosing camera settings.
Shading is a rendering method involving a consideration of lighting ratios, which is used to produce curved 3D surfaces. The surfaces are broken down into small triangular segments. Draw offers three methods to produce this effect: Flat, Phong and Gouraud. The setting selected applies to all objects in the 3D scene.
- Flat is the fastest and simplest method. For every individual segment a special color tone is determined, based on the lighting ratio and the direction of the segment area. This tone is used for the whole area of the segment. The segmentation is clearly visible.
- Phong is the most time-consuming method. With this method, for each pixel the associated normal is determined by interpolation, based on the normals of the segment edges. This causes the segment area to appear curved and the segment intersections are no longer visible.
- Gouraud is a relatively quick method. It determines the color value for the segment corners and calculates the color value for every pixel through linear interpolation. The segment edges are still recognizable, but importantly are less so than with the flat method. The Gouraud method considers only light reflection on diffuse, reflecting surfaces (dispersal).
In the figure shown above the left sphere was rendered with flat shading, the middle with Phong and the right with Gouraud. The quality of the flat method is clearly inferior to the other two. The difference between Phong and Gouraud is small. With the Gouraud method the segments can be very faintly seen and rendered objects have a slightly less "shine" than with the Phong method.
All three methods function at the pixel level and as such, shadowing and mirroring inside the 3D scene is not possible in the way that ray tracing methods permit.
With the the Shadow button you can provide a 3D object with a shadow. By changing the Surface angle you can influence the form of the shadow. The left sphere below has a surface angle of 0° (the paper represents a perpendicular surface behind the object) while the right sphere has a surface angle of 45°. With 90° the paper would be directly under the object.
The shape and size of the the shadow are also influenced by the lighting properties. These can be adjusted on the Illumination page of the dialog. Multiple light sources for shadows are not yet supported. The shadow properties can be set for individual objects in a drawing but where objects form part of a 3D scene, the shadow produced is that of the entire scene.
It is possible to set the shadow property for single objects using the Area property. The shadow is then shown with the color selected in the shadow dialog, but again the representation of the lighting of the scene determines the end result of the entire scene. In this way, colored shadows, with different distances to the object, and different color and transparency effects can be created.
In the Camera field of the shading dialog the settings of the virtual camera can be changed. These settings relate only to the view in central projection and apply to the entire 3D scene. The Distance parameter is used to adjust the spacing between the camera and scene. The default value for an extruded body is equal to the depth or length of the body. With equal length edges front and rear, the effect at large distances is quite small. The standard value of Focal length is 10cm. It has the same significance as with a real camera. Larger focal lengths simulate a telephoto lens, smaller ones a wide-angle lens. The effect that changes in the camera settings have on an object are shown below.
Picture a shows a 3D object with the standard settings. The individual changes are listed in the following table.
3D Effects - Illumination
On the Illumination page you define how a 3D object is lit. The settings apply to all objects in a scene.
You can light a scene with a maximum of eight individual Light sources at the same time. For each of these sources the light color and position relative to the scene can be set. The light sources are represented by eight small light bulbs. When you select this page, the first bulb "lights up" . At least one light source must be active; otherwise, the rendering and shading functions cannot function correctly.
Each symbol functions like a multi-function press switch. With the first mouse click the bulb is selected and with the second click the settings mode for this light source is activated. A third click deactivates the light source.
In the selection list next to the symbols you can choose the color of the active light source. If desired, click the button to open a color palette dialog, where you can define your own color and also adjust the brightness. For the first light source, it is best to retain the neutral color value (default is white); with several light sources it is advisable to reduce the brightness.
In the lower right corner of the menu the light source location and orientation is depicted. With the vertical slider bar you can adjust the lighting angle; with the horizontal bar the light is rotated about the object. Alternatively you can click on the light point and drag the point as you please. Click on the small square in the bottom right (circled) to change the preview image from a sphere to a cube.
The use of additional light sources can result in some interesting effects.
In Figure 31 the ring has the lighting settings from Figure 30 with the standard color white. In addition it was lit with magenta, and also from the left underside with yellow. The number and position of the light sources is shown in the window at the lower right. The three light sources in use can be recognized by the "lit" symbols .
To see the effect of a particular lighting effect you can also temporarily turn it off. With an object selected, clicking on a "lit" symbol turns it off . This new setting must then be applied (assigned) to the scene. With a further mouse click on the light source the effect can be switched back on and then re-assigned.
You can also change the settings for the Ambient lighting. The selection of properties (lighting color, brightness, and so on) is carried out in same way as for light sources.
3D Effects - Textures
Textures are raster graphics (bitmaps) which can be used as an object property for the surface of an object. Every object in a 3D scene can have its own texture.
You can set a raster graphic as a texture for a 3D object in the same way as for a 2D object (Format > Area > Bitmaps or right-click on the object > Area > Bitmaps) — as is the case for Gradient and Hatching. More details are found in Changing Object Attributes.
If the Fill setting on the Area dialog is Color, then the Texture page is inactive. Change it to Bitmap to activate the Texture page for 3D objects. If the texture is not tiled or stretched and is smaller than the object, then the remainder of the area will have the color of the Object color property on the Material page.
In the first row of the page are two switches (Type) with which you can choose between black and white or color for the texture.
With the two switches in the row Mode you can control whether the texture of the selected objects is rendered with light and shadows (Switch 2) or not (Switch 1). By means of appropriate lighting and shading adjustments, the graphic object is more realistically rendered.
Projection X / Y
With one of the three buttons you can determine how the texture for this coordinate axis should be projected onto the object. The default setting, Object specific, in general gives the best result. Examples of the use of each button are shown below.
For a rotation body, the turning axis is the Z axis and the wrapping is the X direction; for an extrusion body, the extrusion direction is the Z axis and the extruded surface is the X direction. Depending on how the object was produced, different positions of the texture result.
Area fill without tiling, with adjustments
|Projection X||Projection X||Projection X|
| Projection Y
(Difference is small)
|Cylinder as a rotation body|
Area fill without tiling, with adjustments
|Projection X||Projection X||Projection X|
| Projection Y
(Difference is small)
|Cylinder as an extrusion object|
3D Effects - Material
On this page you can assign the appearance of different materials to the 3D object.
In the selection list under Favorites are the most commonly used materials.
With the individual color parameters, additional effects can be produced. The meaning of these parameters corresponds to those on the Illumination dialog page.
Materials and textures can be combined with one another. Settings only simulate materials and it is sometimes a matter of trial and error to achieve the desired result.
|Do not use too high a brightness value for individual colors. These are all additive and it is easy to end up with a totally white "colored" area.|
Metallic surfaces and glass are not so well simulated, because the impression of these materials is produced through reflection. Such simulation cannot (at the moment) be calculated by OpenOffice.org.
3D settings for 3D shapes
3D shapes are handled quite differently from objects in 3D scenes. The appearance of a shape object is changed using the 3D-Settings toolbar. The 3D Effects dialog described above should not be used for shape objects as it will not give the correct formatting results.
If you have used it in error, you can remove the incorrect formatting with Format > Default Formatting.
With the buttons on this toolbar you can adjust the extrusion depth and perspective, lighting and material properties as well as the extrusion color. There are tear-off bars, which you open by clicking on the small black triangle. The purpose of each individual button is described by its tool tip. You do not need to assign the result of any of the functions to the object as you do with the 3D Effects dialog used with 3D scenes; every action is immediately applied and you can see its effect on the object in the main Draw window.
Here are some examples of formatting of 3D shapes:
Combining objects in 3D scenes
3D objects produced by extrusion or rotation are shown in the status bar as a 3D scene. You can group together several of these objects. Other object types cannot be so grouped. Management of the group is carried out in the same way as described in other parts of this guide (Modify > Enter Group, or Modify > Exit Group), see also Grouping objects.
As an example, we will produce a game piece.
Examples for your own experiments
All examples use objects in 3D scenes.
- To reduce both calculation time and data storage, circles are often constructed as regular polygons. If you cut a sphere or cylinder of 10 segments through the middle you end up with a 20-cornered cut section (10-cornered for a hemisphere).
|Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).|