Search form

'Building Interactive Worlds in 3D': The Donut Tutorial — Part 1

VFXWorld presents a new excerpt from Building Interactive Worlds in 3D by Jean-Marc Gauthier. This month's excerpt is a tutorial on setting up a camera inside an interactive racetrack.

All images from Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier. Reprinted with permission.

This is the latest in a series of excerpts from Building Interactive Worlds in 3D by Jean-Marc Gauthier.

Goal

The following tutorial is a step-by-step creation of an interactive race track inside a virtual donut. The tutorial shows how to model a race track inside the interior space of the donut and how to set up cameras racing on closed curve paths. The tutorial presents interactive functions for cameras on a path including changing direction, controlling speed, and field of view. Some sections of this tutorial can be bypassed in case you want to reach a specific level of functionality.

The LightWave and Virtools files for this tutorial can be found on the companion CD-ROM. A step-by-step tutorial on building a donut in Maya and setting up the path inside the donut in Virtools can be found on the CD-ROM under Interactive Paths > Tutorials > donut-maya.pdf.

Conceptual Design

This tutorial shows how to build the donut from scratch. The following summary will help you visualize the steps described in detail in the tutorial.

1. Modeling a donut-shaped ring. Although we use LightWave for this tutorial, donut shapes are available as 3D primitives with most 3D modeling applications. The tutorial also shows how to twist a donut to create a complex Moebius ribbon. Keep in mind that from a viewer's point of view, the environment and the obstacles encountered during the race may be more important than the shape of the race track.

View of a camera racing inside a textured donut. The red trail left behind the camera is a visual indication of the speed of the camera.

2. Texturing the donut. Textures placed inside the donut are part of the interactive experience. Attractive textures help to keep the viewer interested in the content for example, kinetic textures provide visual effects that can change when seen at various speeds. These textures will provide different sensations to the viewer when the camera accelerates and decelerates.

Textures placed inside the donut are part of the interactive experience.

3. Adding lights and cameras. After setting up a scene with lights and cameras in LightWave Layout, the tutorial shows how to add interactive functions and behaviors in Virtools. The following steps cover simple interactive behaviors for example, how to set up a follow camera on a ring and how to create an environment that can react to the camera.

4. Creating interactive textures.

5. Creating an interactive path.

6. Having one camera follow the path.

7. Controlling the camera's speed on the path.

8. Switching between the path camera and the free camera.

9. Adding an additional view to follow the racing cars on the circuit.

Top: Sketches exploring ideas for the ring and various sections of donuts. Bottom: 3D model of a donut.

10. Designing an interface with buttons to toggle between several cameras.

11. Controlling interactive textures according to the camera's speed.

12. Switching between paths.

13. Mounting cameras inside cars.

14. Creating car collisions with unpredictable moving objects.

15. Editing interactive paths.

Let's Start the Tutorial

Conceptual Design The phase of conceptual design helps to sketch simple ideas regardless of the technology or the process used to implement your ideas. The drawings on page 245 explore several segments of the rings and ways to model the circuit with various sections of tubes.

The tutorial will show you how to reuse a setup created for the simple donut for a more complex ring such as a triple Moebius ring. It is always easier to test behaviors on a donut and to later duplicate the same behavior inside a more complex model.

Modeling a Donut-Shaped Ring

In LightWave Modeler, create the donut shape, which is a 3D primitive that can be found under the menu's Create tab. Select Create > Superquadric to create a donut.

Although we use LightWave for this tutorial, donut shapes are available as 3D primitives with most 3D modeling applications.

Texturing the Donut

By selecting the donut in the Nurb mode, you can make the skin of the volume smooth and get a preview of the object similar to what you will get in the Gouraud mode used for realtime 3D in Virtools.

Select surfaces with names and colors that will receive textures for the race track. Please note that Virtools used for this tutorial assigns names to materials according to surface names created in LightWave and materials in 3ds Max. The look and feel of the circuit will depend on the type of projection cubic, planar, spherical or cylindrical chosen for the textures.

Please note that textures may be replaced in Virtools by another texture, by a video clip, or can be combined with another texture. Because we will add interactivity to existing textures to scroll images, to map video textures or to blend with other textures, interactive textures created in Virtools will use the same texture coordinates as the 3D software where they have been created. The original texture assigned to a surface in LightWave, Surface Editor, will be used as a default texture when imported in Virtools. The default texture will be altered or modified in Virtools.

Select surfaces with names and colors that will receive textures for the race track.

Various names and colors are assigned to surfaces all around the donut. In LightWave Modeler, select the surface by going to Details > Polygons, Surface. The selection process covers the inside and outside of the ring. After texturing, create a culling effect by flipping all the polygon normals.

The inside of the donut is now fully textured and the donut is transparent when seen from the outside.

Adding Lights and Cameras

In LightWave Layout, we add cameras and lights placed at interesting locations on the set.

In LightWave Layout, creating several cameras located inside the virtual set helps you to choose hot spots that will be available during the production process of your virtual set. Some of the cameras created inside the donut will later receive behaviors and will be active in Virtools.

The file is saved as an .nmo file, which is Virtools' 3D object format. Please make sure that the textures used for this project are also included in the Textures subfolder.

Drawing a Path

Let's create a path in Virtools. Select 3D Layout > Top View. Select the curve tool on the left of the screen. Click in the 3D Layout window to position four new points on each side of the donut with Closed Spline checked. Please note that you can edit a path by moving existing points or by inserting additional control points. Paths can be duplicated if you need to guide other 3D objects for example, lights, cameras and their targets.

gauthier08_pg_250a.jpggauthier09_pg_250b.jpg

The point of view from camera 1. Right: A top view of the donut showing camera 1 with rotation handles selected.
Point of view of camera 2 after adding red spotlights.

gauthier10_pg_251.jpggauthier11_pg_252a.jpg

Point of view of camera 3 after adding yellow, purple, green and blue spotlights. Please keep in mind that OpenGL only allows rendering eight lights in a single camera shot.
In LightWave Layout, a textured model with lights is ready to be exported to Virtools.

gauthier12_pg_252b.jpggauthier13_pg_253.jpg

The model of the donut is saved inside the 3D Entities subfolder of the Virtools resource folder.
Lets create a path in Virtools. Select 3D Layout > Top View. Select the curve tool on the left of the screen. Click in the 3D Layout window to position four new points on each side of the donut with Closed Spline checked.

Find more turnkey tutorials that detail all the steps required to build simulations and interactions in Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier: Focal Press, 2005. 422 pages with illustrations. ISBN 0-240-80622-0 ($49.95). Check back to VFXWorld frequently to read new excerpts.

Jean-Marc Gauthier teaches at New York University in the graduate studies department of Interactive Telecommunications and is the author of Interactive 3D Actors and Their Worlds (Morgan Kaufmann Publishers 2000). He is also a consultant at www.tinkering.net and an award-winning 3D artist.