Building the Model
Before you start modeling a final product, you should conduct experiments to determine how much detail you should include in your models. Keep in mind this simple formulathe more detail you include, the slower the animation. Making this formula even more fun to work with is the fact that the speed of your animations will vary from PC to PC, due to CPU differences. Generally, Shockwave 3D can handle as much detail as you want, because it can adaptively adjust the model quality (the number of polygons) on-the-fly. However, note that performing these on-the-fly adjustments causes a reduction in frames per second, rendering slower animation speeds.
There is no best-practice policy when modeling for Shockwave 3D because there are many options to work with to get the desired quality or animation effect. I generally favor modeling very high-quality and detail-oriented models. I then output my model to Shockwave 3D to see what type of performance I'm going to get. As might be predicted, the model is usually too slow. Thus, I go back to 3ds max and make changes to reduce the number of details I'm going to use.
3ds max 4 has a great Polygon Counter tool [3.2] that allows you to see the total polygon count for an entire scene and for specific models. This tool is located in the Utilities tab. The counter will also let you set a color range if your models start to get close to 10,000 polygons, for example.
Figure 3.2. Use the polygon counter to help create models with the smallest polygon count possible while still maintaining quality.
Because one of the biggest performance factors is the video card that is in your target machine, you should either find out as much as possible about your target audience or tell your target audience that you recommend specific hardware for the best performance, such as an OpenGL or DirectX capable video card.
The Polygon Counter tool is useful when you build parts that are in the range of 10,000 polygons. With the tool, you can also see different parts of a model that are complex or that have too many polygons. The more sections included in a geometrical piece, the more polygons needed. Again, the more polygons needed for a model, the slower the animation.
The other option that you have is to use Shockwave's Polygon Reduction and Addition tools. These are great tools. Included in these is the Lingo LOD modifier that adjusts the level of detail of a model as it moves closer or further away from the camera. You can hard-set the detail with a slider value from 0 to 100. Values of 0 turn your models off, whereas values of 100 perform no polygon reduction. The LOD command is not only used for polygon reduction, but also to make models disappear and reappear by setting the option to 0 to represent an invisible state. Another way to use this is to adjust the setting based on the animation. If your model is not moving, then the LOD setting can be high, such as 70. When, however, the model is about to transition into an animation state or it is about to be moved by the user, you can quickly reduce the LOD setting to 20. Then, you can reset it to 70 when the model comes to a standstill.
You should experiment with the LOD setting for each model independently, because each model is going to require customized adjustments. Be careful with this setting! The LOD command can turn perfect spheres into pyramids or other unintended shapes if you set its values too low. Experimentation is the only way to learn how to use this setting. Okay, now it's time to get back to our house model.
Recall that we decided on a rough look for the sketch. With a drawing in hand, we can start the modeling process. Because I want to focus on the Shockwave 3D aspects more than the modeling aspects, I'm only going to give brief descriptions of the creation process for this house.
The modeling application I use here is 3ds max, version 4.2 (3ds max 4). If you don't have 3ds max and you are using another modeling application that can perform simple extrusions and Booleans, then this should work for you. Do ensure that you have the Shockwave 3D exporter for your application. If it isn't included on the CD-ROM that came with this book, then check the manufacturer's web site. If you don't have a 3D application that can support Boolean subtractions, I highly recommend you obtain one. Booleans are at the heart of the best photo-realistic models, and they are the fastest way to create geometry.
The 3D cube is drawn to closely resemble the rectangular shape of the house, and is extruded in proportion to the length. If you have a scanner, and your 3D application supports the viewing of bitmapped images, you can trace a poly-line to the exact shape of your house perimeter, then extrude it with both ends capped for the same result.
Next, the base cube you extruded is going to be duplicated and positioned above the original cube in the z-axis [3.3]. We are going to use a copy of the original cube to create a Boolean subtraction that will become the empty volume of the house's interior.
Figure 3.3. Copy your original cube to use as a subtraction object.
Perform a uniform scale on the copy of the house. The result is a scaled piece that is going to be used for the subtraction. The scaled piece needs to be approximately 96% of the size of the original [3.4]. You can use a more non-uniform scaling to match the sides as closely as possible if you are trying to make the Boolean interior perfect. Additionally, you could scale a copy of the polyline before extruding it into a 3D shape.
Figure 3.4. Using the Scale tool, scale the copied box 96%.
You want the scaled copy of the house's sides to be almost exactly the same size of the original house. This is easy to do on a square shape, but it's not easy to do on a rectangular shape, unless you scale the length of the sides to a different percentage.
After you get the copied shape scaled, move it in the z-axis back to the original shape. Try to watch the left wireframe view as you are positioning the copied cube; position it so that the distance from the bottom is equal (as accurately as possible) to the distance from the sides [3.5].
Figure 3.5. Lower the copied, scaled subtraction block into the original, but leave a part of it sticking out at the top.
Perform the Boolean subtraction to eliminate the overlap of the images. After the two shapes are lined up, subtract the copy from the original using the Compound tool in 3ds max. This will form the box shape of your house [3.6]. This is the fastest way to construct this type of room or house shape.
Figure 3.6. After the subtraction, your cube should look like this.
Empty cubes are used so often, it is a puzzle why they are not just added as generic primitives to the toolbar!
Next, you need to insert the walls and extrude them. This is easy to do. First, draw where the walls are going to exist, then extrude them to the same height as the original surrounding cube walls. The simplest way to do this is to switch to the top view and use either the Polyline tool or the 3D box tool and draw where your walls should go, then extrude them up [3.7].
Figure 3.7. Draw and extrude your walls.
Mark the doors and windows for a Boolean subtraction by switching to the side or front view and drawing a cube wherever you want a new window or door [3.8]. Just like the huge subtraction you did on the house foundation, do the same for the doors and windows. The easiest way to do this is to draw your windows and door shapes from the front, left, and right views [3.9]. The depth of the cube(s) is not important as long as it doesn't run through another object causing you to inadvertently create a hole in another wall during the Boolean operation.
Figure 3.8. After the walls are done, you are ready to add the doors and windows.
Figure 3.9. The extruded house with walls and the Boolean doors and windows ready for subtraction.
The level of detail that you use in your Boolean operations is up to you. In this particular example, one subtraction was used to make the windows; however, if you used two or three subtractions while gradually increasing the window sizes, the windows would take on a framing effect. Note, adding subtractions will introduce more polygons to the overall model size, which results in slower animation.
Next, you get to add more detail and realism to the model. You can add glass and blinds to Boolean windows, and doors can be added. The glass is simply a rectangle that is drawn in the top view; then it's extruded to meet the length of the window hole [3.133.14]. Later the glass's opacity can be adjusted and a reflection map can be added.
Now that we have designed and built the 3D house model, extruded the walls, added the doors and windows, and then ended the finishing touches, it is time to add more realistic details to the house, such as lights and textures. First, we'll name the models.