Transcript
Page 1: Quest3D 3.0 Tutorial Manual_中文化

version 3

tutorial manual

Page 2: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

2

Copyright © 2005 by Act-3D™ B.V. All Rights Reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without the written permission from Act-3D B.V. This manual is designed to provide information about Quest3D. Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information is provided on an ‘as is’ basis. Act-3D B.V. shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information in this manual. All brand names and product names in this book are trademarks or service marks of their respective owners. Macromedia® ,Director® and Flash® are trademarks or registered trademarks of Macromedia, Inc. Photoshop® is a trademark or registered trademark of Adobe, Inc. Microsoft®, DirectX®, Windows®, Internet Explorer®, Excel®, PowerPoint®, and Visual Basic® are trademarks or registered trademarks of Microsoft corporation. 3D Studio MAX®, BiPed® and Physique® are trademarks or registered trademarks of Discreet inc. Maya®,is a trademark or registered trademark of Alias|Wavefront™. Lightwave 3D® is a trademark or registered trademark of Newtek inc. Quest3D™ and the Quest3D™ logo are trademarks or registered trademarks of Act-3D B.V. Act-3D™ and the Act-3D™ logo are trademarks or registered trademarks of Act-3D B.V. Published byAct-3D™ B.V. Cover images by Remko Jacobs. Text and images by Derk de Geus, Remko Jacobs, Ferry Marcellis, Dylan Nagel, Edward Niewold and Jeroen Visser. Special thanks to Ben Borrie, Loic de Montaignac, Dave Polcino, Morten Schönau Fog, Pjotr van Schothorst and Erwin Wolf. Cover notes: * Enterprise Edition ** VR Edition Character and car models are copyright of VSTEP. Assorted images in this manual are also copyright of VSTEP.

Page 3: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

3

Contents Part I: Getting started 5

1.1 Introduction.....................................................................................................7 1.2 How to use this manual .................................................................................8 1.3 Quest3D installation .....................................................................................10 1.4 Demonstation scenes ....................................................................................13 1.5 Quest3D User Interface ................................................................................14 1.6 Channels.........................................................................................................31 1.7 Program flow.................................................................................................49 1.8 Templates.......................................................................................................54 1.9 3D scenes........................................................................................................56 1.10 Publication .....................................................................................................61 1.11 Summary........................................................................................................68

Part II: The virtual studio 69 2.1 3D Objects ......................................................................................................70 2.2 Animation ......................................................................................................78 2.3 Object import.................................................................................................87 2.4 Surface properties .........................................................................................91 2.5 Lighting and shadows................................................................................106 2.6 Cameras........................................................................................................114 2.7 Graphic user interface ................................................................................120 2.8 Sound and music.........................................................................................125 2.9 Landscapes...................................................................................................130 2.10 Particle systems...........................................................................................138 2.11 Character animation ...................................................................................143

Part III: Programming 153 3.1 Logic .............................................................................................................154 3.2 Math..............................................................................................................164 3.3 For Loop.......................................................................................................175 3.4 Arrays ...........................................................................................................185 3.5 Multiple channel groups............................................................................196 3.6 Mathematical operators .............................................................................205 3.7 Pathfinding ..................................................................................................217 3.8 Finite state machine ....................................................................................224

Page 4: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

4

Part IV: Expert level 233 4.1 Project management ...................................................................................234 4.2 Physics simulation ......................................................................................238 4.3 Database connectivity.................................................................................250 4.4 Networking..................................................................................................260 4.5 Lua scripting................................................................................................267

Appendices 281

A1 Importing from Max and Maya ................................................................282 A2 User interface actions list ...........................................................................286 A3 Keyboard shortcuts.....................................................................................288

Page 5: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

5

Part I: Getting started What follows is a brief overview of the chapters in this part of the manual. Chapter 1.1: Introduction This chapter is a word of welcome to Quest3D. Chapter 1.2: How to use this manual This book is organised in a specific way. Its structure and format is explained here. Chapter 1.3: Quest3D installation The Quest3D program must be installed on a computer before it can be used. This chapter offers the details. Chapter 1.4: Example scenes The example scenes that come with the software package demonstrate a number of Quest3D features. Chapter 1.5: The Quest3D user interface This chapter is a guide to using the application. In addition, it introduces ‘channels’, the building blocks of Quest3D programs. Chapter 1.6: Channels Channels are at the heart of any Quest3D project. General properties are covered here. Chapter 1.7: Program flow Quest3D projects are executed in a specific way, and updated in real-time. This chapter explains more. Chapter 1.8: Templates Templates are predefined channels or groups of channels. A quick list of the functionality in Quest3D is given here. Chapter 1.9: 3D scenes Virtual scenes consist of a number of elements, such as 3D objects, a camera and lights.

Page 6: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

6

Chapter 1.10: Publication Projects made in the editor can be saved as stand-alone programs. Chapter 1.11: Summary This chapter reviews some of the topics covered in this first part of the manual.

Page 7: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

7

1.1 Introduction

In recent years, 3D computer graphics have taken the world by storm. Hollywood movies show off fully animated monsters and entire alien planets. Video games offer fantastic characters to play and vast interactive worlds to explore. Commercial and scientific presentations are often made in 3D. Even entire training programs can take place in a virtual reality. Though 3D computer graphics have reached a mainstream status, actually creating them still requires much effort. Only with proper, dedicated tools is it possible to produce convincing results in a timely manner. Quest3D is the perfect software package for creating interactive 3D scenes. Examples include product presentations, architectural visualisations, virtual trainings and computer games. Quest3D features a unique style of programming. Instead of having to write thousands of lines of complex code, developers make use of a large set of powerful building blocks. Both flexible and easy to use, Quest3D appeals to designers , programmers and artists alike. Working with Quest3D means developing in real-time: you are working directly on the end result. No time will be lost on compiling code or rendering images. Quest3D has a stunning set of graphics features. Large numbers of animated people, convincing vegetation, shadows, fire and smoke effects and realistic water can all be easily added to a scene. Advanced features include physics simulation, pathfinding routines, database connectivity and networking support. This book is your guide to Quest3D. It offers both theory and practical examples in the form of step by step tutorials. After reading this manual, you should be well on your way to creating almost any interactive 3D scene imaginable. Welcome to the wonderful world of Quest3D!

Page 8: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

8

1.2 How to use this manual

The following text describes the organisation of this manual. Parts This book is divided into four parts. • Part I, ‘Getting started’, is an introduction to Quest3D. • Part II, ‘The virtual studio’, discusses 3D objects and animation in great

detail. • Part III, ‘Programming’, takes a closer look at the heart of a Quest3D project –

the ‘code’. • Part IV, ‘Expert level’, deals with advanced features, some of which are only

available in certain editions of Quest3D. Chapters Chapter start with an introduction to a new subject. Next is a discussion of the various related Quest3D channels and functionality. Finally, a step by step tutorial is presented to give users a hands-on experience with the subject matter. Tutorials After Quest3D is installed, the completed scenes of every tutorial in this manual can be found on the harddisk of your computer. By default, they are located in the following directory: C:\Program Files\Act-3D\Quest3D 3.0\Tutorials\ Format The following formats have been used throughout this manual. • New concepts are printed in bold.

Example: Quest3D building blocks are called ‘channels’.

• Channels (single building blocks) already used in a Quest3D program are printed between single quotes, with capitals for every word.

Page 9: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

9

Example: Connect the ‘Logic’ channel to the ‘Start Scene’ channel.

• Channels and templates (building blocks) that are added from the Templates List to the program are printed in italics, with capitals for every word. Example: Add a Value channel to your program.

• The locations of channels and templates within the Templates List are

printed as folders seperated by a backslash. Example: Logic \ Channel Caller

• Options from the Application menu are printed as follows. Example: ‘File > Save Group As’

• Files and directories are printed in an Arial font. Example: C:\Program Files\Act-3D\Quest3D 3.0\

• Subfolders of the Quest3D directory are referred to as follows. Example: ..\Resources\Textures\

Reference Manual As a complementary source of help to this book, the Reference Manual contains descriptions of each of the various channels in Quest3D. It can be accessed by pressing the ‘F1’ key while running the program.

Page 10: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

10

1.3 Quest3D installation

The Quest3D program and tutorials must be installed on your computer before you can work with them. The following steps describe the installation process. Quest3D installation • Turn on your computer and wait for Windows to be ready. • Insert the Quest3D cd-rom into the cd-rom drive of your computer. • After a few moments, a window comes up asking if you want to install

Quest3D.

Page 11: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

11

If the window does not appear automatically: • On the Windows Desktop, double-click on the ‘My Computer’ icon.

• Double-click on the drive containing the cd-rom. • Double-click on the file ‘Autorun’ or ‘Autorun.exe’. • After a few moments, a window comes up asking if you want to install

Quest3D. Quest3D installation (continued) • Select the option, ‘Install Quest3D’. • Proceed with installation by pressing the ‘Next’ button. • The default installation directory is:

C:\Program Files\\Act-3D\Quest3D 3.0\

• It is recommended to accept the default installation directory. Confirm by clicking on the ‘Next’ button.

• It is recommended to create a shortcut to the Quest3D program on the desktop. Press ‘Next’ to proceed.

• Press ‘Install’. Quest3D will now be copied onto your computer. This may take a few moments.

• Press ‘Finish’ to complete the install. Quest3D relies on an extension of Microsoft Windows called ‘DirectX’. It contains advanced graphics and sound functionality. DirectX 9.0c or higher needs to be installed before Quest3D can be used. DirectX installation • From the Quest3D cd-rom installation menu, choose the ‘Install DirectX 9.0’

option. • Choose your operating system and language. • Confirm the installation by pressing ‘Yes’. • If you understand and accept the license agreement, press ‘Yes’. • DirectX will now be installed on your computer.

Page 12: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

12

Starting Quest3D • Press the Windows Start Button.

• From the Start Menu that comes up, choose: Programs > Act-3D > Quest3D 3.0 > Quest3D 3.0

• When asked, enter your Quest3D license key.

• The Quest3D splash screen comes up. Click on it to proceed to the program.

Page 13: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

13

1.4 Demonstation scenes

Before you start your training, please have a look at a number of finished scenes that come with the software package. They display a large number of Quest3D features. To view the demonstration scenes: • Insert the Quest3D cd-rom into the cd-rom drive of your computer.

After a few moments, a viewer window comes up.

If the viewer window does not appear automatically: • On the Windows Desktop, double-click on the ‘My Computer’ icon. • Double-click on the drive containing the cd-rom. • Double-click on the file ‘Autorun’ or ‘Autorun.exe’.

After a few moments, a viewer window comes up. While examining the demonstrations, try to determine which elements are used, and which of those you want to have in your project. This manual helps you to create scenes like these demonstrations, and more.

Page 14: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

14

1.5 Quest3D User Interface

Quest3D offers a large set of powerful features. The program is divided into a number of ‘Sections’ to keep everything as organised as possible. The three most important parts of Quest3D are listed below.

The Channels Section is the heart of Quest3D. Quest3D shows the Channels Section on start-up. In the Channels Section you will build the foundation of all projects you create.

The Animation Section is where 3D objects, camera’s and lights are positioned and animated. It contains a large preview window perfect for testing projects.

The Object Section is where 3D objects are prepared and pollished. Quest3D provides a wide range of options to tweak object surface properties such as color and texture.

Page 15: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

15

Note that it is possible to change the basic interface. Therefore, from user to user Quest3D might look different. In this manual we will assume the standard interface is used. For more information, please check the ‘Customization’ chapter in the Reference Manual. This chapter only discusses the Channels Section. The Animation and Object Sections are discussed in Part II: ‘The virtual studio’ of this manual. File menu The File menu provides options for loading and saving projects. In addition, it offers options for importing 3D objects from other programs, and publishing Quest3D projects. The latter will be discussed in later chapters.

The ‘New Project’ option will clear all previously loaded channel groups and start a new workspace. During some of the coming tutorials you might want to clear the project using this option. It is similar to quitting and restarting Quest3D. ‘Open Project’ allows you to load a single Channel Group or project file with a different interface for Quest3D. Saving a single Channel Group to a new file is done with ‘Save Group As’. To overwrite your current file, ‘Save Group’ is used. Using the ‘Save All’ option makes sure the entire project is stored. Note that for new users ‘Save All’ is the safest method to save a project.

Page 16: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

16

Section navigation The different sections of Quest3D can be reached in a number of ways. Common methods are using the Application menu or the Section selection buttons on the Toolbar.

Interface elements in several Sections Certain windows and buttons can be found in several different Sections throughout the Quest3D program. For example, the Channel Section layout includes an Animation 3D View window.

This is the same (type of) window as in the Animation Section. The Animation 3D View window shows a ‘real-time’ preview of a project. Changes and additions to a program made in the Channel Graph will be immediately displayed in the Animation 3D View window.

Page 17: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

17

Tab windows Quest3D has many windows that use Tab controls to switch between them. The most important of these in the Channels Section are the ‘Template list’, the ‘Channel list’ and the ‘Search window’.

These windows can be accessed by clicking on the appropriate Tab name. Log Bar The Log Bar is located at the bottom of the Quest3D program screen.

This bar notifies users of general information and specific issues. The history of all notifications since the program was started can be viewed by pressing the ‘Log’ button.

Page 18: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

18

Channel Graph The Channel Graph is the window where the channel structures are build. Quest3D programs are made with building blocks. These building blocks are called ‘channels’. Below is a picture of a channel in Quest3D.

Quest3D building blocks ‘channel’ information or functionality to other building blocks. Hence the name ‘channel’. Channel Group The image below shows an example of a small group of channels. A structure of channels is called a Channel Group.

The image above also displays an example of user comments (the text ‘Hello world example’). In addition, certain building blocks have been hidden inside folders.

Page 19: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

19

Adding channels to a program The Templates List on the left side of the screen contains all available Quest3D building blocks.

New channels can be added to your program by dragging a name from the Templates List onto the Channel Graph. ‘Dragging’ means pressing and holding down the left mouse button, moving the mouse cursor to a new position, and releasing the left mouse button.

Page 20: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

20

After the mouse button is released, the channel is added onto the Channel Graph.

Page 21: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

21

Templates A Template is a predefined channel or group of channels. Using templates can greatly speed up your workflow. Templates can be added just like single channels. In the example below, a Vector template is added onto the Channel Graph. A Vector template consists of four channels.

Page 22: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

22

Standard user actionsMuch of the Quest3D user interface works like other Windows software packages. The following lists describe a number of important actions in Quest3D. These terms are used throughout this manual. Move the mouse cursor to a specific position

Move the mouse to move the on-screen cursor to a specific position on the screen

Click Press the left mouse button and release Double-click Press the left mouse button, quickly

release and quickly press again, and release

Drag the mouse Press and hold down the left mouse button, do not release, and move the mouse around

Drag from a to b Press and hold down the left mouse button, do not release, and move the on-screen cursor to a specific position on the screen

Select an item Press the left mouse button while the on-screen cursor is over an item and release

Page 23: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

23

Tutor ia l

The folowing tutorial is an introduction to the Quest3D user interface. It also takes a closer look at channels (building blocks). The goal of this tutorial is to familiarise yourself with the basics of the Quest3D user interface. Starting Quest3D: • Press the Windows Start Button.

• From the Start Menu that comes up, choose the following options: Programs > Act-3D > Quest3D 3.0 > Quest3D 3.0

• The Quest3D splash screen comes up first. Click on it to proceed to the program.

Step by step: • Examine the screen. By default, Quest3D opens with one of the Channel

Sections. The Channels Section is where the actual program is created, using building blocks called ‘channels’.

• From the Applications Menu, choose ‘Sections > Animation’ to switch to the Animation Section.

• Switch to one of the other Sections by choosing it from the Application Menu.

• Switch to one of the other Sections by pressing the appropriate button on the Toolbar.

• Go to the Object Section.

Page 24: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

24

• Go to the ‘Surface’ tab by pressing the appropriate name.

• Go back to the ‘Material tab’. • Go to the Big Channel Section. • Examine the screen. The largest area on the screen, with the light blue

background, is called the ‘Channel Graph’. It contains all channels that make up your program. At the moment, there is only one channel named ‘Project Start’.

• Place the mouse cursor over the Channel Graph. Zoom in and out by

scrolling the mouse scroll wheel up and down. If your mouse has only two buttons: hold down the ‘Alt’ key on your keyboard, press and hold down the right mouse button, and move the mouse up and down to zoom in and out.

Zoom in on the Channel Graph to get a closer view of the channels in a project.

Page 25: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

25

Zoom out for an overview of the channels in a project. • Place the mouse cursor over the Channel Graph. Press and hold down the

middle mouse button and move the mouse to move the view of the Channel Graph. If your mouse has only two buttons: use ‘Alt + Left Mouse’ to move the view.

• Look at the Templates List on the left hand side of the screen. It contains all

sorts of channels and combinations of channels with a wide range of functionality.

• Click on the ‘+’ sign next to the word ‘Logic’. Note the structure expands to reveal a number of items.

• Move the mouse cursor over the word ‘Channel Caller’. (A Channel Caller channel is used to create the logic path of your project. For example a Channel Caller named ‘Project Start’ might call another channel named ‘Render Scene’ and another named ‘Do User Logic’).

Page 26: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

26

• Click and hold the left mouse button, and move the mouse cursor to the center of the screen, below the ‘Project Start’ channel.

• Release the left mouse button. You have just dragged a channel onto the Channel Graph.

Page 27: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

27

• Click on the ‘Project Start’ channel to select it. Note the red selection outline.

• Click anywhere on the blue background to deselect the ‘Project Start’ channel. Note the red selection outline disappears.

• Position the mouse cursor over the ‘Project Start’ channel. To move the channel, press and hold down the left mouse button and move the mouse.

Page 28: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

28

• When at a new position, release the left mouse button. Note the channel is moved.

• To select multiple channels at once, create a selection box around them. Starting at the top left corner in the Channel Graph, press and hold the left mouse button. Drag the mouse to below and to the right of the channels you want to select. Release the mouse button.

In the image above, the left mouse button is pressed at position ‘1’. The mouse is then moved to position ‘2’, creating the selection box and selecting

Page 29: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

29

all channels inside this box. Selected channels can be recognised by a red outline.

• To move multiple channels at once, first make a multi-selection. Next, move the mouse over any of the selected channels. Press and hold down the left mouse button and move the mouse.

After releasing the mouse at a new position all selected channels are moved, relative to the new position and relative to each other.

• Select the ‘Channel Caller’ channel and press the spacebar on your keyboard.

The channel is stored in a Folder.

Page 30: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

30

Folders are named after the channel the mouse cursor is over when creating the Folder. • Select the Folder and press the spacebar again to ungroup the Folder. • Select the ‘Channel Caller’ channel and press the ‘Delete’ key on your

keyboard to delete it.

Page 31: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

31

1.6 Channels

Quest3D programs are made with building blocks. These building blocks are called channels. Each channel has a specific function. In Quest3D, channels are rectangular blocks. The channel in the image below is called a Value channel. It can store a number.

The small black squares above and beneath a channel are called link squares. Channels can be connected to each other by lines between top and bottom link squares.

In the image above, the upper channel is called the Parent. The lower channel is called the Child. Children are often used as input or output data for Parents.

Page 32: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

32

An input link square without a Child connected to it receives no input data. Often, empty input link squares are set to 0. Channel Groups A structure of connected channels is called a Channel Group. A Quest3D project consists of one or more Channel Groups. For example, one group might display a room on screen while another group might show a character. The two Channel Groups may be combined to display a character in a room. Channel information Information on a channel can be viewed by moving the mouse over it. After a few moments, a pop-up window appears.

The channel in the image above is named ‘My Value’. In addition to a name, every channel has a Basetype and a Type. A Value channel is of Basetype Value but also of Type Value. The name of the channel in the image below is ‘Clear Screen’.

Page 33: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

33

This channel is used to change the background color of a project. Colors in a computer program often consist of a red, green and blue component. Therefore, colors are often stored as a set of RGB values. The Clear Screen channel accepts three childen of type Value: one for the each of the RGB color components. Link square information can be viewed in a similar way as channel information. The pop-up window displays a link square’s name and Basetype. The first link square of the ‘Clear Screen’ channel in the image below is called ‘R’. It represents the red component of the channel’s color.

The information window also shows that this first link square only accepts channels of Basetype Value. Therefore, the channel called ‘My Value’ is accepted as a child. In the image below, the ‘My Value’ channel has a value of 0. The

Page 34: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

34

second and third link squares of the ‘Clear Screen’ channel are empty, and therefore also 0. The color of the ‘Clear Screen’ channel is (0, 0, 0), which is black.

Note that the grid is only visible in the Quest3D editor itself, not in stand-alone programs. The grid is a Quest3D Helper item. The image below shows the result of the ‘My Value’ channel with a value of 0.5. The background is colored dark red.

Page 35: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

35

User input The image below displays the information for a channel called ‘My Spacebar Value’.

This channel is again of Basetype Value. However, its Type is User Input. A User Input channel can convert many different types of user activity like keyboard, mouse and joystick input to a value. Since the ‘My Spacebar Value’ channel is of Basetype Value, it is also accepted as child by the Clear Screen channel.

In the images above and below, the ‘Clear Screen’ channel changes color from black to red based on user input. When the spacebar is pressed, the background color changes to bright red.

Page 36: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

36

Multi-link squares The image below shows four different channels: two Channel Callers, a Value and a Clear Screen channel.

Page 37: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

37

Different channels can have different numbers and Types of link squares. For example, the Clear Screen channel accepts three children and the Value channel accepts one child. A ‘+’ symbol inside a yellow link square indicates multiple children can be linked to a channel. Once a child is linked, the ‘+’ symbol will move to the right, creating a new spot for another child. Linking Moving the mouse over the top link square of the ‘Channnel caller’ channel makes the link orange.

In the image below, a linking action is started from the ‘Channel Caller’ channel to another channel by pressing and holding down the left mouse button.

Page 38: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

38

During a linking action, all link squares change color to either red or green. Connections can be made to green link squares, but not to red ones. In the image above, a link is started from a channel of Type Channel Caller (it also has the name ‘Channel Caller’). The ‘Project start’ channel (of Type Channel Caller as well) accepts this link as can be seen by the green link square. Channels of Types Clear Screen and Value only accept Values. Therefore, their link squares are red.

Page 39: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

39

Releasing the left mouse button on a link square will create the link, if the link is valid.

Instead of moving the link on the target link square you can also release it over the channel itself. Quest3D will attempt to link the channel to one of the open and valid link squares of the target channel. Quick linking: 1. Select the child. 2. Hold down the ‘L’ key on the keyboard. 3. Click on the parent. Deleting links Moving the mouse over the arrow of the link between the channels and pressing the ‘left mouse’ button you can select the link. You are now able to delete the link by pressing the ‘Delete’ key on your keyboard.

Page 40: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

40

If a link is deleted from a channel that creates new ‘link squares’ an ‘empty’ link square is left behind. This link square has the blue color. Channels will ignore these empty spaces. If you link a new child to a channel with a blue ‘link square’ the ‘empty’ position will be filled first.

Page 41: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

41

Channel Properties window Double clicking a channel will bring up the Channel Properties window specific to that channel. The image below shows the properties or dialog window that belongs to the Value channel.

In its properties window you can enter a new value. Note that the Quest3D program does not pause when opening a dialog. You can change values while your program is running and instantly see the result. Context Menu Right clicking on a channel will bring up its Context Menu.

Page 42: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

42

The name of a channel can be changed through the ‘General Properties’ command. Selecting the ‘Channel Properties’ option results in the same window as double clicking a channel.

Page 43: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

43

Shortcuts Channel shortcuts work in the same manner as Windows shortcuts to programs or folders. In Quest3D only shortcuts to channels can be made, not to folders. Channels shortcuts can be created through a channel’s Context Menu. Shortcuts can also be made by right clicking on the ‘arrow’ of a link between two channels. A menu with a single option appears.

The image on the right shows the result of the operation. Shortcuts are references to the original channel. Their only purpose is to keep Channel Groups more readable. Use folders and shortcuts to keep your project clean and tidy.

Page 44: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

44

Tutor ia l

The following exercise deals with channel properties. After completing it, you should be able to find and understand Types and Basetypes, of both channels and link squares. Step by step: • Start Quest3D. By default, Quest3D opens with the Channels Section. • Drag the following channel from the Template List onto the Channel Graph.

System \ Clear Screen

• Add the following channel. Variables \ Value \ Value

Page 45: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

45

• Move the mouse cursor over the ‘Value’ channel and wait for the pop-up window with information to appear.

• Move the mouse cursor over the small black square on top of the ‘Value’

channel. Note the black square turns orange. • Click and hold down the left mouse button, and move the mouse cursor over

the center of the ‘Clear Screen’ channel. Do not release the mouse button yet. Note a black line is drawn from the top of the ‘Value’ channel to the current position of the mouse cursor.

• Release the left mouse button. Note a black line is drawn from the top of the ‘Value’ channel to the bottom of the ‘Clear Screen’ channel. The two channels are now connected.

Page 46: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

46

• Move the mouse over the ‘Clear Screen’ channel and right click to bring up

its Context Menu. Select the ‘Set as start channel’ option.

The image on the right shows the large arrow symbol on top of the ‘Clear Screen’ channel. It indicates the channel is the start channel.

Page 47: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

47

• Make sure the Animation 3D View window is visible by pressing the ‘Animation 3D View’ tab in the lower left hand corner of the screen.

• Double click on the ‘Value’ channel to open its properties window.

• Type in a new value from 0 to 1.0 in the edit box. Note that changing the

value in the dialog window affects the background color in the Animation 3D View window.

• Press the ‘OK’ button to accept and close the dialog window. • From the Applications Menu, choose the ‘File’ option and then the ‘Save

Group As…’ option.

• Find an appropriate location to store your project files, for example the

following directory: C:\Program Files\Act-3D\Quest3D 3.0\Projects\

Page 48: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

48

• Type in a name, for example ‘Introduction to channels’.

• Press the ‘Save’ button to accept.

An example of what your program should look like is available in the Quest3D program folder. Its directory and name is listed below. As noted in Chapter 1.2, ‘How to use this book’, ‘..\’ is an abbreviation of the following folder: C:\Program Files\Act-3D\Quest3D 3.0\ • To load a Quest3D project, from the Applications Menu, choose the ‘File’

option and then the ‘Open Project...’ option. • Locate the directory given below under ‘Finished scene’. The complete path

is: C:\Program Files\Act-3D\Quest3D 3.0\Tutorials\1.6 –Channels\

• Open the file ‘Channels – Complete.cgr’. • Analyse the finished scene and see if you understood this tutorial. Finished scene: • ..\Tutorials\1.6 –Channels\Channels – Complete.cgr

Page 49: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

49

1.7 Program flow

A Quest3D program begins with a Start Channel. A Start Channel is marked by a large arrow pointing down.

The ‘Set as start channel’ option in a channel’s Context Menu can be used to define the beginning of a Quest3D program. In the image below, the ‘Channel Caller’ channel is the Start Channel and has two children linked to it.

Channel Callers are the foundation for the workflow of your project.

Page 50: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

50

Project activity A Quest3D project is only actively executed when the Animation 3D View window is open.

In the image above, the Start Channel is actively executed, as can be seen by the blue lines around the channel. The image below shows a small Quest3D scene. On the left hand side, the channel structure is visible. On the right hand side is a preview of the scene in the Animation 3D View window.

Page 51: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

51

Frames Quest3D works in real-time. This means it constantly executes a project completely and updates the preview. One complete cycle through the channel structure is called a frame. Calculating all end result is referred to as rendering. The framerate defines how many times per second a program is executed. Framerates depend on the complexity of a project and the computer hardware used to render a scene. Program flow Calling a channel in Quest3D means carrying out all of its functionality once, based on any input it may receive from its children. The exact results of calling a channel depends on its Type. A Channel Caller calls its children in a left to right order. In the image below, the ‘Caller 1’ channel is called first, displaying a box object on screen. Next, the ‘Caller 2’ channel is called, rendering a fire object.

Page 52: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

52

In the image below the flow of the Channel Group is visible.

1. The start of each frame. 2. Channel Callers work from left to right, therefore the Start Channel calls the

left channel called ‘Caller 1’ first. 3. The ‘Caller 1’ channel calls the hierarchy beneath it. This hierarchy starts

with a channel of the type ‘3D Object’ named ‘Box Object’. This channel display a box on screen, visible in image above on the right hand side.

4. After executing the hierarchy on the left hand side, the Start Channel continues with its second child, ‘Caller 2’.

5. The ‘Caller 2’ channel calls its child ‘Fire Object’. This channel and its children create the fire object seen in the image above.

When the structure is completely executed, the program begins anew with the Start Channel.

Page 53: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

53

Tutor ia l

The following exercise illustrates the flow of a Quest3D program. Needed Quest3D scene: • ..\Tutorials\1.7 – Program flow\Program flow.cgr Step by step: • Start Quest3D. • Open the scene ‘Program flow.cgr’. It can be found in the location specified

above. The file contains a simple scene with a box and a fire object. • Make sure the Animation 3D View window is active by pressing the

appropriate tab in the lower left corner of the screen. • Examine the scene in the Animation 3D View window. Note the box and the

fire object are both rendered. • Right click on the ‘Caller 1’ channel and from its Context Menu, select the

‘Set as start channel’ option. • Examine the scene in the Animation 3D View window. Note only the fire

object is visible. • Right click on the ‘Caller 2’ channel and from its Context Menu, select the

‘Set as start channel’ option. • Examine the scene in the Animation 3D View window. Note only the box

object is visible. Finished scene: • ..\Tutorials\1.7 – Program flow\Program flow – Complete.cgr

Page 54: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

54

1.8 Templates

A template is a predefined channel or group of channels designed to speed up the workflow. Templates can immediately be used in a scene. A benefit of working with templates is that you don’t have to understand each of the components right away. Later on, when you are more familiar with Quest3D, you can take a better look at all the various templates. You can even build your own. Below is a quick list of the categories of templates that come with Quest3D. It is intended to give you an impression of the scope of the entire set. The rest of this manual discusses many of these templates and their functionality in greater detail. Category Description Example templates Scene 3D stage setup Render

Camera Light

Objects 3D objects, surfaces and special effects Primitive Object Texture Particle System Pixel Shader Vertex Shader

Logic Conditions and triggers in a program Channel Caller If Trigger Channel Switch User Input Finite State Machine Motionplanning

Variables Data containers and operators Value Vector Matrix Text Expression Value

Page 55: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

55

Category Description Example templates Animation Timers, regular and character animation Timer Value

Timer Command Motionset

Sound Sound and music Wav File Mp3 File Sound Command

Physics Physics simulation (based on Open Dynamics Engine)

ODE Body ODE Joint ODE Command

Network Connecting multiple computers Network Value Network Text Network Actions

Database Connecting to a database DB Source DB Query DB Value

Dynamic Loading

Dynamic loading of parts of a program Save Channel to Buffer Array Buffer Remove Group

Windows Pop-up windows Message Box File Dialog Open URL

Viewers Project viewers ActiveX Event WinAmp Waveform

System System information and commands System Info System Command

VR Virtual reality support Glove

Page 56: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

56

1.9 3D scenes

All Quest3D programs share the same basic principles. This chapter is an introduction to creating a project in Quest3D. Quest3D scenes 3D objects play an important part in most Quest3D programs. 3D objects can be imported from your favorite 3D modeling package. It is also possible to use one of the 3D objects that comes with Quest3D. Just like a movieset, a Quest3D scene needs a camera and one or more lights. The Render channel is used to display 3D objects on the screen. The Start 3D Scene channel is used to initialise the 3D environment. It handles, amongst other things, screen resolution and background color. The Start 3D Scene, Render, Camera, 3D Object and Light channels are combined in the following channel structure.

Page 57: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

57

Tutor ia l

In this tutorial you will create a simple Quest3D program. The result will be a scene with a 3D object, a camera and a light. In this introductory chapter, you will make use of templates. Templates are predefined channels or groups of channels designed to speed up your workflow. The templates used in this tutorial are listed below under ‘Needed templates’. The first goal of this tutorial is to familiarise yourself with the basic structure of Quest3D programs. The second goal is to gain more experience with adding channels to a program and connecting them to each other. Needed templates: • Scene \ Start 3D Scene • Scene \ Rendering \ Render • Scene \ Cameras \ Object Inspection Camera • Objects \ Primitive Object • Scene \ Lights \ Point Light Step by step: • Start Quest3D. • Create a new scene by choosing ‘File > New Project...’ from the Application

menu. Name it ‘First project scene’. • In the Template List, find the Start 3D Scene template. Its location is given

above, in the ‘Needed templates’ list: 3D Items \ Start 3D Scene Click the ‘+’ sign in front of the word ‘3D Items’ in the Templates List. The ‘3D Items’ subfolder is expanded. One of the templates listed is the Start 3D Scene channel. Drag a Start 3D Scene channel onto the Channel Graph.

Page 58: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

58

• Right click on the ‘Start 3D Scene’ channel and from the menu, choose ‘Set as

start channel’. • Find the Render channel in the Templates List. It’s location is given in the

‘Needed Templates’ list above. • Drag a Render channel onto the Channel Graph, just below the ‘Start 3D

Scene’ channel. • Link the top link square of the ‘Render’ channel to the child link square of the

‘Start 3D Scene’ channel.

Page 59: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

59

• Drag an Object Inspection Camera template onto the Channel Graph. • Connect the ‘Object Inspection Camera’ channel to the first child link square

of the ‘Render’ channel. • Make sure the Animation 3D View window in the lower-left corner of the

screen displays your scene using the Project Camera. The Project Camera

icon is located on the Toolbar. • Add a Primitive Object template and connect the ‘3D Object’ channel to the

second child link of the ‘Render’ channel. Note the 3D object is displayed in the Animation 3D View window.

• Drag a Point Light template onto the Channel Graph. Connect the ‘Scene Light’ channel to the last child link of the ‘Render’ channel. Note how the car is affected by this lightsource.

Page 60: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

60

• Your current channel structure should look similar to the one in the image below.

• From the Applications menu, choose ‘File > Save Group As...’. • Locate the following folder:

C:\Program Files\Act-3D\Quest3D 3.0\Projects\

• As name, type in ‘3D scenes’. • Press the ‘Save’ button to accept. Finished scene: • ..\Tutorials\1.9 –3D scenes\3D scenes – Complete.cgr

Page 61: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

61

1.10 Publication

At a certain point, a Quest3D project may be finished and ready for distribution. Whether it is a modest free screensaver or an extensive commercial training application, the Quest3D program must be exported out of the editor and saved into a format the target audience can run. Depending on the Quest3D license you work with, a number of publishing options are available. Can publish to type Lite

Professional Enterprise

VR .q3d player file Yes Yes Web application Yes Yes Screensaver Yes Yes WinAmp plug-in Yes Yes Stand-alone self-running .exe No Yes Installer file No Yes Published projects using the Lite Edition will display an extra Quest3D splash screen on start-up. All Quest3D programs require DirectX 9.0 or higher to be installed on a target computer. DirectX is a free extension pack for Microsoft Windows and can be downloaded from their site: http://www.microsoft.com/directx/download/ [~10 MB] Viewer files: .q3d Quest3D projects can be published to Viewer files with extension ‘.q3d’. Quest3D programs published in this manner can be run using the Quest3D Viewer by simply starting the ‘.q3d’ file itself.

Page 62: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

62

The Quest3D Viewer Package must be installed on a target computer in order to run .q3d project files. The Quest3D Viewer Package may be downloaded freely from the following location: http://www.quest3d.com [~1.6 MB] Internet ActiveX: .q3d and .htm Files of type ‘.q3d’ can also be viewed in an internet browser that supports ActiveX. The ‘.q3d’ file must be linked from a regular webpage to show. Web pages containing Quest3D media elements will automatically try to download and install the Quest3D Viewer Package from the Quest3D.com website. The user may cancel this operation. Stand-alone programs: .exe A Quest3D project can also be published to a stand-alone self-executing ‘.exe’ file. Besides DirectX, this type of publication requires no additional components. Installation files: .exe Installers are ‘.exe’ archive files that copy and expand a program to a specified directory on a harddisk. License fees Regardless of the Quest3D license you work with, no additional fees will ever be charged by the developers, Act-3D. After expenses for the Quest3D software package itself, there are no extra costs.

Page 63: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

63

Tutor ia l

The following tutorial is aimed at familiarising you with the various types of publication. In order, the ‘.q3d’ project file, the stand-alone ‘.exe’ program, the installer and the web application are discussed. Needed Quest3D scene: • ..\Tutorials\1.10 – Publication\Publication.cgr Step by step: • Open the scene ‘Publication.cgr’. It contains a compact production

visualisation scene. • From the Applications Menu, select ‘File > Publish...’. The ‘Project

Publishing’ window appears.

• Type in ‘Product Visualisation’ in the ‘Title’ box. • Click on the ‘Browse’ button to define a directory and name to save the

published file to. • Locate the ‘..\Tutorials\2.9 – Publication\’ folder.

Page 64: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

64

• Type in ‘Product_Visualisation’ in the ‘File name’ box and press ‘Save’ to confirm.

• From the ‘Publish type’ drop-down list, choose ‘Project File (viewer and web-plugin)’.

• Tick the box ‘Save current project before publishing’ if it isn’t selected yet. • In the ‘Project folder content’ window, make sure the box for

‘Publication.cgr’ is selected. • Press the ‘Publish’ button. • Quest3D asks you if you want to save all channel groups. Press ‘Yes’ to

confirm. The .exe version of your program is saved into your project directory. A progress bar appears, and disappears when the publication process is done.

• Minimize the Quest3D editor program by pressing the minimize icon in

the top right corner of the screen. • On the Windows Desktop, double-click on the ‘My Computer’ icon.

• Locate the following folder: C:\Program Files\Act-3D\Quest3D 3.0\Tutorials\2.9 – Publication\

• Locate the file ‘Product_Visualisation.q3d’ in and double click it. The scene

will load and be run using the Quest3D Project Viewer. • Test the scene by holding down the right mouse button and dragging the

mouse to orbit around the 3D object. • When ready, press the ‘Escape’ key to exit the application. Note that both the Quest3D Project Viewer and DirectX 9.0 or higher must be installed on a computer in order to run ‘.q3d’ files. • Return to the Quest3D editor program. • The ‘Project Publishing’ window should still be open. If it is not, from the

Applications Menu choose ‘File > Publish’. • From the ‘Publish type’ drop-down list, choose ‘Executable (Standalone,

Installer, Screensaver, WinAmp)’.

Page 65: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

65

• Press the ‘Options’ button. • Select ‘Self executing project (click and run) and press ‘OK’ to confirm. • Press the ‘Publish’ button. The scene is saved to the same directory as before. • Locate the file ‘Product_Visualisation.exe’ in the directory

‘..\Tutorials\Publication\’ and double click it. The scene will load as stand-alone application.

• Test the scene by holding down the right mouse button and dragging the mouse to orbit around the 3D object.

• When ready, press the ‘Escape’ key to exit the application. Note that the Quest3D Project Viewer is not needed to run stand-alone ‘.exe’ files created with Quest3D. However, DirectX 9.0 or higher must still be installed. • Return to the Quest3D editor program. • The ‘Project Publishing’ window should still be open. If it is not, from the

Applications Menu choose ‘File > Publish’. • Press the ‘Options’ button. • In the ‘Executable Options’ window, select ‘Project Installer (added to start

menu)’. • Change the ‘Default installation folder’ to ‘C:\Program Files\Product

Visualisation’. • Change the ‘Start-menu path (folder / title)’ to ‘Quest3D Product

Visualisation\Product Visualisation’. • Tick the box ‘Run project after installation is completed’ if it isn’t selected

already. • Press ‘OK’ to confirm. • Click on the ‘Browse’ button. • Change the ‘File name’ to ‘Product_Visualisation_Installer’ and press ‘Save’

to confirm. • Press ‘Publish’. The scene is saved to the same directory as before. • Locate the file ‘Product_Visualisation_Installer.exe’ in the directory

‘..\Tutorials\Publication\’ and double click it. • Follow the on-screen instructions to install the application on your computer.

When done, the scene will run automatically. • Test the scene. • When ready, press the ‘Escape’ key to exit the application. • Run the program again: from the Windows Start Menu, choose ‘Programs >

Quest3D Product Visualisation > Product Visualisation’. The application will run.

Page 66: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

66

• Test the scene. • When ready, press the ‘Escape’ key to exit the application. • Return to the Quest3D editor program. • The ‘Project Publishing’ window should still be open. If it is not, from the

Applications Menu choose ‘File > Publish’. • From the ‘Publish type’ drop-down list, choose ‘Project File (viewer and web-

plugin)’. • Press the ‘Options’ button. • Tick the ‘Create HTML file’ box if it isn’t selected already. • Change the ‘Title’ to ‘Product Visualisation’. • Change the ‘Filename’ to ‘index.htm’. • Press ‘OK’ to confirm. • Click on the ‘Browse’ button. • Change the ‘File name’ to ‘Product_Visualisation’ and press ‘Save’ to

confirm. • Press ‘Publish’. The scene is saved to the same directory as before. • Locate the file ‘index.htm’ in the directory ‘..\Tutorials\Publication\’ and

double click it. A webpage is opened in the standard internet browser. The application is embedded in the webpage.

Note that the Quest3D Browser Plug-in and DirectX 9.0 or higher must be installed on a computer in order to run Quest3D web page applications. If the Browser Plug-in is not yet installed, the webpage will automatically try to download and install it. The user may cancel this operation.

Page 67: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

67

Also note that the actual application is a ‘.q3d’ file. Both the ‘.htm’ and the ‘.q3d’ file must be uploaded to an ftp server before others can view the web page application on the internet. Finished scenes: • ..\Tutorials\1.10 – Publication\Product Visualisation.q3d • ..\Tutorials\1.10 – Publication\Product Visualisation.exe • ..\Tutorials\1.10 – Publication\Product Visualisation.scr • ..\Tutorials\1.10 – Publication\index.htm

Page 68: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

68

1.11 Summary

This first part of the manual was an introduction to the basic concepts of Quest3D. Below some of the key points of this section are listed. • The first step in creating convincing 3D scenes, and keeping your project

managable, is being able to describe what you actually want to build. Quest3D helps you to visualise your ideas.

• Quest3D programs are made with building blocks. These building blocks are

called ‘channels’. Each channel has a specific function. • The small black squares above and beneath a channel are called ‘link

squares’. Channels can be connected to each other by lines between top and bottom link squares.

• The large area with the light blue background is called the ‘Channel Graph’.

The Channel Graph shows the channels used in a Quest3D program. • New channels can be added to a program by dragging a name from the

Templates List on the left side of the screen onto the Channel Graph. • A ‘Template’ is a predefined channel or group of channels designed to speed

up the workflow. • All Quest3D programs share the same basic principles. 3D objects play an

important part in most Quest3D programs. Just like a movieset, a Quest3D scene needs a camera and one or more lights.

• User input can be registered through for example keyboard, mouse, joystick,

drawing tablet and pen, and virtual reality gear. • Publishing a Quest3D project means taking it out of the editor and creating a

seperate, stand-alone program.

Page 69: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

69

Part II: The virtual studio What follows is a brief overview of the chapters in this part of the manual. Chapter 2.1: 3D Objects 3D Objects are at the heart of virtual scenes. Chapter 2.2: Animation Whether over time or based on other input, animation means change. Chapter 2.3: Object import Objects created in other software packages can be imported and used. Chapter 2.4: Surface properties Color, texture and transparency all define the looks of a 3D object. Chapter 2.5: Lighting and shadows Lighting is essential to creating a convincing scene. This chapter has the details. Chapter 2.6: Cameras The point of view plays an important role when it comes to user experience. Chapter 2.7: Graphic user interface Buttons, and sliders let the user interact with a program. Chapter 2.8: Sound and music Templates are predefined channels or groups of channels. A quick list of the functionality in Quest3D is given here. Chapter 2.9: Landscapes Virtual scenes consist of a number of elements, such as 3D objects, a camera and lights. Chapter 2.10: Particle systems Projects made in the editor can be saved as stand-alone programs. Chapter 2.11: Character animation This chapter reviews some of the topics covered in this first part of the manual.

Page 70: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

70

2.1 3D Objects

3D scenes on the computer consist of virtual objects. The appearance of these objects is defined by a number of elements. The following image shows a cube object.

A ‘vertex’ is a single point in 3D space. Vertices are defined by an X, Y and Z coordinate. The image below shows the vertices of a box object.

Simple models such as a box are made up of only a few vertices (or corners), while complex objects such as cars, buildings and characters can consist of many thousands of such points.

Page 71: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

71

‘Surfaces’ are built out of ‘polygons’. A polygon can have any number of vertices, though in real-time graphics, they usually appear in the form of ‘tri’s’ and ‘quads’ (3 and 4 vertices, respectively). Quest3D polygons consist of up to 3 vertices. The image below shows a cube object divided into three-sided polygons.

Textures Individual polygons can be assigned a color, but often, another means to add detail is chosen. A ‘texture’ is an image that can be wrapped around a 3D shape. An example is given below.

Page 72: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

72

In real-time graphics, textures are most often used to define color and transparency. In the image below, the texture is wrapped around a sphere object and defines its color.

The following image shows an example of a transparency texture. Transparency is defined by a grayscale image from black (completely transparent) to white (completely visible).

Applying the alpha texture above to the sphere object results in the image on the right.

Page 73: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

73

Objects in Quest3D 3D objects in Quest3D are split into two large parts: motion and surface.

Linked to the ‘Motion’ channel are three Vectors. They describe the object’s position, rotation and size, respectively. The Vectors themselves each consist of three Values. For animation purposes, these Values can be replaced with Envelope channels. Animation will be discussed in Chapter 2.2. The actual shape of a 3D object in Quest3D is described in the second half of the structure. Linked to the Surface channel are, in order, the 3D ObjectData, the Material and the Texture channels. The 3D ObjectData channel contains the vertices and polygons of an object. It also contains information on how to wrap a texture around the shape. The Material channel is subdivided into a number of aspects: Diffuse, Emissive, Specular, Power, Alpha Diffuse and Texture Blend Factor.

Page 74: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

74

The Diffuse vector contains an object’s color, and consists of three components: red, green and blue, or ‘RGB’. The Emissive vector describes the amount of self-lighting the model has. Without lights in your scene, an object with an Emissive vector of (0, 0, 0) is black. The Specular vector defines the color and intensity of the highlight, while the Power value controls the size of the highlight. The Alpha Diffuse value defines the transparency of an object. The Texture Blend Factor value defines how much of a texture is blended with the Diffuse color. The Texture channel represents the actual texture image applied to a surface. It contains a diffuse (color) image, and may contain an alpha image. Material settings and textures can be adjusted in the Object Section.

Page 75: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

75

Object Section layout:

1 Application menu Contains standard functions such as file

management, configuration and help. 2 Toolbar Icons for file management, channel graph

view and camera view. 3 Section selection buttons Buttons to quickly switch to one of the

Sections. 4 Run, Run/Edit, Edit buttons Controls user input handling. 5 ‘Material’ tab Object material properties 6 ‘Surfaces’ tab Transparency, blending and object sorting 7 ‘Texture’ tab Texture mapping and advanced

transparency and blending. 8 ‘Lighting’ tab Lightmap texture baking. 9 ‘Animation 3D View’ tab Displays the entire scene. 10 ‘Object 3D View’ tab Displays the selected object. 11 ‘Textures’ tab List of all textures in a project. 12 Surface List List of all surfaces of selected objects. 13 Object List List of all objects in a project. 14 Log bar Debug and error messsages.

Page 76: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

76

Tutor ia l

The following tutorial focusses on 3D objects in Quest3D. It is also an introduction to the Object Section of the program. Needed Quest3D scene: • ..\Tutorials\2.1 – 3D objects\3D objects.cgr Step by step: • Open the scene, ‘3D objects.cgr’.

• Go to the Object Section by pressing the button on the toolbar. • The 3D model is displayed in the Animation 3D View window. • Click on the name ‘Car’ in the Object List in the lower right corner of the

screen to select it. • Click on the name ‘Body’ in the Surface List in the lower half of the screen to

select it. • Look at the ‘Material’ tab on the left side of the screen. It shows a number of

sliders. • Drag the ‘Diffuse’ sliders to different positions. Note how the color of the

object changes. • Hold the ‘shift’ key and drag one of the sliders. Note all three sliders are

affected.

• Go to the Channels Section. • Link the ‘Texture’ channel to the ‘Surface’ channel.

Page 77: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

77

• Go to the Object Section. Note the texture is displayed on the model. • Drag the Emissive sliders to a different position. Note how the self-lighting

of the object changes, regardless of light sources. • Drag the Specular sliders to a different position. Note how the color and the

intensity of the highlight on the model change. Power (P) controls the size of the highlight.

• Click on the name ‘Windows’ in the Surfaces List to select it. • Before you can work with transparency, you need to enable it. Go to the

‘Surface’ Tab. • From the ‘Transparency’ drop-down list select the ‘Alpha Value' option.

Note the object disappears.

• Go back to the ‘Material’ tab. • Drag the ‘Tex Factor’ slider to a different position. Note how the

transparency of the object is affected. •

Finished scene: • ..\Tutorials\2.1 – 3D objects\3D objects – Complete.cgr

Page 78: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

78

2.2 Animation

One of the most powerful features of Quest3D is that you can animate virtually every aspect of your scene. For instance, 3D objects can be moved, rotated and scaled over time. In addition, all of their surface properties can be animated, such as their color and transparency values. 3D character models can be brought to life by animating virtual skeletons inside of them. Music and sound can be triggered on certain location- or time-based events. Menu windows can be moved or faded in and out of the screen. Envelopes In Quest3D, animation often means changing values over time. The regular Value channel can only store one value. To store animation data, the Envelope channel is used. The interface of the Envelope channel looks like a mathematical graph. It works in a similar way as well. The horizontal axis represents the input (often time), which can be fed to the Envelope by connecting a (Timer) Value to its child link. The vertical axis represents the output. Through (X, Y) pairs and interpolation, any input can be converted to an output value.

Page 79: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

79

Timers The Timer Value and Timer Command channels allow for easy animation control. Examples of Timer Commands are ‘Play’, ‘Stop’, ‘Rewind’ and ‘Play & Loop’. In the image below, a Timer Value channel is linked as input to an Envelope channel. The Timer can be played using the Timer Command channel shown in the same image.

A Timer can be named in the properties window of its channel. You can create as many seperate Timers as needed in a scene.

Page 80: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

80

Timer Value channels are automatically adjusted for computer speed. In Quest3D, 25 frames equal exactly 1 second. The Animation Section of Quest3D is where all objects are positioned and animated.

Page 81: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

81

Animation Section layout:

1 Application menu Contains standard functions such as file

management, configuration and help. 2 Toolbar Icons for file management, channel graph

view and camera view. 3 Section selection buttons Buttons to quickly switch to one of the

Sections. 4 Run / Run/Edit / Edit

buttons Controls user input handling.

5 ‘Object’ tab Shows list of all objects. 6 ‘Camera’ tab Shows list and properties of all camera’s. 7 ‘Light’ tab Shows list and properties of all lights. 8 Search filter bar Filters objects in the list. 9 Object List List of all objects in a project. 10 Motion control buttons Move, rotate and scale an object. 11 Transform type-in fields Value fields for position, rotation and size. 12 Configuation toolbar Controls elements such as world scale. 13 Animation 3D View window Displays the 3D scene.

Page 82: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

82

14 Time Slider Bar Keyframe creation and animation playback per Timer.

15 Log bar Debug and error messsages. The Time Slider Bar allows you to insert keyframes and playback animations.

1 Start frame 2 Current frame 3 End frame 4 Timer List 5 Previous keyframe 6 Record 7 Play (and loop) 8 Next keyframe 9 Delete keyframe button 10 Insert keyframe button 11 Envelope controls Other types of animation Any channel of base type Value can be used as input for animation. Examples include a highlight effect based on mouse-over events, the length of a status bar based on a complex calculation and even behavior of artificial intelligence characters responding to each other.

Page 83: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

83

Tutor ia l

This tutorial introduces time-based animation in Quest3D. After completing it, you should have an understanding of Envelopes, Timers and Timer Commands. Needed Quest3D scene: • ..\Tutorials\2.2 – Animation\Animation.cgr Needed templates: • Animation \ Timer Value (x2) • Animation \ Timer Commands \ Play & Loop • Animation \ Timer Commands \ Stop Step by step: • Open the scene ‘Animation.cgr’. It contains a simple scene and two spheres. • Drag a Timer Value channel onto the Channel Graph. Connect it to the ‘Red

Sphere Timer Value’ channel.

• Go to the Animation Section by pressing the button. • Click on the Play button . Note that the red sphere is now moving. The

animation is looped. Press the Stop button . Note that the animation halts at the current frame.

• Go to the Channels Section. • Drag another Timer Value onto the Channel Graph. Connect it to all 9

Envelope channels of the motion of the ‘Blue Sphere’ object.

Page 84: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

84

• Double click on this Timer Value channel to open its properties window.

From the drop-down list, select ‘New..’. In the pop-up window, enter the name ‘Blue Sphere’ and press OK.

• Go to the Animation Section. • Click on the ‘Blue Sphere’ object in the list on the left hand side of the screen

to select it. • The Time Slider Bar currently displays the ‘Default’ timer. From the Timer

List, select ‘Blue Sphere’. • Press the Play button. Note that the blue sphere is now moving. Note that the

red sphere does not move, as it is animated through another timer (in this case, the ‘Default’ timer).

• Press the Stop button. • In the ‘End Frame’ box, change the value to ‘250’. Note that the time slider

bar is resized in order to show all frames from ‘0’ to ‘250’. • Drag the Time Slider to ‘150’, and press the ‘Insert keyframe’ button .

Confirm the pop-up window by clicking ‘OK’. Note that a keyframe is added onto the Bar.

• Move the blue sphere by changing one or more of the coordinate values in

the Transform Type-in fields. They are located in the lower-left corner of the screen, under the ‘Move’ button.

Page 85: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

85

• Make sure the Gizmo is on by pressing the button on the toolbar in the lower left corner of the screen.

• Move the blue sphere by dragging one of the axes of the Gizmo.

• Move the Time Slider to frame ‘0’, and press the ‘Insert keyframe’ button. In the pop-up window, type in ‘250’, and confirm by clicking ‘OK’. The current motion (position, rotation, scale) of the object at frame ‘0’ is copied to frame ‘250’. The animation now loops properly.

• Press ‘Play’ to examine the new, longer animation you just created. When ready, press ‘Stop’.

• Make adjustments if needed. • Go to the Channels Section. • Locate the ‘Env X’ channel, which is part of the position vector of the ‘Blue

Sphere’ object. Double click on the ‘Env X’ channel to open its properties window.

• Click on one of the keyframes to select it, and drag it up or down to change its value.

• Drag the keyframe left and right using the right mouse button. This changes the keyframe’s position on the horizontal axis (time).

• In the ‘Vert. Value (out)’ box, type in a value for extra precision. • Click ‘OK’ to accept your changes and close the Envelope editor window.

Page 86: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

86

• Go to the Animation Section. • Press ‘Play’ to examine the adjustments to the animation. When ready, press

‘Stop’. • Go to the Channels Section. • Drag a Play & Loop template onto the Channel Graph. Connect it to the ‘Play

Animation’ channel. • Double click on the ‘Play & Loop’ channel to open its properties window.

Select ‘Blue Sphere’ and press ‘OK’ to accept. • Drag a Stop template onto the Channel Graph. Connect it to the ‘Stop

Animation’ channel. • Double click on the ‘Stop’ channel to open its properties window. Select ‘Blue

Sphere’ and press ‘OK’. • Go to the Animation Section.

• Switch to Run Mode by pressing the button. • Press the spacebar. The animation starts playing, and loops. • Press the escape key. The animation stops.

Finished scene: • ..\Tutorials\2.2 – Animation\Animation – Complete.cgr

Page 87: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

87

2.3 Object import

Quest3D comes with a number of directly usable 3D objects. Sooner or later, however, you will want to start using your own models. Various companies and websites worldwide offer complete 3D objects, either for free or commercially. It is also possible to create your own models in software packages such as 3d Studio Max, Maya and Lightwave. .X files Before you can use your own models in Quest3D, you will need to convert them to the Microsoft DirectX ‘.X’ file format. ‘.X’ files contain all wireframe, surface, texture assignment and animation data of an object, and can directly be imported into Quest3D. The ‘.X’ file exporter plug-ins for a number of modelling packages are shipped with Quest3D. To install the appropriate one, from the Windows Start Menu, select Programs > Act-3D > Quest 3D 3.0 > Extras > Exporters > followed by the program directory and version of your choice. Make sure you install the utility to the correct plug-ins subdirectory of the modelling package. Appendix A1 details preparation of 3D objects in and export from 3d Studio Max and Maya. In addition, export and import using Polytrans is described.

Page 88: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

88

Tutor ia l

In the following tutorial, a simple object created in one of the modeling packages mentioned above is exported to the ‘.X’ format. It is then imported into Quest3D. Preparation: • In your favorite modeling package, create a simple object such as a cube.

Refer to the program’s help file for details. • From the Applications Menu, select ‘File > Export’. • Choose a location on your harddisk to save the ‘.X’ file to. • Type in a name and press ‘Save’. • The standard settings are good for now.

Select ‘Go!’.

The directory ‘..\Resources\3D Models\’ on your harddisk contains a number of objects in ‘.X’ file format. You can also use one of these models to complete this tutorial.

Page 89: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

89

Needed ‘.X’ file: • ..\Resources\3D Models\Cars\Car.X Needed templates: • Scene \ Simple Scene Step by step: • In Quest3D, from the Applications Menu select ‘File > Import’. • Locate the ‘.X’ file you just created, or the ‘Car.X’ file from the directory

specified above. Press ‘Open’ to accept. • The next properties window suggests a channel pool name. Change it to

‘Car’ and press ‘OK’ to accept. • The standard settings in the next properties window are perfect for now.

Press ‘OK’ to accept.

• Note that the 3D model from the ‘.X’ file is now imported into Quest3D. It is stored in the standard 3D Object channel structure.

Page 90: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

90

• Drag the Simple Scene template onto your Channel Graph, above the object channels.

• Select and delete the ‘Primitive Object’ channel and all its children. • Right click on the ‘Start 3D Scene’ channel, and select ‘Set as start channel’. • Make sure the Animation 3D View displays the scene using the Project

Camera . • Link the 3D object you just imported to the ‘Render’ channel. It should now

appear in the Animation 3D View window. • Go to the Object Section. • Make any adjustments necessary to the model surface. Examples are

‘Emissive’ and ‘Specular’ values, and transparency settings. • Go to the Animation Section. • Make sure the Animation 3D View displays the scene using the Project

Camera .

• Switch to Run Mode by pressing the button. • Press and hold down the right mouse button and move the mouse around.

The view rotates around the object. • If you wish, you can save the current scene to a folder on the harddisk.

Finished scene: • ..\Tutorials\2.3 – Object import\Object import – Complete.cgr

Page 91: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

91

2.4 Surface properties

Much of the look of 3D objects in a scene is defined by their surface properties. This chapter takes a closer look at textures, texture mapping, blending methods and transparency. Textures A ‘texture’ is an image that can be wrapped around a 3D shape. In real-time graphics, for performance reasons, their dimensions in pixels (width and height) must be a power of 2. In Quest3D, they must also be greater than 8. Dimensions of 32x32, 128x256 and 256x256 pixels are all valid sizes.

Larger dimensions mean larger file sizes, and an increase in memory use. Even though today’s graphics hardware can have 64, 128 or even 256 MB of texture memory, inefficient use of textures may cause problems. While a ‘.jpg’ image with dimensions of 2048x2048 pixels might take up as little as 40 kb of harddisk space, it takes up over 8 MB of texture memory. It is recommended to keep texture dimensions as small as possbile, without sacrificing detail. A good rule of thumb is to use sizes no greater than the texture will ever be seen on screen. For example, for buildings in the distance of a scene, 128x128 pixel textures might be enough. Grass planes might not need to be greater than 32x32.

Page 92: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

92

Compression In addition, textures in Quest3D may be compressed. The image quality might slightly decrease, but compressed textures may use up to four times as little memory as uncompressed versions. Creating a 3D scene is constantly balancing between quality and performance. Mipmaps Larger textures on distant surfaces might produce artifacts.

By using various versions of increasingly smaller size, these distortions may be countered. These smaller versions of the same texture are called ‘mipmaps’ and can be generated automatically by Quest3D.

Using mipmaps on the square in the image above results in the following picture.

Page 93: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

93

Note that the smaller versions take up texture memory as well. Also, when loading a Quest3D scene, mipmaps must be generated at start up. This might take some time, depending on the number of textures in the project, their dimensions, and the number of mipmaps specified per texture. .dds file format The ‘.dds’ image format can store mipmap information. File size increases, but loading times in Quest3D decrease since no mipmaps have to be generated at startup. The ‘.dds’ plug-in for Photoshop is shipped with Quest3D. To install it, from the Windows Start Menu, select Programs > Act-3D > Quest 3D 3.0 > Extras > Exporters > Photoshop > DDS file Make sure you install the utility to the ‘Plug-Ins’ subdirectory in the Photoshop folder on your harddisk. UV Mapping Textures are wrapped around a 3D object according to so called ‘UV coordinate sets’. UV coordinates specify where each pixel of a texture is drawn onto a surface. Quest3D can handle simple ‘UV mapping’ methods such as planar and cubic, shown in the image below. These simple UV mappings can be moved and scaled.

Page 94: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

94

UV coordinates range from 0 to 1.0. (0, 0) is the top left corner of an image, while (1.0, 1.0) is the bottom right corner.

Since UV coordinates are relative, once an object is properly ‘UV mapped’, textures of any size may be applied to the object. Wrapping a texture around a 3D object usually requires more control and precision. In practice, UV mapping means placing every vertex of a 3D object onto a 2D image.

Page 95: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

95

Complex UV mapping should be done in your favorite 3D modelling software package. Please refer to the manual of your modelling package for more information on UV mapping. Keywords: ‘uv’, ‘unwrap’, ‘texture’, ‘mapping’. An advanced form of UV mapping in Quest3D is the ‘Reflection map’ method. It projects a texture onto a surface based on the current camera position. The image below shows an object with reflection mapping in three different angles, plus the reflection texture.

Transparency Surface transparency may be handled in a number of ways. In the Object Section, on the ‘Surface’ tab, the ‘Transparency’ dropdown list provides a number of options.

The top row in the image below shows the following transparency methods, in order: ‘No Transparency’, ‘Multiply’ and ‘Add’. The bottom row shows, in order, ‘Add Smooth’, ‘Alpha Value’ and ‘Alpha Texture’.

Page 96: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

96

‘Multiply’ can be used for dark windows or shadows for example. ‘Add’ produces a glow effect. ‘Add Smooth’ is a subtle version. ‘Alpha Value’ makes a surface transparent from 0% to 100%. ‘Alpha Texture’ is used to precisely specify transparency. Texture stages More than one texture may be applied on a surface. The maximum number of ‘texture stages’ that can be used per surface depends on the graphics hardware. Most graphics cards support two stages, and newer graphics cards support three or four. Chapter 10, ‘Landscapes’, discusses an advanced blending method based on multiple render passes. The various texture stages of a surface may be blended together in a number of ways. In the Object Section, on the ‘Surface’ tab, the ‘Texture Blending’ dropdown list provides a number of options. They are similar to the options in the ‘Transparency’ drop-down list, discussed above.

Page 97: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

97

The top row in the image below shows three source textures: stage 1, stage 2 and an alpha map. The bottom row shows the following blending methods, in order: ‘Multiply’, ‘Add’, ‘Alpha Value’ (50%) and ‘Alpha Texture’.

The ‘Multiply’ setting typically results in darker colors. ‘Add’ produces lighter colors. ‘Alpha Value’ blends two stages from 0 to 1 (0% to 100%). ‘Alpha Texture’ is used to precisely specify a blend. UV sets A surface may have more than one set of UV coordinates. The maximum number of UV sets depends on the graphics hardware. Most cards support up to two sets. Blending texture stages with seperate UV coordinates may be done to mask repetition. In addition, effects such as light mapping need their own sets. The image below shows two texture stages, each with their own uv mapping. The blending result is shown on the right.

Page 98: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

98

Object sorting When rendering a scene, Quest3D automatically sorts all surfaces to display them in the correct order. Sometimes, especially with transparent objects, glitches cause a surface to be sorted incorrectly. In this case, (part of) the surface is rendered behind or through another while it should be in front.

To overcome such glitches, in general, transparent surfaces should be rendered after non-transparent surfaces. Another means to counter sorting glitches is by setting the ‘Z Bias’ of a surface. It can be changed in the Object Section, on the ‘Surface’ tab, in ‘Advanced..’ mode. When the exact surface rendering order is unclear, surfaces with a higher Z Bias will be rendered in front of others.

Page 99: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

99

The surfaces from the image above are now rendered in the correct order, as shown in the following picture.

Alpha artifacts Alpha textures used to define transparency may sometimes produce unwanted results.

Page 100: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

100

Pixels that should be transparent may be ‘knocked out’ with the ‘Reject Alpha Pixels’ setting. It can be changed in the Object Section, on the ‘Surface’ tab, in the ‘Advanced..’ mode. The ‘Ref’ value defines the threshold for knocking out unwanted pixels.

The image below shows the texture surface with proper alpha transparency.

Page 101: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

101

Tutor ia l

This tutorial deals with textures, transparency, blending methods and surface sorting. At the end of this chapter you should be able to work with textures in Quest3D. Needed Quest3D scene: • ..\Tutorials\2.4 – Surface properties\Surface properties.cgr Needed textures: • ..\Resources\Textures\Architecture\Buildings_128.jpg • ..\Resources\Textures\Landscapes\Grass.jpg • ..\Resources\Textures\Reflection\Reflection_1.jpg Step by step: • Open the scene ‘Surface properties.cgr’. It contains a road through the

countryside, a few buildings in the background, a number of trees and a parked car.

• Go to the Object Section. • Click on the ‘Animation 3D View’ tab to select it. • Make sure the Animation 3D View displays the scene using the Project

Camera . • From the current point of view, examine the buildings in the background.

Note they are fairly small compared to the rest of the screen. • Click on the ‘Buildings’ object in the list to select it. • On the ‘Textures’ tab on the right side of the screen, locate the highlighted

texture called ‘Buildings_1024.jpg’. Double click on the texture to open its properties window.

• In the texture properties window, note its dimensions as well as its memory use.

• Press the ‘Load’ button and locate the ‘..\Resources\Textures\Buildings\’ folder. Select the file ‘Buildings_128.jpg’, and press ‘Open’ to accept. The new image is displayed in the preview window. Note the new dimensions and memory use. Press ‘OK’ to close the Texture window.

• Reexamine the buildings in the background. Note their textures are still sharp enough. Decreasing texture size for performance reasons in this case did not result in a decrease in quality.

Page 102: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

102

• Switch to the Editor Camera by clicking on its icon . • Look at the landscape from above. Note the green surface needs a texture. • Click on the ‘Landscape’ object in the list to select it. • Click on the ‘Grass’ surface in the list to select it. • On the ‘Textures’ tab on the right side of the screen, press the ‘Load’ button

to load a new texture. Locate the ‘..\Resources\Textures\Landscapes\’ folder.. Select the file ‘Grass.jpg”, and press ‘Open’ to accept. Press ‘OK’ to close the Texture window.

• Click on the new texture to apply it to the ‘Grass’ surface of the ‘Landscape’ object. Note the texture is stretched across the entire landscape.

• On the ‘Textures Stages’ tab on the left side of the screen, from the ‘Mapping’ drop-down list, select ‘Planar Y’. Note the texture is now projected onto the surface along the vertical axis.

• Drag the ‘Scale’ button to change the tiling. Note the mapping on the surface is affected.

• Type in ‘20’ for both the ‘U’ and ‘V’ values in the boxes next to the ‘Scale’ button to precisely set the tiling.

• Press the icon to display the scene using the Project Camera.

Page 103: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

103

• Examine the grass landscape from this perspective. Note the visual artifacts further away from the camera.

• On the ‘Textures’ tab on the right side of the screen, locate the highlighted texture called ‘Grass.jpg’ and double click it. In the properties window, note the MipMap Count value is currently ‘1’. Change it to ‘0’ to let Quest3D automatically decide how many mipmap levels are needed. Press ‘OK’ to close the Texture window.

• Reexamine the grass landscape. Note the visual artifacts further away from the camera are much smoother now.

• Press the icon to display the scene using the Editor Camera. • In the Objects List in the lower right corner of the screen, click on the ‘Car’

object to select it. • In the Surfaces List in the lower part of the screen, click on the ‘Chassis’

surface to select it. • On the ‘Texture Stages’ tab on the right side of the screen, click on the ‘Stage

2’ tab. • On the ‘Textures’ tab on the right side of the screen, press the ‘Load’ button

to load a new texture. Locate the ‘..\Resources\Textures\Reflection\’ folder. Select the file ‘Reflection.jpg”, and press ‘Open’ to accept. Press ‘OK’ to close the Texture window.

• Click on the new texture to apply it to the ‘Chassis’ surface of the ‘Sports Car’ object. Note the texture is stretched across the car.

• On the ‘Texture’ tab on the left side of the screen, from the ‘Mapping’ dropdown list, select ‘Reflection map (CamReflvec)’. Note the UV mapping is affected.

• Orbit the Editor Camera around the car. Note the UV mapping is affected. • On the ‘Surface’ tab, from the ‘Texture Blending’ dropdown list select ‘Alpha

Value’. • On the ‘Material’ tab, drag the ‘Texture factor’ slider to ‘0.92’. Note the

reflection stage is blended onto the diffuse texture stage below. • Orbit the camera around the car. Examine the reflection effect. If needed,

adjust the ‘Texture Factor’ slider to change the amount of blending. • Click on the ‘Windows’ surface in the list to select it. • On the ‘Surface’ tab, from the ‘Transparency’ drop down list select

‘Multiply’. Note how the car windows become transparent and darker. • From the ‘Transparency’ drop down list select ‘Add’. Note how the car

windows become transparent and lighter, almost glowing. • From the ‘Transparency’ drop down list select ‘Alpha Value’. Note the car

windows become fully transparent.

Page 104: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

104

• On the ‘Material’ tab, drag the ‘Alpha’ slider to ‘0.5’. Note the car windows become 50% transparent.

• Examine the trees in the scene. Note the square surfaces around their leaves should be transparent.

• Click on the ‘Trees’ object in the list to select it. • Click on the ‘Leaves’ surface in the list to select it. • On the ‘Surface’ tab, from the ‘Transparency’ dropdown list select ‘Alpha

Texture’. Note the squares around the leaves become more transparent. Note there is still an unwanted outline around the leaves.

• On the ‘Surface’ tab, click on the ‘Advanced..’ button. • Select ‘Reject Alpha Pixels’ and type in ‘150’ as ‘Ref’ value. Note the outline

around the leaves disappears.

Page 105: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

105

Finished scene: • ..\Tutorials\2.4 – Surface properties\Surface properties – Complete.cgr

Page 106: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

106

2.5 Lighting and shadows

Proper lighting is essential for a convincing virtual scene. Lighting and shadows give the user visual cues about an environment. Without contrast between light and dark, it is much harder to establish depth in a scene. A number of lighting techniques are available in Quest3D: regular external lighting, self-lighting, real-time shadows and lightmapping. This chapter describes these techniques in detail. Regular external lighting involves a source that emits light onto 3D objects in a scene. In Quest3D, lights are actual channels, and have a number of child links. Their properties can also be accessed in the Animation Section, on the ‘Light’ tab. Light types A light in Quest3D may be of one of three types: point, spot and directional, shown in the image below.

A point light radiates light into every direction. A spotlight is defined by an inner and outer cone angle, resulting in a simulated fall-off effect. A directional light is simply a rotation vector along which the source emits light. All rays of a directional light are parallel to each other.

Page 107: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

107

A Quest3D light can be colored through its ‘Diffuse’ vector. The ‘Ambient’ vector serves as a global ‘Emissive’ vector to all objects affected by the light source.

The image above shows examples of ‘Diffuse’ and ‘Ambient’ lighting. A light’s influence in a scene is best controlled by linking the Light channel to a Render. Only the objects connected to this Render will be affected by the attached light source. A maximum of 8 lights may be attached per Render channel. This is a hardware limitation. A 3D object’s illumination may be influenced by changing its Diffuse and Emissive vectors. These can also be accessed in the Object Section, on the ‘Material’ tab. A higher Emissive vector will suggest a certain degree of self-illumination or ambient light. Especially for outdoor scenes, increased emissiveness will produce convincing results. As mentioned above, the ‘Ambient’ vector of a light serves as a global ‘Emissive vector’ to all objects affected by the light source.

1) Object Diffuse (1, 1, 1), Light Diffuse (1, 1, 1), Light Ambient (0, 0, 0) 2) Object Diffuse (1, 1, 1), Light Diffuse (1, 1, 1), Light Ambient (0.4, 0.4, 0.4) 3) Object Diffuse (1, 1, 1), Light Diffuse (1, 0.8, 0.6), Light Ambient (0, 0.2, 0.4)

Page 108: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

108

Shadows Shadows for dynamic objects, such as cars or walking characters, can be simulated using texture squares.

Such shadow planes are rendered fast, and produce convincing results.

Real-time shadows Quest3D also supports real-time shadows. The Stencil Shadow channel can be seen as a Render specialised in calculating shadows. The Stencil Shadow channel requires a light source position vector to work. 3D Objects may be linked to the StencilShadow by means of a SoftwareStencilShadowObject.

Page 109: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

109

The hardware version of this channel, the FastShaderStencilShadowObject, is faster but does not support unclosed objects, nor skinned characters. Light mapping Real-time shadows require a lot of processing power. Moreover, real-time shadows are harsh and do not account for ambient lighting (radiosity). To increase framerate and create smooth lighting and shadows, the light mapping method can be used.

Page 110: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

110

Light mapping is the process of calculating lighting and shadows once, and storing the information into a texture. The resulting ‘light maps’ are then applied on an object on a second texture stage, and blended with the diffuse texture. Light maps can be generated in a number of advanced 3D modelling software packages such as 3D Studio Max and Maya. It is also possible to create lightmaps in Quest3D. In the Object Section, on the ‘Texture Lighting’ tab, a number of settings define the quality of a Quest3D light map. Renders and lights can be selected, as well as texture width and height. It is possible to calculate lighting, shadows or both. Finally, the Anti Aliasing setting controls the smoothness of the lightmap.

Before a 3D object can be lightmapped, it needs a proper UV set. For fairly simple objects such as planes and landscapes, Quest3D planar UV mapping may be used. For more precise UV mapping, please refer to the manual of your favorite 3D modelling software package.

Page 111: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

111

Tutor ia l

Needed Quest3D scene: • ..\Tutorials\2.5 – Lighting and shadows\Lighting and shadows.cgr Needed templates: • Scene \ Lights \ Point Light Step by step: • Open the scene ‘Lighting and shadows.cgr’. It contains an unlit scene

including a city block and an animated character. • Drag a Point Light template onto the Channel Graph and connect it to the

‘Animated Character Render’ channel. Note the character is affected by the light source.

• Make a shortcut of the ‘Point Light’ channel and connect it to the ‘City Render’ channel. Note the environment is affected by the light source.

• Go to the Animation Section. • On the ‘Light’ tab, select the ‘Point Light’ and move the light around in the

Animation 3D View. Note both the character and the environment are affected.

• Move the light to position (0, 0, 5). • Change the rotation to (0, -90, 0). Note that rotating a point light does not

influence its effect. • Change the ‘Light Type’ by pressing the ‘Spot’ button. Note the influence of

the light changes. • Change the ‘Outer Cone Angle’ to ‘120’, and the ‘Inner Cone Angle’ to ‘30’.

Note the gradient of light between these angles. • Change the ‘Light Type’ by pressing the ‘Dir’ (directional) button. Note the

influence of the light changes. • Change the rotation of the light to (30, -45, 0). • Move the light to position (-100, 30, 100). Note that moving a directional light

does not influence its effect. • Go to the Channels Section. • Rename the ‘Point Light’ channel to ‘Sun Light’.

Page 112: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

112

• Add a Vector channel and connect it to the ‘Ambient’ child link of the ‘Sun Light’ channel. Change its values to (0.4, 0.4, 0.4). Note both the character and the environment appear brighter, as if affected by ambient day light.

• Drag a Render Stencil Shadow channel onto the Channel Graph and connect it

to the ‘Project’ channel. • Make a shortcut of the position vector of the ‘Sun Light’ channel and connect

it to the ‘Light vector’ child link of the ‘Shadow Renderer’ channel. • Add a Software Stencil Shadow Object channel and connect it to the ‘Stencil

Shadow Base Object’ child link of the ‘Render Stencil Shadow’ channel. • Make a shortcut of the ‘Animated Character’ channel and connect it to the

‘Software Stencil Shadow Object’ channel. Note the character object now casts a shadow onto the environment.

• Go to the Animation Section. • Move the ‘Animated Character’ object around. Note the shadow is cast from

the position of the sun.

• When ready, go to the Object Section. • Click on the ‘Street’ object in the list to select it. • Click on the 'Street 1' surface in the list to select it. • On the ‘Texture’ tab, click on the ‘Stage 2’ tab. From the drop-down list,

select ‘UV Set 1’. • On the ‘Lighting’ tab, press the ‘Add Texture Lighting’ button. Note a green

on black grid texture is applied to the ‘Street’ model. Also, a number of options are now accessible on the ‘Lighting’ tab.

• Make sure the ‘Environment Render’ is selected, and the ‘Animated Character Render’ is not. A red cross over the eye icon means a render is not selected.

• Make sure the ‘Sun Light’ is selected. • Set the texture ‘Width’ and ‘Height’ to 256. Press the ‘Set Absolute’ button.

Note the green on black grid updates. • Make sure the ‘Calculate lights’ and ‘Calculate shadows’ options are selected.

The other options may be unselected. • Make sure ‘Anti Aliasing’ is set to 1x. • Create a test light map with these settings by pressing the ‘Calculate

Lighting’ button. Note a progress window pops up. Note that calculation of light maps may take a while, up to several minutes. After calculation, the ‘Street’ object should display light mapped shadows.

• On the ‘Surface’ tab, from the dropdown list ‘Texture Blending’, choose 'Alpha value'.

Page 113: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

113

• On the 'Material' tab, set the 'Tex Factor' to '0.75'. Note the light map layer blends with the texture layer below.

• On the ‘Lighting’ tab, adjust the ‘Width’ and ‘Height to 1024, and set the ‘Anti Aliasing’ to ‘4x’.

• Create the final high resolution light map with these new settings by pressing the ‘Calculate Lighting’ button. Note that calculation time increases.

• Wait for the light map to be finished, and examine the result. • Create light maps for the remaining surfaces of the 'Street' object.

Finished scene: • ..\Tutorials\2.5 – Lighting and shadows\Lighting and shadows –

Complete.cgr

Page 114: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

114

2.6 Cameras

A camera defines the point of view from which a scene is presented. Choosing the right camera for a project is important, as it influences the way users experience a scene in a very direct way. This chapter discusses a number of available camera templates and general properties. Animation Camera An Animation Camera may be used to guide a user through a scene. The animation camera is similar to a real-life freehand cinematic camera. It may also be the preferred camera for non-interactive scenes such as visualisations, documentaries or screensavers. Animation Camera with Target An Animation Camera with Target always looks at a dummy object. Both the camera and the helper object can be animated.

Object Inspection Camera Quest3D is the perfect product visualisation package. An Object Inspection Camera can orbit around a 3D model, enabling the user to view the object from all angles. Such ‘products’ might be as small as technological gadgets, or as large as entire cityblocks.

Page 115: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

115

1st Person Walkthrough Camera It is often desirable, and rewarding, to experience an architectural visualisation as if you were there. A 1st Person Walkthrough Camera presents a scene at regular eye level, and allows the user to walk around freely. Since the view is close to real life, this type of camera provides the highest level of immersion in a scene. Many computer games make use of the 1st person perspective. 3rd Person Walkthrough Camera In contrast to the 1st person point of view, a 3rd person perspective places the camera just outside of a virtual character. The 3rd Person Walkthrough Camera is attached to this character, or avatar, and follows it wherever it goes. There might be less immersion using a 3rd person camera. However, the avatar can be seen as an agent through which the user may interact with the virtual world. Some users find a 1st person perspective too confronting, and prefer the ‘safety’ of the 3rd person point of view. In some cases, the 3rd person view provides more overview of the avatar’s environment and position. Besides point of view, a number of other aspects define a camera. Zoom factor The zoom factor is a quick way to zoom a camera in or out. The default value of ‘1.0’ results in a normal view. A higher Zoom Factor brings the scene closer, a lower value sets it further away. Clipping planes The ‘clipping planes’ of a camera are virtual boundaries between which a scene is rendered. Polygon surfaces outside of these boundaries are not calculated. By attaching a Field of View Matrix template to a Camera, it is possible to manually define the clipping planes. This template allows the field of view angle to be changed (in degrees). Values of 50 to 90 degrees are standard. If the clipping planes are positioned, so that there is a smaller amount of geometry rendered, the performance of the project will increase.

Page 116: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

116

Fog Fog can be used to blend various elements in a virtual environment together. It can add to the mood of a scene and suggest depth. A bonus of using fog is that the far clipping plane of the camera may be decreased to just behind the ‘Fog End’ value. If used right, this will result in a smooth transition between the scene and the “nothing” beyond the far clipping plane.

Page 117: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

117

Tutor ia l

Needed Quest3D scene: • ..\Tutorials\2.6 – Cameras\Cameras 1.cgr Needed templates: • Scene \ Cameras \ Object Inspection Camera Step by step: • Open the scene ‘Cameras 1.cgr’. This scene contains a car connected to a

render. • Drag the Object Inspection Camera template onto the Channel Graph. Link the

‘Object Inspection Camera’ to the ‘Render’ channel. • Go to the Animation Section. • Make sure the Animation 3D View window displays the scene using the

Project Camera. • Switch to Run Mode. • Click and hold the right mouse button and drag the mouse around to orbit

around the car. • When ready, switch to Edit Mode. Finished scene: • ..\Tutorials\2.6 – Cameras\Cameras 1 – Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 118: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

118

Needed Quest3D scene: • ..\Tutorials\2.6 – Cameras\Cameras 2.cgr Needed templates: • Scene \ Camera \ Walkthrough Camera • Objects \ Collision \ Collision Object Step by step: • Open the scene ‘Cameras 2.cgr’. Go to the Channels Section. This scene

contains a city block consisting of a number of buildings, connected to a render without a camera. Three parts of the city, the ‘Car’, ‘Building_Collision_Objects’ and ‘Street’, are going to be used as collision objects.

• Switch to Edit Mode. • Drag in a Collision Object, and connect the ‘Street’ channel to it. Leave the

‘Street’ channel connected to the render. • Double-click on the Collision Object, and click on ‘Create Tree’. The object will

be calculated. • Drag a Walkthrough Camera template onto the Channel Graph. Do not

connect it to the ‘Render’ channel yet. • Link the Collision Object to the last child link of the Fast Collision Response

channel of the Walkthrough Template. • Create Collision Objects for the Buildings and the Car. Disconnect the

‘Building_Collision_Object’ channel from the ‘Render’, but leave the ‘Car’ channel connected.

• Connect the ‘Walkthrough Camera’ channel to the ‘Render’ channel. Note the Animation 3D View window is updated and displays the scene from a different perspective.

• Link the ‘Camera Logic’ channel to the ‘Start3DScene’. If you press Space, the camera will reset to it’s original position.

• To set the camera’s height, double click on the folder ‘In: Collision Spheroid Radius’ (this is the second child of the ‘FastCollisionResponse’). This folder contains a vector. To set the height of the camera, change the Y value into another value, like 1.9.

• Go to the Animation Section. • Switch to Run Mode. • Test the scene by walking through the city using the arrow keys and mouse. • Press the space bar to reset the camera.

Page 119: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

119

Finished scene: • ..\Tutorials\2.6 – Camera’s\Camera’s 2 – Complete.cgr

Page 120: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

120

2.7 Graphic user interface

User input affects an application. The medium through which a user can communicate with the software is called the interface. Keyboard and mouse are part of the interface of most applications. The part of the interface on the computer screen is the Graphic User Interface, or GUI for short. A Graphic User Interface often appears as a 2D layer on top of the regular scene. A mouse cursor, various buttons, sliders and input boxes may all part of a GUI. Head-up Display Non-interactive elements of the 2D overlay are part of the Head-up Display, or HUD for short. Examples of HUD elements are score counters, company logo’s, top down maps of the user’s virtual environment and spinning 3D representations of the current physical condition of the user’s avatar in a computer game.

The terms ‘Graphic User Interface’ and Head-up Display’ are sometimes used synonymously. In the picture above, the Quest3D logo and debug information are part of the HUD and the RGB values and Rotation option are part of the GUI.

Page 121: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

121

GUI in Quest3D In Quest3D, the 2D layer on top of the rest of the scene is rendered in a special way. It is in fact a second 3D scene, rendered through its own camera with a specific type of projection. GUI textures are made sharp by turning off the anti-aliasing filter. Z buffer Each frame, the entire 3D scene is rendered, followed by the GUI and HUD layer. In between the Z Buffer is cleared, to prevent the 3D scene from interfering with the overlay. Mouse input Mouse interaction with GUI elements can be monitored using the Mouse Over and User Input channels. 2D images Pixel-perfect 2D images can be rendered onto the screen using the Copy image channel. No matter the screen resolution, the picture is always displayed in the same absolute amount of pixels. This method produces crystal clear images. Text The Text Out channel can be used to quickly write 2D text onto the screen. Debug information such as framerate and viewport resolution can easily be displayed using this method. Templates A number of ready to use GUI elements can be found in the Templates list.

Page 122: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

122

Tutor ia l

Graphic user interfaces consist of button and sliders that allow a user to influence an application. The following tutorial deals with a number of such elements. Needed Quest3D scene: • ..\Tutorials\2.7 – Graphic user interface\Graphic user interface.cgr Step by step: • Open the scene ‘Graphic user interface.cgr’. It contains a car object and an

Object Inspection Camera. Note a Quest3D logo image is overlayed on top of the scene displayed in the Animation 3D View window.

• Create a shortcut of the ‘Checkbox’ channel and connect it to the ‘Mouse Over Checkbox’ channel.

• Create a shortcut of the ‘Checkbox State’ channel and connect it to the’Rotation?’ channel, which is part of the Motion of the ‘Car’ object. Note the ‘Car’ object is located in the ‘3D Scene’ folder.

• Go to the Animation Section. • On the ‘Camera’ tab, select the ‘GUI Camera’. • In ‘Move Mode’, lock the Z position. • On the ‘Object’ tab, select the ‘Quest3D Logo’ object and move it to the lower

right corner of the screen. • Switch to Run Mode. • Hold down the right mouse button and drag the mouse to rotate around the

car object. • Click on the check box to test it. Note the car starts rotating.

Page 123: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

123

• When ready, switch to Edit Mode.

• Go to the Channels Section. • Make a shortcut of the ‘R Slider Value’ channel and connect it to the ‘R’ child

link of the ‘Emissive’ channel of the ‘Car Chassis’ surface of the ‘Car’ object. Note the ‘Car’ object is located in the ‘3D Scene’ folder.

• Go to the Animation Section. • Switch to Run Mode. • Test the ‘R’ slider by dragging it from left to right. Note the color of thecar is

affected. • When ready, switch to Edit Mode.

• Go to the Channels Section. • Connect the ‘Debug’ channel to the ‘Project’ channel. Note a number of

statistics appear on screen. • Go to the Animation Section. • Check all the statistics: framerate, viewport width and height, bump map

support and pixel shading support.

Page 124: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

124

Finished scene: • ..\Tutorials\2.7 – Graphic user interface\Graphic user interface –

Complete.cgr

Page 125: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

125

2.8 Sound and music

From simple menu click sounds to full ambient music, audio can really add to a scene. It helps to set the mood, just as sharp graphics and lively animation can. The use of spoken voice samples can help users to better understand an application. Turn off the sound while watching television or playing a computer game, and you’ll instantly miss the richness of audio. Sound can be stored digitally on the computer, in many different formats. Quest3D supports both ‘.wav’ and ‘.mp3’ files. .Wav format The Sound File channel is used to store ‘.wav’ samples within Quest3D. Its properties window contains a number of options including icons to load, play, stop and pause a sample. As the name suggests, the ‘Repeat’ option allows for continuous playback.

Speed ranges from 0% to 200%, and volume ranges from 0% to 100%. Both can be dynamically changed through their respective child links. Panning controls how the sound is divided between the left and right speaker: 0% means only the left one is used, 100% means the right one. 50% (default value) plays the sound at equal levels through both speakers.

Page 126: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

126

Sound Command The Sound Command channel allows you to control all aspects of a sample, such as playback and volume. It also allows for loading ‘.wav’ files from harddisk. The drop-down list presents all the various options. A Sound Command must be called once to be executed, and affects all its children of the Sound File channel type. 3D positioning Besides simply playing a sound, it is also possible to place it in 3D space. 3D Positioned sound requires a Listener channel. It is usually connected to the location of the virtual camera, and automatically adjusts volume, panning and frequency by calculating a sound’s relative position and distance. Only Mono sound samples can be positioned in 3D space. The ‘3D Positioning’ options of the Sound File channel define the quality of the simulation. Higher quality requires more cpu power. ‘Silent at 1/* of full volume’ is a cut-off value that was implemented for performance reasons only. The ‘Half volume every * units’ setting can be seen as the half life value of a sound. Changing this value allows you to simulate sources of different sizes. A bee sound for example might have a half life value of 0.01 units, while the volume of a plane halves every 10 units. The properties window of the Listener contains three advanced options. The ‘Doppler Factor’ describes the change in pitch when a sound moves away or towards the listener. The default value of 1.0 produces an effect similar to real world situations. The ‘Rolloff Factor’ affects the half life values of all the sounds in a scene. The default value of 1.0 produces a real world simulation, 0.0 disables roll off completely, and 2.0 exaggerates the effect. The ‘Distance Factor’ allows you to compensate for different measuring systems. If one unit in Quest3D represents one foot in your models, you can enter 0.3048 as the distance factor. 3D Sound must be configured properly in Windows. Check the ‘Sound and Audio Devices’ settings in the Control Panel. .MP3 format The ‘.mp3’ format is also supported in Quest3D. The MP3 File channel is used to store sound samples of this type. Through its properties window it is possbile to

Page 127: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

127

load a file from disk. The ‘Save File in Channelgroup’ option allows you to store the sample data inside of the channel itself. This will of course increase the file size of the channelgroup. The MP3File’s only child may also contain a file name in the form of a Text channel. The MP3 Control channel can be used to control playback and volume. It can also be used to retrieve information on total length and current playing position, and to skip to a specific position in the sample. MP3’s cannot be positioned in 3D space.

Page 128: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

128

Tutor ia l

Needed Quest3D scene: • ..\Tutorials\2.8 – Sound and music\Sound and music.cgr Needed sounds: • ..\Resources\Sounds\Bird.wav Needed templates: • Logic \ Channel Caller • Logic \ Trigger (x2) • Input \ UserInput (x2) • Sound \ Sound File • Sound \ Sound Command (x2) • Sound \ Listener Step by step: • Open the scene ‘Sound and music.cgr’. It contains a simple 3D scene and a

walkthrough camera. • Add a Sound Command channel and double click it to open its properties

window. Choose the ‘Play’ command from the dropdown list and press ‘OK’ to accept. Connect the ‘Sound Command’ channel to the ‘Play Sound’ channel.

• Drag a Sound File channel onto the Channel Graph and connect it to the Sound Command. Double click it to open its properties window. Press the Load icon , and locate the file ‘Car engine.wav’. Press ‘Open’ to accept.

• Make sure the Animation 3D View window is open. • Switch to Run Mode. • Test the scene so far by pressing the ‘Space’ key. Note the Sound Command is

triggered once, and the sound is played. • Switch to Edit Mode. • Add another Sound Command channel and connect it to the ‘Stop Sound’

channel. Set this Sound Command to ‘Stop’. Link the Sound Command to the ‘Stop Sound’ channel.

Page 129: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

129

• Connect the original ‘Sound File’ channel to this second Sound Command channel.

• Switch to Run Mode. • Test the scene so far by pressing the ‘Space’ key. After a few seconds, press

the ‘Backspace’ key. Note the sound stops playing. • Switch to Edit Mode. • Double click on the Sound File channel. From the 3D Positioning dropdown

list, select ‘Normal’. Tick the box ‘Repeat’ to play the sound continuously. • Make a shortcut of the ‘Motion’ channel of the ‘Car’ channel, and connect this

shortcut to the first child link of the Sound File channel. The sound is now connected to the location of the 3D object.

• Drag a Listener onto the Channel Graph and connect it to the ‘Audio’ channel. • Make a shortcut of the Motion of the ‘Walkthrough Camera’ channel. Connect

this shortcut to the Listener. • Make sure the Animation 3D View window displays the scene using the

Project Camera. • Switch to Run Mode. • Press ‘P’ to play the sound sample. • Use the arrow keys to move towards and away from the 3D object. Note how

the volume is affected. • Use the mouse to rotate your view. Note how the sound pans left and right

based on the relative position of the 3D object to the camera.

Finished scene: • ..\Tutorials\2.8 – Sound and music\Sound and music – Complete.cgr

Page 130: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

130

2.9 Landscapes

Virtual outdoor environments can be very rewarding to create and to visit. They can also become fairly complex rather easily, risking low framerates. This chapter discusses methods to create landscape scenery and keep them running properly by offering practical tips for optimisation. Virtual landscapes are often created as large grid-like surfaces. The height (Y-value) of the various vertices defines hills and mountains.

Height maps Most commercial 3D modeling packages such as 3D Studio Max and Maya allow you to create landscapes either directly or indirectly. A so called greyscale ‘height map’ can define the Y-value of the vertices that make up the surface: black is the lowest point, white is the top.

Page 131: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

131

Please refer to the help document of your favorite 3D modeling package for more information. Keywords: ‘height map’, ‘displace’. Textures One or more textures are then applied to the surface. The various ‘texture stages’ may be blended into each another by alpha images.

Multiple passes Chapter 2.4, ‘Surface properties’, discussed basic Quest3D blending methods. To accomplish the effect above, and make it compatible with older graphics cards, it is recommended to use multiple passes. This includes rendering a surface more than once, and blending these instances by means of transparency. Rendering a typical landscape surface could include the following passes: 1. The first layer, such as dirt (UV set 0) 2. The second layer, such as grass (UV set 0), blended by means of a seperate

alpha texture (UV set 1). 3. The light map layer, using a ‘multiply’ operation (UV set 1). Sky domes The sky in a virtual outdoor scene is often represented as a dome.

Page 132: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

132

Lighting Sunlight may be simulated by using a strong directional light. In addition, emissive values of all 3D objects in the scene may be increased, suggesting radiosity (indirect lighting). Light maps and real-time shadows can further improve an outdoor scene. See Chapter 2.5 for more information on lighting and shadows. Fog Fog can add to a mood and suggest depth. A bonus of using fog is that the far clipping plane of the camera may be decreased, resulting in higher frame rates. See Chapter 2.6 on camera’s for further information. Nature Painting Many outdoor scenes display an abundance of trees and plants. Quest3D features an advanced system called ‘Nature Painting’. It allows you to easily add hundreds of trees and plants to a scene. The Nature Painting system is optimised for performance and uses the graphics hardware of your computer to render scenes quickly and efficiently.

Page 133: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

133

The Nature Generator channel is placed between the Surface and 3D ObjectData channels of an object. It contains the position, rotation and scale of all its instances, as well as extra information applying to all instances. A collision object to paint on must be linked to the Nature Generator. The ‘Nature / Pathfinding’ Section provides easy access to all its functionality.

Page 134: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

134

Nature / Pathfinding Section Layout

Nature Painting properties Through the options of the ‘Nature Painting’ tab, it is possible to define all aspects of object placement. Rotation and size may be randomised. Objects may be placed per instance or as a group using the ‘Area’ option. The ‘Cull distance’ value can be used to cut off rendering of the Nature Paint object beyond a certain distance from the camera. The ‘Fade distance’ value can be used to blend instances into the enviroment, to mask harsh culling. Before a Nature Paint object may be faded, the transparency mode must first be set correctly. The correct setting, ‘Alpha Value and Texture’, can be found in the Object Section, on the ‘Surface’ tab. The ‘Face camera’ option can produce satisfying results, but uses a fair bit of processing power. It is recommended to only use it on simple Nature Paint objects, such as a plane displaying a grass texture. Templates Quest3D comes with a number of predefined landscape, tree and plant models. They can be used directly from the Templates menu.

Page 135: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

135

Tutor ia l

Needed Quest3D scene: • ..\Tutorials\2.9 – Landscapes\Landscapes.cgr Needed templates: • Objects \ Object Data \ Nature Generator Step by step: • Open the scene ‘Landscapes.cgr’. It contains a landscape, a grass object ready

for nature painting and a tree model. It also contains a 3D skydome and a walkthrough camera.

• Go to the Object Section. • Click on the ‘Landscape’ object from the list to select it. • Click on the ‘Dirt Layer’ surface from the list to select it. • Go to the ‘Texture Stages’ tab on the right side of the screen. • Make sure ‘Stage 1’ is selected. • Go to the ‘Textures’ tab on the right side of the screen. Note the currently

used texture is highlighted. Double click on this texture to bring up its properties window.

• Press the ‘Load’ button and locate the ‘..\Resources\Textures\Landscapes\’ folder. It contains a number of terrain type textures. Choose a dirt variant, and press ‘Open’ to accept. Note the new image is displayed in the preview window. Press ‘OK’ to close the Texture window.

• Click on the ‘Grass Layer’ surface from the list to select it. • Select ‘Stage 1’ on the ‘Texture Stages’ tab.

On the ‘Textures’ tab, double click on the highlighted texture to bring up its properties window.

• Press the ‘Load’ button and from the directory, choose a grass variant. Press ‘Open’ to accept. Note the new image is displayed in the preview window. Press ‘OK’ to close the Texture window.

• Select ‘Stage 2’ on the ‘Texture Stages’ tab. On the ‘Textures’ tab, double click on this texture to bring up its properties window.

• Press the ‘Load Alpha’ button and from the directory choose an ‘Alpha’ texture. Press ‘Open’ to accept. Press ‘OK’ to close the Texture window.

• Go to the ‘Surface’ tab on the left side of the screen.

Page 136: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

136

• Select the ‘Alpha Texture’ transparancy option. Note the two texture layers of the landscape are blended with each other now.

• Go to the Nature / Pathfinding Section. • Click on the ‘Grass Nature Generator’ object to select it. • Click on the ‘Paint Mode’ button. • Move the mouse cursor over the landscape in the Animation 3D View. Note

the object follows your mouse and is placed at the correct height on the surface underneath. Press the left mouse button to place an instance of the grass plane. Place a few more planes.

• Select the ‘Face camera’ option, as well as ‘Limit Y axis’. Note how all instances are aligned to the camera.

• Set the ‘Fade distance’ to 0 and the ‘Cull distance’ to 50. Note the further away from the camera an instance is, the more it is blended into the environment. Instances beyond 50 units are not rendered at all.

• Press the ‘Paint Mode’ button again to exit. • Go to the Channels Section. • Select and delete the link between the ‘3D Object Data’ and ‘Tree Leaves’

channels. • Add a Nature Generator channel and connect it to the ‘Tree Leaves’ channel.

Rename it ‘Tree Leaves Nature Generator’. • Connect the ‘3D Object Data’ channel to the ‘Tree Leaves Nature Generator’

channel.

Page 137: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

137

• Make a shortcut of the ‘Collision Object’ channel linked to the ‘Grass Nature Generator’ channel and connect it to the ‘Collsion Object’ child link of the ‘Tree Leaves Nature Generator’ channel. The ‘Tree’ object is now ready for painting.

• Go to the Nature / Pathfinding tab. • Click on the ‘Tree Leaves Nature Generator’ object to select it. • Press and hold the control key and click on the ‘Tree Trunk Nature

Generator’ object to add it to the selection. • Click on the ‘Paint Mode’ button. • In the ‘Paint sizing options’ menu, set the ‘randX’, ‘randY’ and ‘randZ’ values

to 0.5. Place a few trees. Note how they vary in size. • Select the ‘Area’ option, set the ‘Size’ to 250 and the ‘Density’ to 15%. Place a

few more trees with a single click. • Press the ‘Paint Mode’ button again to exit. • Go to the Animation Section. • Make sure the Animation 3D View displays the scene using the Project

Camera. • Switch to Run Mode. • Test the scene by walking through the landscape using the arrow keys and

mouse.

Finished scene: • ..\Tutorials\2.9 – Landscapes\Landscapes – Complete.cgr

Page 138: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

138

2.10 Particle systems

Many special effects in movies and games, such as fire, smoke, explosions and all kinds of magical effects, have one thing in common: they are all created using so called ‘particle systems’.

A particle system is a collection of objects released from an emitter and usually moved and changed over time. Particles are square objects facing the camera.

Motion For every particle in the system, the position, rotation and size is stored. In addition, other attributes such as speed, color and transparency may be used. Forces such as gravity may be applied to all particles in the system. Emitters Particles are released from an emitter. In Quest3D, this is in the form of an 3D Object Data channel. The particle system cycles through all of the vertices in the

Page 139: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

139

object and constantly emits a particle from one of these positions. By randomly placing a number of vertices in 3D space, it appears as if the particles are released randomly as well. This produces convincing results for special effects such as fire and smoke. Surface properties The looks of a particle system are defined by the diffuse and alpha textures used on the square objects. See Chapter 2.4 for more information of Surface properties and blending methods. Types Quest3D comes with two particle systems. The Particle Object channel is the compact variant, and can be used for simple effects such as fire. The advanced particle system consists of a number of channels and can be used to for example simulate smoke that stays within a collision object. The advanced particle system allows for greater control of attributes such as speed, rotation, size and color. Envelopes describing the desired functions may be connected to the Particle Emitter channel. The ‘Advanced Function Base’ Value is used as index for each of these Envelopes. Particle Flow Grid A Particle Flow Grid channel can be used to control the flow of the system. It divides a collision object into several parts and calculates forces inside of each of these. Forces can be created by the collision object, external objects and the particles themselves.

Page 140: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

140

Particle collision is calculated as point collision. Therefore, particle squares may stick through their collision objects. It is good practice to use smaller versions of the actual objects themselves as collision objects. Also, as always, simplified collision objects result in higher performance. Reference Manual The various channels of the advanced particle system are described in greater detail in the Quest3D Reference Manual.

Page 141: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

141

Tutor ia l

Needed Quest3D scene: • ..\Tutorials\2.10 – Particle systems\Particle systems.cgr Needed templates: • Objects \ Particles \ Simple \ Small Fire • Objects \ Particles \ Advanced \ Smoke • Objects \ Particles \ Helpers \ Particle Flow Grid • Objects \ Collision \ Collision Object • Variables \ Value \ Value • Variables \ Vector \ Vector with Envelopes Step by step: • Open the scene ‘Particle systems.cgr’. It contains a dome object environment

and an invisible, smaller collision object. • Drag a Small Fire template onto the Channel Graph and connect it to the

‘Render Scene’ channel. Note the fire effect is instantly visible in the Animation 3D View window.

• Add a Smoke template and connect it to the ‘Render Scene’ channel. Note the smoke effect is instantly visible in the Animation 3D View window. Also note the smoke particles move freely through the surfaces of the environment.

• Change the Y-value of the position vector to ‘1.0’. • Drag a Particle Flow Grid channel onto the Channel Graph and connect it to

the ‘Particle Emitter’ channel of the ‘Smoke’ object. • Add a Collision Object channel and connect it to the ‘Particle Flow Grid’

channel. • Connect the ‘Interior Collision Object’ channel to the Collision Object channel. • Double click on the ‘Particle Flow Grid’ channel to open its properties

window. Fill in ‘10’ for the ‘x’, ‘y’ and ‘z’ components of the ‘Resolution’. Select the ‘Show Grid’ option and press the ‘Generate Grid’ button. Note a grid is displayed in the Animation 3D View window (when the ‘Dynamic objects’ option is on’). Press ‘OK’ to accept.

• Double click on the ‘Particle Emitter’ channel to open its properties window. On the ‘Grid’ tab, select the ‘Particles Are Affected By Grid’ option. Note the smoke particles in the Animation 3D View are affected by the grid. Press ‘OK’ to accept.

Page 142: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

142

• Drag a Value channel onto the Channel Graph and connect it to the

‘Advanced Function Base’ child link of the ‘Particle Emitter’ channel. Rename the Value to ‘Advanced Function Base’.

• Add a Vector (using envelopes) template and connect it to the ‘Particle Color Function’ child link of the ‘Particle Emitter’ channel. Rename the Envelopes to ‘Red’, ‘Green’ and ‘Blue’, respectively.

• Create a shortcut of the ‘Advanced Function Base’ channel and connect it to each of the three Envelopes you just added.

• Double click on the ‘Red’ Envelope to open the properties window. Add a key at position (0, 0.5) and press ‘OK’ to accept.

• Double click on the ‘Green’ Envelope to open the properties window. Add a key at position (0, 0.5) and press ‘OK’ to accept.

• Double click on the ‘Green’ Envelope to open the properties window. Add a key at position (0, 0.5). Also add a key at position (50, 0) and press ‘OK’ to accept. Note that the particles will turn blue during their individual lifetimes.

Finished scene: • ..\Tutorials\2.10 – Particle systems\Particle systems – Complete.cgr

Page 143: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

143

2.11 Character animation

Chapter 2.2 explained basic 3D Object animation. In this chapter, an advanced form will be discussed: character animation. Humans and animals don’t simply slide when they move. Instead they use various parts of their body independently of each other. But rather than a collection of seperate limbs, these are all moving in relation to one another. When one of the limbs is moved, the skin stetches along with it. Virtual skeletons 3D models can be set up to behave in a similar manner. The polygon surface of the model can be seen as the skin. A virtual skeleton can be used to animate various parts of this skin seperately. Practically speaking, each of the vertices of a 3D model must be linked to the appropriate bones of a virtual skeleton.

Advanced modeling software packages such as 3D Studio Max ship with pre-made virtual skeletons. These can be linked directly to your own character, or adjusted and expanded if needed. Please refer to the manual of your favorite modeling program to learn more about working with virtual skeletons. Keywords: ‘bone’, ‘animation’, ‘biped’.

Page 144: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

144

Character animation in Quest3D Virtual skeleton animation data can be imported into Quest3D. A 3D model with bone animation will result in a nearly standard 3D Object channel structure. However, two channels are added.

The Skinned Character channel is placed between the Surface and the 3D Object Data channel. It contains the definition of the virtual skeleton, and information on how the 3D model is connected to the virtual skeleton. The Motionset channel contains all bone animation data in the form of keyframes for position, rotation and scale. The animation can be played by linking a value to the first child link of the Motionset (for example, a TimerValue). Switching Motionsets Characters in a scene are likely to have more than one animation. At any given point in time, they may stand still, walk, run or use an object for example. One approach to alter between animations is to use a Channel Switch. Based on an index value, one of the Motionsets is selected.

Page 145: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

145

Motionset Blender The solution above results in harsh transitions. To make animations transition more smoothly, the Motionset Blender can be used. This channel accepts two Motionsets and one Value. This value defines how much of the two sets is displayed. A value of 0 means only the first Motionset is used, while a value of 1 means only the second is used. A value between 0 and 1 effectively blends both sets through linear interpolation.

The image below shows 100% walk, 50% walk and sit, and 100% sitting respectively.

Page 146: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

146

The blend value of a Motionset Blender can be derived from any kind of information used elsewhere in a Quest3D program. Envelope channels can be used to convert any value to the required range of 0 to 1. Example blend values include User Input and object speed.

Value Damping A compact and inexpensive way to animate the transition from 0 to 1 and vice versa is by using a Value Damping channel.

Page 147: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

147

Tutor ia l

The following exercise explains importing character animation into Quest3D. It also describes motionset blending. Needed .X files: • ..\Resources\Characters\Animated character – Idle.X • ..\Resources\Characters\Animated character – Walk.X Needed templates: • Scene \ Start 3D Scene • Scene \ Render Camera Light • Timing \ TimerValue • 3D Items \ Object Data \ Motionset Blender • Variables \ Value \ Value Damping • Logic \ User Input \ User Input Step by step: • From the File Menu, choose ‘Import’. • Locate the file ‘..\Resources\Characters\Animated character – Idle.X’ and

press ‘Open’. • Use ‘Character animation 1’ as Pool name, and press ‘OK’ to confirm. • In the ‘X Object Importer Options’ window, choose ‘Load as indexed

character’, and press ‘OK’ to accept. The 3D character model is imported into Quest3D.

Page 148: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

148

• Rename the channel of type 3D Object to ‘Animated Character’. • Drag a Start 3D Scene channel onto the Channel Graph. Right-click it and

choose ‘Set as start channel’. • Add a Render Camera Light template and connect the ‘Render’ channel to the

‘Start 3D Scene’ channel. • Connect the ‘Animated Character’ channel to the ‘Render’. Note it is

displayed in the Animation 3D View window. • Rename the ‘Motionset’ channel to ‘Idle Motionset’. • Drag a Timer Value onto the Channel Graph and attach it to the ‘Idle

Motionset’ channel. Double click on the ‘Timer Value’ channel, select ‘New..’ from the drop-down list, and type in ‘Animated Character Idle’ in the edit box. Press ‘OK’ to accept, and close the properties window.

• Go to the Animation Section. • Make sure the Animation 3D View displays the scene using the Project

Camera. • Choose ‘Animated Character Idle’ from the timer drop-down list. Set the end

frame to ‘450’ and press the Play button . Note the character starts animating.

Page 149: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

149

• Go to the Channels Section. • Delete the link between the ‘Idle Motionset’ and ‘Skinned Character’

channels. • Add a Motionset Blender and connect it to the ‘Skinned Character’ channel. • Connect the ‘Idle Motionset’ to the Motionset Blender. • Import the file, ‘Walk.X’ using the same procedure as above. • Locate the ‘Motionset’ channel of the newly imported group, and copy it. • Switch to the main channel group. • Paste the Motionset onto the Channel Graph. • Rename this Motionset to ‘Walk Motionset’ and connect it to the second child

link of the ‘Motionset Blender’ channel. • Drag another Timer Value channel onto the Channel Graph and connect it to

the ‘Walk Motionset’ channel. • Set this Timer Value to a new timer called ‘Animated Character Walk’ • Drag a Value Damping onto the Channel Graph and connect it to the third

child link of the ‘Motionset Blender’ channel. • Add a User Input channel and connect it to the ‘Value Damping’ channel. Set

the User Input channel to the Arrow Up key.

Page 150: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

150

• Go to the Animation Section. • Choose ‘Animated Character Walk’ from the timer drop-down list. Set the

end frame to ‘27’ and press the Play button . • Switch to Run Mode. • Test the scene so far by pressing the arrow up key. Note how the Value

Damping increases from ‘0’ to ‘1.0’ over time. Note how the 3D character animation blends from idle to walk.

• Release the arrow up key. Note how the Value Damping decreases from 1 to 0 over time. Note how the 3D character animation blends from walk to idle.

• Switch to Edit Mode. Finished scene: • ..\Tutorials\2.11 – Character animation\Character animation 1 – Complete.cgr If you wish, you can save the current channel group to your project directory. The following steps deal with a new scene.

Page 151: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

151

Needed Quest3D scene: • ..\Tutorials\2.11 – Character animation\Character animation 2.cgr Needed .X files: • ..\Resources\Characters\Animated character – Idle.X • ..\Resources\Characters\Animated character – Walk.X • ..\Resources\Characters\Animated character – Run.X Needed templates: • Variables \ Value \ Value Damping • Variables \ Value \ Envelope (x2) Step by step: • Open the file, ‘Character animation 2.cgr’. It contains a simple scene, a

character with multiple animations, and a 3rd person camera. • Go to the Animation Section. • Make sure the Animation 3D View displays the scene using the Project

Camera . • Switch to Run Mode. • By using the arrow keys and the mouse, move the character through the

scene. Note the camera stays behind the character. Note the character doesn’t animate properly yet and only displays its idle sequence.

• Switch to Edit Mode. • Go to the Channels Section. • Drag a Value Damping template onto the Channel Graph and link it to the

‘Motionset Blender’ channel connecting the ‘Idle’ and ‘Walk’ channels. • Add an Envelope channel and connect it to the ‘Value Damping’ channel. • Make a shortcut of the ‘Character Speed’ channel (part of the Collision

Response system) and connect it to the Envelope. • Double click on the Envelope. Add a point at (0, 0). This point means that

when the character speed (input) is 0, the Motionset Blender will fully use the ‘Idle’ animation.

• Add a point at (0.02,1), meaning that when the character speed is 0.02, the Motionset Blender will fully use the ‘Walk’ animation. A speed between 0 and 0.02 will result in a blend of 0 to 1 between the ‘Idle’ and ‘Walk’ animations.

• Switch to Run Mode. • Test the scene so far by pressing the arrow up key. Note the ‘Character

Speed’ channel changes in value. Note the character animation blends from ‘Idle’ to ‘Walk’.

Page 152: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

152

• Release the arrow up key. Note how the ‘Character Speed’ channel changes in value. Note the character animation blends from ‘Walk’ to ‘Idle’.

• Switch to Edit Mode. • Add another Envelope and link it to the Value Damping channel connected to

the Motionset Blender binding the ‘Walk’ and ‘Run’ channels. • Make another shortcut of the ‘Character Speed’ channel and connect it to this

new Envelope. • Double click on the Envelope. Add points at (0.25, 0) and (0.5, 1). • Go to the Animation Section. • Switch to Run Mode. • Test the scene by pressing the arrow up key. Note the character starts

walking. • Press and hold both the arrow up key and the shift key. Note the speed is

increased and the character starts running.

Finished scene: • ..\Tutorials\2.11 – Character animation\Character animation 2 – Complete.cgr

Page 153: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

153

Part III: Programming Part I introduced the basic concepts of Quest3D. This part takes a closer look at the the way Quest3D programs work. Chapter 3.1: Logic This chapter describes the concept of logic, the flowchart of a project. Chapter 3.2: Math Values in a Quest3D project often change. Regular math can be used to calculate new values. Chapter 3.3: For Loop A For Loop executes a specific part of a program a number of times each frame. Chapter 3.4: Arrays Arrays can store multiple instances of a specific type of information. Chapter 3.5: Multiple channel groups Advanced Quest3D programs may be complex projects. At a certain point it might be practical to split a program into seperate parts. Chapter 3.6: Mathematical operators The so called Operator channels in Quest3D allow you to affect each of the variable types dynamically in real-time. Chapter 3.7: Pathfinding Characters might have to stop in front of traffic lights, open bridges or respond to each other. Pathfinding allows for such dynamic route planning. Chapter 3.8: Finite State Machine To simplify switching between subprograms in more complex structures, the Finite State Machine channel can be used.

Page 154: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

154

3.1 Logic

In Quest3D, logic is the flowchart of a program. Logic describes what happens and when it happens. Examples of logic: • An object that is or is not displayed on screen. • A door that opens by pressing a key. • A music sample triggered on a timed event. • A current application screen based on a menu selection. A number of Quest3D channels are specifically designed for adding logic to a program. The most important of these logic channels will be discussed in this chapter. Channel Caller As their name implies, Channel Callers simply call the channels linked to them. They are used to add structure to a project. Channel Callers can be seen as dividers, or even ‘chapters’ in a Quest3D program. The image below shows an example of a program structure divided by Channel Callers.

Channel Callers should be named properly and used often.

Page 155: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

155

If Just like the Channel Caller, the If channel calls its children. The If channel only calls its children, however, if a certain condition is met. This condition can be linked to the first child link square of the Ifchannel, and must be a value. Only if the value is not ‘0’ (the condition is ‘true’), the channel connected to the Ifchannel is called.

If Else The IfElse channel is similar to the Ifchannel. If the attached condition is not met (i.e. the value equals ‘0’), the channel connected to the third child link is called. If the condition is met the channel connected to the second child link is called.

Triggers Trigger channels work in a way similar to Ifchannels. Triggers also call their children based on a condition.

Page 156: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

156

There are two major differences between Ifand Trigger channels. First, when a condition is met, Triggers only execute their children once. For a Trigger to activate again, the condition will first have to become false, and then true again. Example: a trigger is set off by pressing the spacebar. To set it off a again, the spacebar must first be released, then pressed once more. The second difference concerns the input for the condition. Besides in the form of a ‘0’ or ‘1’, it can also be one of the other options listed in the properties window:

User Input The User Input channel can register activity from a number of sources such as keyboard and mouse. In Quest3D, user input results in one of three types: • A binary value of ‘0’ or ‘1.0’.

Example: a key or mouse button press.

Page 157: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

157

• An analog value from ‘0’ to ‘1.0’. Example: joystick movement.

• A screen coordinate value. Example: mouse movement.

User input can serve as condition value for both If(Else) and Trigger channels. Any key on the keyboard can be ‘binded’ to a User Input channel through its properties window. After clicking the ‘Capture a key to use’ button, press the key of your choice. In a similar way, any mouse or joystick button and movement can be registered.

Channel Switches Channel Switches allow you to choose between different channels of almost any type. A Channel Switch must fist be set to the same base type as its children.

Page 158: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

158

Next, its first child defines which of the linked versions is used: a value of ‘0’ results in the first variant being used, ‘1’ in the second, etc.

Page 159: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

159

Tutor ia l

Logic in Quest3D defines the flowchart of your project. This tutorial is an exercise in structuring a program using Channel Callers, and in working with conditions. Conditions serve as input for Ifand Trigger channels. After completing this tutorial, you should have a better understanding of logic in Quest3D. Needed templates: • 3D Items \ Start 3D Scene • Logic \ Channel Caller (x6) • Logic \ if • Logic \ Trigger • Input \ Input: Arrow left • Input \ Input: Arrow right • Scene \ Render, Camera, Light • 3D Items \ Box Step by step: • Drag the Start 3D Scene onto the Channel Graph. Right-click it and choose

‘Set as start channel’. • Add a Channel Caller and connect it to the ‘Start 3D Scene’ channel. • Rename this Channel Caller to ‘Program’. • Drag five more Channel Callers onto the Channel Graph. Rename them as

follows: ‘Logic’, ‘User Interface’, ‘3D Scenes’, ‘Scene 1’ and ‘Scene 2’. • Think about a logical structure and connect these five Channel Callers to your

program. • When ready, examine the channel structure in the image below to see if your

own solution looks similar.

Page 160: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

160

Currently, ‘Scene 1’ and ‘Scene 2’ are both called. The following steps will add logic to displaye one or the other, based on keyboard input. • Disconnect the link between the ‘Scene 1’ and ‘3D Scenes’ channels. • Add an Ifchannel and connect it to the second child link of the ‘3D Scenes’

channel. • Connect the ‘Scene 1’ channel to the second child link of the ‘if’ channel. Note

the ‘Scene 1’ channel is not called actively (no blue line is visible). • Drag a Value onto the Channel Graph and connect it to the first child of the

‘if’ channel. This Value will be the condition for the if. • Change the value of this Value channel to ‘1’. Note the ‘Scene 1’ channel is

called actively. • Change the value of the Value channel back to ‘0’. Note the ‘Scene 1’ channel

is no longer called. • Select the ‘Value’ channel and delete it. • Add a User Input channel and connect it to the first child link of the ‘if’

channel. The current channel structure should look similar to the one in the image below.

Page 161: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

161

• Double click on the ‘User Input’ channel to open its properties. Click on the ‘Capture a key to use button’ and press the ‘1’ key to bind it. Press the ‘OK’ buttont to accept.

• Switch to Run Mode by pressing the button. • Press and hold the ‘1’ key. Note the ‘Scene 1’ channel is called. • Release the ‘1’ key. Note the ‘Scene 1’ channel is no longer called.

• Switch to Edit Mode. • Select and delete the ‘if’ channel. • Select and delete the link between the ‘Scene 2’ and ‘3D Scenes’ channels. • Drag an IfElse channel onto the Channel Graph and connect it to the ‘3D

Scenes’ channel. • Connect the ‘User Input’ channel to the first child link of the ‘If Else’ channel. • Connect the ‘Scene 1’ channel to the second child link of the ‘If Else’ channel.

Note the ‘Scene 1’ channel is not called. • Connect the ‘Scene 2’ channel to the third child link of the ‘If Else’ channel.

Note the ‘Scene 2’ channel is called. The current channel structure should look similar to the one in the image below.

Page 162: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

162

• Switch to Run Mode. • Press and hold the ‘1’ key. Note the ‘Scene 1’ channel is called and the ‘Scene

2’ channel is not. • Release the ‘1’ key. Note the ‘Scene 1’ channel is no longer called and the

‘Scene 2’ channel is. • Switch to Edit Mode. • Add a Trigger channel and connect it to the ‘User Interface’ channel. • Drag a User Input channel onto the Channel Graph and connect it to the first

child link of the ‘Trigger’ channel. • Add a Channel Caller and connect it to the second child link of the ‘Trigger’

channel. Rename the Channel Caller to ‘Event’. • Switch to Run Mode. • Press the spacebar. Note the ‘Event’ channel is called once. • Press the spacebar again. Note the ‘Event’ channel is called once again. • Switch to Edit Mode. • Select and delete the ‘User Input’ channel that is connected to the ‘If Else’

channel. • Select and delete the ‘If Else’ channel. • Drag a Channel Switch channel onto the Channel Graph and connect it to the

‘3D Scenes’ channel.

Page 163: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

163

• Double click on the ‘Channel Switch’ channel to open its properties window. From the list, select ‘Channel Caller’ and press the ‘Set’ button. Press ‘OK’ to accept.

• Add a Value channel and connect it to the first child link of the ‘Channel Switch’ channel. Rename the Value to ‘Current Scene’.

• Drag a Channel Caller onto the Channel Graph and connect it to the second child link of the ‘Channel Switch’ channel. Rename this Channel Caller to ‘Menu’. Note the ‘Menu’ channel is currently called.

• Connect the ‘Scene 1’ channel to the third child link of the ‘Channel Switch’ channel.

• Connect the ‘Scene 2’ channel to the fourth child link of the ‘Channel Switch’ channel.

• Change the value of the ‘Current Scene’ to ‘1’. Note the ‘Scene 1’ channel is called.

• Change the value of the ‘Current Scene’ to ‘2’. Note the ‘Scene 2’ channel is called.

Finished scene: • ..\Tutorials\3.1 – Logic\Logic – Complete.cgr

Page 164: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

164

3.2 Math

Values are at the heart of any Quest3D project. They are used to define an object’s color, position and size for example. Values can also describe scores, program settings, menu option etc. Values in a Quest3D project often change. Regular math can be used to calculate new values. Set Value The following statement describes a standard expression in regular math.

Old value = New value

In Quest3D, the above statement must be translated to the following.

Copy New value into Old value

To copy one value into one another, the Set Value channel is used.

In most practical cases Set Value channels need to be carried out only once. Therefore, they are often called by Trigger channels.

Page 165: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

165

Expression Value Mathematical expressions can be described in Quest3D using the Expression Value channel. It serves as an advanced calculator. Its properties window contains a box for the actual formula, and help text describing all the usuable variables and operators. The Reference Manual explains each of these elements in greater detail.

The actual value of an Expression Value is equal to the result of the expression inside of the channel. This result is also displayed under ‘Current Value’ in the properties window.

Page 166: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

166

Brackets ( ) can be used to define priority of one part of the expression over the other. The two expressions in the image below are not the same and therefor do not produce the same result.

Values connected to the child links of the Expression Value can be used as part of the expression within the channel as well. The first child is presented by the letter ‘A’, the second by the letter ‘B’, and so forth.

Page 167: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

167

The Expression Value channel can be named after its expression by choosing the ‘Rename Channel to formula’ option in the properties window.

The following example demonstrates an often used combination of a Set Value, Expression Value and Value channel.

In the example above, every time the spacebar is pressed, ‘1’ is added to the ‘Value’ channel.

Expression Values can also serve as condition input for If and Trigger channels. In the image below, the structure should be read as ‘if A equals B then execute the following channels’.

Page 168: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

168

In the image on the right, the condition ‘A == B’ is met. Multiple expressions can be linked to oneanother within the same channel using the logical operators AND ( && ) and OR ( || ).

In the image above, the condition is met if ‘A==1 && B==2’. The expression should be read as, ‘if A equals one and B equals two’. Expressions can also contain conditions in the form of If Else statements. In the image below, the expression ‘A==B ? C : D’ should be read as ‘if A equals B then the result is C else the result is D’.

Page 169: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

169

In the image on the right, the condition ‘A==B’ is met. The result of the expression is the value of ‘C’. Envelopes Besides playing an important role in animation, Envelopes have other uses as well. A graph in an Envelope channel is a two dimensional mathematical function. For advanced simulations and models, actual formula’s may be used by inserting a number of coordinate pairs into the graph. Quest3D will handle the interpolation between these points.

The envelope graph in the image above shows the formula ‘y = x²’. One quantity can be converted to another by means of an Envelope. Put differently, an Envelope describes the relation between two values.

Page 170: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

170

Character motionset blending may be handled based on walking speed. The graph in the image above scales speed input values between ‘0’ and ‘5.0’ to blending output values between ‘0’ and ‘1.0’. The graph is non-linear. Envelopes can also be used to limit the range of a value.

The graph in the image above limits input values to output values between ‘-1’ and ‘1’.

Page 171: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

171

Tutor ia l

Math is an important aspect of many Quest3D programs. This tutorial is an exercise in working with the following channels: Value, Set Value, Expression Value and Envelope. Needed Quest3D scene: • ..\Tutorials\3.2 – Math\Math.cgr Needed templates: • Variables \ Value \ Set Value • Variables \ Value \ Expression Value • Variables \ Value \ Value • Step by step: • Open the scene, ‘Math.cgr’. It contains a simple logic structure. • Drag a Set Value channel onto the Channel Graph and connect it to the

second child link of the Trigger. • Add a Value channel and connect it to the first child link of the ‘Set Value’

channel. • Change the value of this Value channel to ‘1’. • Drag another Value channel onto the Channel Graph and connect it to the

second child link of the ‘Set Value’ channel. Rename this Value to ‘Current Value’.

Page 172: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

172

• Switch to Run Mode. • Press the spacebar. Note the ‘Set Value’ channel is triggered once. Also note

the value of the first Value channel is copied into the second Value channel. Both are now ‘1’.

• Switch to Edit Mode. • Add an Expression Value channel and connect it to the ‘Calculations’ channel. • Double click on the ‘Expression Value’ channel to open its properties

window. • In the ‘Expression’ field, enter ’1’. Note the ‘Current Value’ now equals ‘1’.

Also, the value of the ‘Expression Value’ channel is ‘1’.

Press ‘OK’ to accept.

• Drag a Value channel onto the Channel Graph and change its value to ‘3’. Connect it to the ‘Expression Value’ channel.

• Double click on the ‘Expression Value’ channel to open its properties window.

• In the ‘Expression’ field, enter ‘A’, referring to the Value attached as a child. Note that the ‘Current Value’ now equals ‘3’. Also, the value of the ‘Expression Value’ channel is ‘3’.

Page 173: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

173

• Select and delete the Value channel connected to the first child link of the ‘Set Value’ channel.

• Add another Expression Value channel and connect it to the first child link of the ‘Set Value’ channel.

• Connect the ‘Current Value’ channel to this ‘Expression Value’ channel. • Double click on the ‘Expression Value’ channel to open its properties

window. In the ‘Expression’ field, type in the following formula: ‘A + 1’. • Select the ‘Rename Channel to formula’ option and press ‘OK’ to accept.

• Switch to Run Mode. • Press the spacebar. Note the value of the ‘Current Value’ channel is increased

by one (‘1 + 1 = 2’) • Press the spacebar again. Note the value is increased again (‘2 + 1 = 3’). • Switch to Edit Mode. • Change the formula in the Expression Value to ‘A < 4 ? A + 1 : 0’. Note that

this formula should be read as ‘if A is smaller than four, the result is A plus one, else the result is zero’.

• Switch to Run Mode. • Press the spacebar. Note the ‘Current Value’ is now 4. • Press the spacebar again. Note the ‘Current Value’ is now 0. • Add a User Input channel add connect it to the ‘Calculations’ channel. • Double click on this ‘User Input’ channel to open its properties window.

From the first drop-down list, select ‘Mouse Information. From the second drop-down list, select ‘Mouse Screen Pos X’. Press ‘OK’ to accept.

Page 174: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

174

• Switch to Run Mode. • Move the mouse from left to right. Note the value of the ‘User Input’ channel

changes. The maximum value depends on the resolution of your monitor. • Switch to Edit Mode. • Select and delete the link between the ‘User Input’ and the ‘Calculations’

channel. • Drag an Envelope channel onto the Channel Graph and connect it to the

‘Calculations’ channel. • Connect the ‘User Input’ channel to the ‘Envelope’ channel. • Double click on the ‘Envelope’ channel to open its properties window. Create

keys at (0, 0) and (500, 1). Click on the ‘All’ button to view the entire graph.

• Press ‘OK’ to accept. • Switch to Run Mode. • Move the mouse from left to right. Note the value of the ‘Envelope’ channel

changes between ‘0’ and ‘1.0’. • Switch to Edit Mode. Finished scene: • ..\Tutorials\3.2 – Math\Math – Complete.cgr

Page 175: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

175

3.3 For Loop

Advanced real-time interactive scenes may consist of hundreds of elements. If set up inefficiently, such scenes might demand too much from the graphics hardware. Also, project management may get out of hand. Without a proper structure, management of so many assets may become too complex to handle. Many objects in a scene share one or more attributes with one another. During the design phase of a project, it is recommended to consider which groups of objects can be distiguished. For example, consider an application that allows the user to decorate his or her virtual home. The various types of furniture available might look differently from one another, but they are all 3D objects. More over, the user might be able to move, rotate and scale each of these types and place them into the virtual scene. These attributes are shared by the group ‘furniture’. For Loop Just like many other programming languages, Quest3D features a so called ‘For Loop’ function. A For Loop executes a specific part of a program a number of times each frame. Only when all ‘iterations’ of a For Loop have been executed will the program continue to the next part.

Page 176: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

176

In the image on the previous page, ‘Part 1’ is processed first. Next, ‘Part 2’ is executed 10 times by the For Loop function. Finally, the program moves on to ‘Part 3’. A driving simulation might require fifty cars in a scene. Instead of having fifty seperate car objects, using a For Loop allows you to create a single car object and render it fifty times, with differences in position, shape, color and even handling. Updates per frame Quest3D normally updates a channel only once per frame. This is for performance and safety reasons. Channels in a For Loop need to be updated multiple times per frame. The update setting for such channels needs to be set to ‘Continuous’. The ‘Continuous’ update option is located in each channel’s ‘General Properties’ window.

Page 177: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

177

Channels set to ‘Continuous’ can be recognised by a mark.

Page 178: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

178

The ‘Max Iterations’ child of a For Loop channel defines the total number of times the subprogram is carried out. The ‘Current Iteration’ Value can be used to create variations in the various instances in the ForLoop. A simple example is varying the X coordinate per object instance.

Expressions The relation between the ‘Current Iteration’ and the ‘Max Iterations’ Values can be used as well. In the image below, the Expression Value ‘(A+1) / B’ results in a gradient from ‘0.2’ to ‘1.0’.

Page 179: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

179

Rendering scenes It is good practice to keep the number of channels in a For Loop routine as small as possible. Instead of calling a Render complete with Camera and Lights multiple times per frame, it is better to only loop the objects themselves.

Page 180: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

180

In the image above, the Camera and Light are called once just prior to the For Loop. The objects are called mulitple times, with variations based on the ‘Current Iteration’ Value. Finally, the Light is called one more time to switch it off, so it will not influence other renders. Nature painting versus For Loops As discussed in Chapter 2.9, Nature Painting is also designed for rendering large numbers of 3D objects in a scene. Nature Painting is very fast because of optimised hardware use, but is specifically meant for static elements. Dynamic objects should always be rendered using a For Loop.

Page 181: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

181

Tutor ia l

This tutorial uses a For Loop structure to render a number of cars on screen. Needed templates: • Scene \ Start 3D Scene • Logic \ Channel Caller • Scene \ Cameras \ Object Inspection Camera • Scene \ Light \ Point Light • Logic \ For Loop • 3D Models \ Car • Variables \ Value \ Expression Value (x2) Step by step: • Start a new project. • Drag a Start 3D Scene onto the Channel Graph. Right click on this ‘Start 3D

Scene’ channel and choose ‘Set as start channel’. • Add a Channel Caller and rename it to ‘Scene’. Connect it to the ‘Start 3D

Scene’ channel. • Drag an Object Inspection Camera template onto the Channel Graph and

connect it to the ‘Scene’ channel. • Close the Animation 3D View window by pressing the ‘Groups’ tab. • Add a Point Light template and connect it to the ‘Scene’ channel. • Drag a ForLoop template onto the Channel Graph and connect it to the ‘Scene’

channel. • Change the value of the ‘Max Iterations’ channel to ‘5’. • Add a Car template and connect it to the For Loop channel. • Make a shortcut of the Point Light channel and connect it to the ‘Scene’

channel. The light will now be switched off after rendering each frame so it will not affect other renders.

Page 182: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

182

• Press the ‘Animation 3D View’ tab to examine the scene so far. Note only one car is visible.

• Delete the ‘Val X’ channel of the car’s ‘Position’ Vector. • Drag an Expression Value onto the template and connect it to the first (free)

child link of the ‘Position’ channel. • Make a shortcut of the ‘Current Iteration’ channel and connect it to the

‘Expression Value’ channel. • Double click on the ‘Expression Value’ channel and type in the formula, ‘A *

3’. Select the ‘Rename Channel to formula’ option an press ‘OK’ to accept. • Right click on the ‘A * 3’ channel and choose ‘General Properties’. In the

properties window, select the ‘Continuous’ option. This channel will be updated multiple times per frame now. Press ‘OK’ to accept.

• Also set the ‘Position’, the ‘Motion’ and the ‘Car’ channels to ‘Continuous’ update. Note that all these channels need to be updated for every instance in the For Loop. Note after the last is set to ‘Continuous’, five cars are displayed in the Animation 3D View window.

• Switch to Run Mode. • Orbit around the cars to examine them.

Page 183: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

183

• When ready, switch to Edit Mode. • From the car’s ‘Car 1’ surface, delete the ‘R’ Value of the ‘Emissive’ Vector. • Add an Expression Value and rename it to ‘Gradient’. Connect it to the first

(free) child link of the ‘Emissive’ channel. Note the color of the cars changes. • Make a shortcut of the ‘Current Iteration’ channel and connect it to the

‘Gradient’ channel. • Make a shortcut of the ‘Max Iterations’ channel and connect it to the second

child link of the ‘Gradient’ channel. • Set the ‘Gradient’ channel and the ‘Emissive’ and ‘Material’ channels above it

to ‘Continuous’ udate. • Double click on the ‘Gradient’ channel and type in the formula, ‘(A+1) / B’.

Press ‘OK’ to accept. Note the colors of the cars change, from turquoise to light grey.

Page 184: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

184

Finished scene: • ..\Tutorials\3.2 – Advanced logic\Advanced logic – Complete.cgr

Page 185: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

185

3.4 Arrays

Variables can store specific types of information. The most often used types of variables in Quest3D are value, vector, matrix and text. They can all contain a single instance of their type. A Value channel for example, can store exactly one value. Arrays can store multiple instances of a specific type of information. Each of these instances or records has a fixed place inside of the array, and may be accessed using an index value.

Tables Arrays in Quest3D are always part of a table. Array Table channels need to be called at least once in a project to initialise. Calling an Array Table continously has no negative effect on a Quest3D program – it is still initialised only once. The properties window of the Array Table channel allows for adding and configuring columns.

Page 186: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

186

Column names can be changed at any time – they are only used as labels. Two arrays with the same name are not joined. Avoid duplicate names at all times to avoid problems. The ‘Move Up’ and ‘Move Down’ buttons affect the order in which the columns are listed, in both the properties window of the Array Table and the Array Manager window (described later in this chapter). Data types Array columns can store data of several types. Apart from the variable types mentioned above (value, vector, matrix and text), it is also possible to create an array of virtually any channel in Quest3D. These are defined by selecting a type from the ‘Array Channel’ drop-down list.

Page 187: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

187

Examples of this last category include arrays of type 3D Object or Texture. An advanced use could be an array of Network Values. Note that column types must be committed by pressing the ‘Set’ button. Data storage and references Data is stored in Array Table channels. To access and use the data in a Quest3D project, references are needed. Several types of reference channels exist, one for each column type. An Array Value channel for example is optimised for exactly that data type. The properties window of the several Array channels is used to specify which table and which column a reference should access. Note that the table column for an Array Channel can be set only once, because of its Channel Switch-like nature. Setting Arrays To store a value in an array, the ‘Set’ operator of the appropriate type is used. By linking an index value, the desired record inside the array is specified.

Note that the Array Channel has two child link squares. The first is the index value. The second can be used to connect a channel of the appropriate type to. Its children will then be passed along to the Array Channel.

Page 188: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

188

Array Manager The Array Manager in Quest3D shows the content of all arrays in a project, per table. It can be accessed by pressing the ‘Array Manager’ tab in the Channels and Animation Sections, or by switching to the Arrays Section.

One square in the Array Manager is called a record or a field. Records of type value allow for direct input. Records of type text can be edited either directly (click once on the ‘T’ icon), or through the properties window (double click on th ‘T’ icon).

Page 189: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

189

Clicking on other fields will open a properties window of the appropriate type, if it is available for that channel type. The order of the columns can be changed in the properties menu of the appropriate Array Table channel. Clicking the ‘Update Once’ button will refresh all displayed columns. Enabling the ‘Auto Update’ option will result in a constant refresh. Commands, operators and info The Array Command is used to remove specific records from an array. The various Array Operator and Info channels can be used to retrieve information. The image below shows an advanced use.

For Loops A combination of a For Loop and an array channel is very powerful. The ‘Current Iteration’ Value is used as index for the arrays.

Page 190: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

190

See Chapter 3.3 for more information on For Loops.

Page 191: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

191

Tutor ia l

Arrays can contain large amounts of data. This exercise shows how the information in an array is stored and accessed. Needed Quest3D scene: • ..\Tutorials\3.4 – Arrays\Arrays 1.cgr Needed templates: • Variables \ Arrays \ Array Value • Variables \ Value \ Value Step by step: • Open the scene ‘Arrays 1.cgr’. It contains a single text object. • Make sure the scene is displayed in the Animation 3D View window using

the Project Camera. • Drag an Array Table onto the Channel Graph. And connect it to the ‘Main’

channel. Double click on the Array Table channel to open its properties window.

• Rename the table to ‘Menu’. • Create a new column by pressing the ‘Add’ button. • Select the column and rename it to ‘Options’. • Select the ‘Array Text’ radio button and press the ‘Set’ button to commit. • Select the ‘Rename channel to table name’ option and press ‘OK’ to accept. • Add an Array Text channel. Double click it to open its properties window. • From the ‘Table’ drop-down list, select ‘Menu’. • From the ‘Column’ drop-down list, select ‘Options’. • Select the ‘Update channel name’ option and press ‘OK’ to accept. The

channel is now set up as a reference to the correct table and column. • Press the “Array Manager’ tab.

Page 192: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

192

Note there is a table called ‘Menu’, which includes a column called ‘Options’.

• In the first field (row ‘0’) of the ‘Options’ column, type in ‘Option 1’. • Press the ‘New’ button to create a new record. Type in ‘Option 2’ in row ‘1’. • Add two more records, called “Option 3’ and ‘Option 4’.

• Press the ‘Channel Graph’ tab. • Connect the ‘Menu: Options’ channel to the ‘2D Text from Texture’ channel.

Note the text in the Animation 3D View changes to ‘Option 1’. • Add a Value and connect it to the ‘Menu: Options’ channel. Rename it to

‘Menu Index’. • Change the value of the ‘Menu Index’ channel to ‘1’. Note the text in the

Animation 3D View changes to ‘Option 2’. • Test the other options by changing the value of the ‘Menu Index’ channel. Finished scene: • ..\Tutorials\3.4 – Arrays\Arrays 1 – Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 193: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

193

Needed Quest3D scene: • ..\Tutorials\3.4 – Arrays\Arrays 2.cgr Needed templates: • Variables \ Value \ Array Value • Variables \ Matrix \ Set Matrix • 3D Items \ Null Object • Variables \ Matrix \ Array Matrix Step by step: • Open the scene ‘Arrays 2.cgr’. It contains a number of primitive objects and a

partially configured table. • Drag an Array Value onto the Channel Graph. Double click it to open its

properties window. • From the ‘Table’ drop-down list, select ‘Objects’. • From the ‘Column’ drop-down list, select ‘Type’. • Select the ‘Update channel name’ option and press ‘OK’ to accept. • Connect the ‘Objects: Type’ channel to the first child link of the ‘Object Type

Switch’ channel. • Make a shortcut of the ‘Current Iteration’ channel and connect it to the

‘Objects: Type’ channel. • Right click on the ‘Object: Type’ channel and choose ‘General Properties’. In

the properties window, select the ‘Continuous’ update option. Press ‘OK’ to accept.

• Make sure the Animation 3D View window is open and displays the scene using the Project Camera.

• Press the ‘Array Manager’ tab. Note the two columns in the ‘Objects’ table, ‘Motion’ and ‘Type’.

• Enter ‘1’ in the first field (Row 0) in the ‘Object Type’ column. Note one of the primitive objects in the Animation 3D View window changes shape.

• Enter ‘2’ in the second field (Row 1) in the ‘Type’ column. Note one of the objects changes shape.

• Fill in values for the other two records as you see fit. (Note: ‘0’ = Box, ‘1’ = Sphere, ‘2’ = Cylinder, ‘3’ = Cone).

• Press the ‘Channel Graph’ tab. • Drag an Array Matrix onto the Channel Graph and connect it to the Set Matrix

channel. Double click it to open its properties window. • From the ‘Table’ drop-down list, select ‘Objects’. • From the ‘Column’ drop-down list, select ‘Motion’. • Select the ‘Update channel name’ option and press ‘OK’ to accept.

Page 194: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

194

• Add a Value and connect it to the ‘Objects: Motion’ Array channel you just created. Rename the Value to ‘Current Object’.

• Go to the Animation Section. • Click on the ‘Object Mover’ object in the list to select it. • Move the ‘Object Mover’ around. Note one of the primitive objects moves

along with it. • Go to the Channel Section. • Change the ‘Current Value’ to ‘1’. • Go to the Animation Section. • Click on the ‘Object Mover’ object in the list to select it. • Move the ‘Object Mover’ around. Note the primitive object corresponding to

index ‘1’ moves along with it. • Go to the Channel Section. • Double click on the ‘Objects Table’ channel to open its properties window. • Create a new column by pressing the ‘Add’ button. Name this column

‘Texture’. • Select the ‘Array Channel’ radio button and from the drop-down list, select

‘Texture’. Press the ‘Set’ button to confirm. Press ‘OK’ to accept. • Drag an Array Channel onto the channel graph and connect it to the correct

child link square of the ‘Surface’ channel of the ‘Box’ object. • Double click on the ‘Array Channel’ to open its properties window.

Configure it to be a reference to the Texture column in the Objects table. Select the ‘Update channel name’ option and press ‘OK’ to accept.

• Create a shortcut of the ‘Current Iteration’ channel and connect it to the ‘Objects: Texture’ channel.

• Create three shortcuts of the ‘Objects: Texture’ channel and connect them to the correct child link squares of the ‘Surface’ channels of the ‘Sphere’, ‘Cylinder’ and ‘Cone’ objects, respectively.

• Press the Array Manager tab. • In the ‘Texture’ column in the ‘Objects’ table, double click on the first field to

open the properties window for that record. Locate and load in a texture. Note in the Animation 3D View window, the first object (‘0’) now has a texture.

• Load textures for the other three fields. Note they are displayed in the Animation 3D View window.

Page 195: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

195

Finished scene: • ..\Tutorials\3.4 – Arrays\Arrays 2 – Complete.cgr

Page 196: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

196

3.5 Multiple channel groups

Advanced Quest3D programs may be complex projects. At a certain point it might be practical to split a program into seperate parts. Chapter 4.1 on project management discusses the benefits of working with multiple channelgroups. This chapter explains the exact workings in Quest3D. Multiple channel groups are linked together by special types of channels: ‘Public Channels’ and ‘Public Call Channels’. Public Channels Public Channels are channels that can be called from external channel groups. They are colored red in QueSst3D.

Public Call Channels Public Call Channels are links to Public Callers. They are colored blue in Quest3D.

Channels of any base type may be converted into Public Callers. The most often used types are: Channel Caller, Value, Vector, Matrix, 3D Object, Camera and Light.

Page 197: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

197

Where ever possible, use Public Callers of these types for ease of use and memory management purposes. Linking between channel groups Linking a channel to a another channel in another channel group automically converts it into a Public Channel. A Public Call Channel is created in the other channel group.

Channels can also be converted into Public Callers manually by selecting ‘Public Channel Functions > Make Channel Public’ from the context menu. Alternatively, the ‘P’ key may be pressed. The context menu also provides an option to manually create Public Call Channels: ‘Public Channel Functions > Convert to Public Call Channel’.

Page 198: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

198

Public Call Channel properties Through the channel’s Properties window it is possible to specify the Public Channel (of the same base type) to which the Public Call Channel is a link.

Functions Functions are subprograms that may be called using parameters. A type of Public Caller, they are also colored red in Quest3D.

Page 199: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

199

Parameters are data used as input for functions. They are colored green in Quest3D. Channels can be converted into Parameters manually by selecting ‘Public Channel Functions > Convert to Parameter Channel’ from the context menu. Public Channels with Parameter children result in Public Call Channels with child links of the appropriate type.

Functions may be called as often as needed. Each instance may be supplied with different parameters, thereby creating variation. Channel Switches Functions of type Channel Switch must include an extra Value channel before a Parameter for the ‘Selector’ child linked can be connected. This is a result of the nature of the Channel Switch.

Page 200: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

200

For Loops Functions may also be called inside a For Loop structure. Arrays may be linked as parameters to create even more powerful routines.

The image above shows an advanced function of an animated character with parameters for its motion, current animation and texture. The image below shows the function when called as a Public Call Channel. It uses arrays in a For Loop as parameters.

Page 201: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

201

Page 202: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

202

Tutor ia l

Needed Quest3D scene: • ..\Tutorials\3.5 – Multiple channel groups\Multiple channel groups.cgr • ..\Tutorials\3.5 – Multiple channel groups\3D scene render.cgr • ..\Tutorials\3.5 – Multiple channel groups\Car.cgr Needed templates: • Variables \ Value \ Value Step by step: • Open the scene ‘Multiple channel groups.cgr’. It contains a simple project

structure. • From the Applications Menu, choose ‘File > Import...’. Locate the file ‘3D

scene render.cgr’ in the directory specified above and press ‘Open’ to accept. As pool name, use ‘3D scene render’. The file contains a simple scene including Render, Camera and Light channels.

• Click on the ‘Groups’ tab. • From the ‘Groups’ tab, drag the pool name ‘Multiple channel groups’ onto

the upper Channel Graph. • From the ‘Groups’ tab, drag the pool name ‘3D scene render’ onto the lower

Channel Graph. • Connect the ‘3D Scene Render’ channel in the lower Channel Graph to the

‘3D Scene’ channel in the upper Channel Graph. Note the ‘3D Scene Render’ channel in the lower Channel Graph turns red, and the channels below are actively called (light blue outline). Note in the upper Channel Graph a blue channel is created, connected to the ‘3D Scene’ channel.

Page 203: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

203

• Import the file ‘Car.cgr’ from the directory specified above. As pool name,

use ‘Car’. The file contains a car model. • From the ‘Groups’ tab, drag the pool name ‘3D scene render’ onto the upper

Channel Graph. • From the ‘Groups’ tab, drag the pool name ‘Car’ onto the lower Channel

Graph. • Connect the ‘Car’ channel in the lower Channel Graph to the ‘Render’

channel in the upper Channel Graph. • Click on the ‘’Animation 3D View’ tab. Note a car model is displayed in the

preview window. • Right click on the ‘Current Car Texture’ channel in the lower Channel Graph

and select ‘Public Channel Functions > Convert to Parameter Channel’ from the context menu. Note the channel turns green. Also note the blue Public Call Channel ‘Car: Car -> Car’ in the upper Channel Graph now has a child link of type Value.

• Drag a Value onto the upper Channel Graph and rename it to ‘Current Car Texture’. Connect it to the blue ‘Car: Car -> Car’ channel.

• Change the value of the ‘Current Car Texture’ channel to ‘1’. Note the texture of the car model in the Animation 3D View is affected.

Page 204: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

204

Finished scene: • ..\Tutorials\3.5 – Multiple channel groups\Multiple channel groups –

Complete.cgr

Page 205: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

205

3.6 Mathematical operators

3D Objects in virtual reality can be moved, rotated and scaled by applying principles from linear algebra. This chapter, while meant for fairly advanced Quest3D users, is only meant as an introduction. For more information, please refer to the many volumes of literature that have been written on the subject. Matrix and Motion As discussed in Chapter 2.1, 3D objects in Quest3D store their position, rotation and scale in a Matrix or Motion channel. A Motion channel is divided into three Vectors, and each Vector is divided into three Values.

Operators The so called Operator channels in Quest3D allow you to affect each of these elements dynamically in real-time. As a general rule, the base Operator channels in Quest3D are ordered by the channel type of the result. For example, if the result of an operation should be a Value, the operator will be found in the Value Operator base channel. Most of the functions of the Value Operator base channel are used to access information from other (types of) channels. An example of an often used Value Operator is ‘Get distance (vector, vector)’.

Page 206: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

206

The Vector Operator base channel may also be used to retrieve information from other (types of) channels. An example is ‘Get Translation (position) from Matrix’. Vector Operators are also used to transform vectors. Transformation may include basic addition, subtraction, multiplication and division of two vectors. Certain Vector Operators can be used to set the length of a vector, or multiply a vector by a value or matrix. Matrix Operators may be used to turn vectors into matrices, such as ‘Create Translation Matrix’. Matrix Operators can also retrieve information, such as ‘Get Current Camera Matrix’. ‘Matrix Interpolate’ can be used to blend between two Matrices. A special type of Operator is ‘Damping’, which exists for Values, Vectors and Matrices alike. It dampens a variable over time, effectively blending from the current state to the new. The effect is logarithmic, and its speed may be adjusted by changing its second child link Value. This damping speed ranges from ‘0’ to ‘1.0’.

Note that the ‘Value Damping’ Operator is a seperate channel. Parenting Normally, the motions of all 3D objects in a scene are relative to the world space origin (0, 0, 0). However, it is also possible to link certain objects to others. An object connected to a second object is called a child. The object to which the first is linked is called a parent. Linking an object to another object in Quest3D is done by connecting the Motion channel of the parent to the ‘Parent Matrix’ child link of the Motion channel of the child object.

Page 207: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

207

The motion of a child object is no longer relative to world space. Instead, it is relative to the motion of its parent object.

In the image above, the light cube’s position and rotation are relative to the world origin. In the image below, the light cube is ‘parented’ to the dark cube. The light cube’s position and rotation are relative to the dark cube.

Page 208: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

208

Look At The fourth child link of a Motion channel is called ‘Look At Matrix’. An object can be pointed in the direction of another object by connecting the Motion channel of the target to the ‘Look At Matrix’. Moving the first object along its local Z-axis will move it towards or away from the ‘Look At’ object. Examples include a camera following a moving car, and a character walking towards his goal.

Page 209: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

209

Collision Response The Fast Collision Response channel is a system to simulate collision between objects. It checks a spheroid at its current position against any number of Collision Objects, and results in a new position.

The Fast Collision Response channel structure is made up of a number of elements.

Chapter 4.2 describes a more advanced form of collision handling called ‘ODE’ (Open Dynamics Engine).

Page 210: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

210

Tutor ia l

The following exercise adds a rotation wheel to a moving car, demonstrating the concept of parent and child. The Look At function of a matrix is showed using a camera object. Needed Quest3D scene: • ..\Tutorials\3.6 – Mathematical operators\Mathematical operators 1.cgr Needed templates: • Variables \ Value \ Expression Value (x2) • Scene \ Render Camera Light Step by step: • Open the scene ‘Mathematical operators 1.cgr’. It contains an animated car, a

loose wheel and a camera model. Note that the loose wheel is positioned at (0, 0, 0).

• Make a shortcut of the ‘Car Motion’ channel. Connect it to the ‘Parent Matrix’ child link of the ‘Front Left Wheel Motion’. Note the wheel object is no longer positioned at (0, 0, 0). It is at the same position as the car model.

• Go to the Animation Section.

• Click on the Editor Camera button to view the scene using the Quest3D editor camera.

• Click on the ‘Front Left Wheel’ object in the list to select it. • Adjust the position of the ‘Front Left Wheel’ by moving it with the Gizmo.

Alternatively, type in the following X,Y,Z-coordinates: (-0.78, 0.32, 1.13).

Page 211: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

211

• Go to the Channels Section. • Drag an Expression Value onto the Channel Graph and connect it to the ‘Front

Left Wheel Pitch’ channel. • Double click on the Expression Value and type in the following formula: ‘OLD

+ 0.5 * TC’. Click ‘OK’ to accept. Note the wheel object is now turning. • Make three shortcuts of the Expression Value and connect them to the ‘Front

Right Wheel Pitch’, ‘Rear Left Wheel Pitch’ and ‘Rear Right Wheel Pitch’ channels respectively. Note all four wheels are now turning.

• Make a shortcut of the ‘Car Motion’. Connect it to the ‘Look At Matrix’ child

link of the ‘Camera Object Motion’. Note the 3D camera model is now directed towards the car.

• Go to the Animation Section. • From the Timer Selection drop-down list, select the ‘Car Animation’ timer. • Press the Play button . Note the car starts driving around the track. Note

the camera model continues to look at the car.

• Press the Project Camera button . The scene is now displayed from the Follow Camera point of view.

Page 212: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

212

Finished scene: • ..\Tutorials\3.6 – Mathematical operators\Mathematical operators 1 –

Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 213: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

213

Needed Quest3D scene: • ..\Tutorials\3.6 – Mathematical operators\Mathematical operators 2.cgr Needed templates: • Variables \ Value \ Expression Value (x3) • Logic \ User Input \ User Input (x4) • Variables \ Value \ Value (x2) • Variables \ Vector \ Vector Operator (x2) • Variables \ Matrix \ Matrix Operator • Variables \ Vector \ Vector (using values) Step by step: • Open the scene ‘Mathematical operators 2.cgr’. It contains a cityblock scene

and a stretched spherical collision object. • Select and delete the ‘Z’ Value of the ‘Movement Vector’ channel. • Add an Expession Value and connect it to the (now empty) third child link of

the ‘Movement Vector’ channel. • Drag two User Input channels onto the Channel Graph and connect them

both to the Expression Value. Bind the arrow up and an arrow down keys to them, respectively. Rename them to ‘Arrow Up’ and ‘Arrow Down’, respectively.

• Add a Value channel and connect it to the Expression Value. Rename the Value to ‘Movement Speed’. Double click on the channel and change its value to ‘1’.

• Double click on the Expression Value and type in the following formula: (A – B) * C * (TC / 25) A is the ‘Arrow Up’ channel, B the ‘Arrow Down’ and C is the ‘Movement Speed’ channel. TC is the Tick Count, and the factor ‘25’ accounts for 25 frames per second.

Page 214: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

214

• Switch to Run Mode. • Test the scene so far by pressing the arrow up key. Note the camera view

moves forward. • Press the arrow down key to move backwards. • Move the mouse left and right. Note the view is affected. • Press the arrow up and mouse the mouse from left to right simultaneously.

Note that you move forward and rotates at the same time. Also note that the forward movement is not in the direction in which the camera is pointing.

• Switch to Edit Mode. • Disconnect the ‘Movement Vector’ from the ‘Fast Collision Response’

channel. • Add a Vector Operator channel and connect it to the ‘Fast Collision Response’

channel. Double click it and from the drop-down list select ‘Multiply Matrix with Vector (vector, matrix)’. Close the window and rename the channel to ‘Adjust Heading’.

• Connect the ‘Movement Vector’ to the ‘Adjust Heading’ channel. • Drag a Matrix Operator channel onto the Channel Graph. Double click it and

from the dropdown list select ‘Get Rotation Matrix from Matrix (matrix)’. Close the window and rename the channel to ‘Get Rotation’.

Page 215: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

215

• Make a shortcut of the ‘Motion’ and connect it to the ‘Get Rotation’ channel. • Connect the ‘Adjust Heading’ channel to the ‘Motion’ channel.

• Switch to Run Mode. • Test the scene so far by pressing the arrow up and arrow left key

simultaneously. Note that the camera view moves forward in direction in which the camera is pointing.

• Switch to Edit Mode. • Change the ‘Y’ Value of the ‘Position’ channel to 2. Note the camera is

floating in the air. The following steps will add collision and gravity to the model.

• Make a shortcut of the ‘Environment’ channel and connect it to the ‘Collision Object’ channel.

• Disconnect the ‘Adjust Heading’ from the ‘Fast Collision Response’ channel. • Add a Vector Operator channel. Double click it and from the drop-down list

select ‘Add Two Vectors (vector, vector)’. Close the window and rename the channel to ‘Add Vectors’.

• Connect the ‘Adjust Heading’ to the ‘’Add Vectors’ channel. • Connect the ‘Add Vectors’ channel to the ‘FastCollisionResponse’ channel. • Drag a Vector with Values template onto the Channel Graph and connect it to

the ‘Add Vectors’ channel. Rename the Vector channel to ‘Gravity Vector’.

Page 216: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

216

• Select and delete the ‘Y’ Value of the ‘Gravity Vector’ channel. • Add an Expression Value and connect it to the (now empty) second child link

of the ‘Gravity Vector’ channel. Double click it and type in the following formula: -0.4 * TC Note the camera drops to the ground.

• Retest the gravity by changing the ‘Y’ Value of the ‘Position Vector’ channel

to 2 again. Note the camera drops to the ground once more. • Test the scene by moving around in the environment. Note the camera view

moves in the direction in which it points, and is kept on the ground by gravity.

Finished scene: • ..\Tutorials\3.6 – Mathematical operators\Mathematical operators 2 –

Complete.cgr

Page 217: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

217

3.7 Pathfinding

Virtual worlds can be brought to life by adding walking characters or moving cars. These may be pre-animated, but sometimes a more flexible solution is needed. Characters might have to stop in front of traffic lights, open bridges or respond to each other. Pathfinding allows for such dynamic route planning. Pathfinding depends on a number of waypoints or ‘nodes’ to be set out in a virtual environment. Objects can be sent to these nodes directly, or over a structure of paths. Especially if the environment is complex, setting up a proper path structure is important.

In Quest3D, pathfinding is handled by two channels. The first is the 3D Graph, which contains all node and path structure information. The second is the Motion Planning channel, which calculates the fastest route through the path structure form the current position to a destination position.

Page 218: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

218

3D Graph The nodes of a 3D Graph must be painted onto a collision object. This collision object can be connected to the 3D Graph channel’s first child link. The second child link of the 3D Graph also expects a Collision Object channel. This object is used to determine line of sight during path calculation. These two collision objects can be the same. In any case, it is recommended to keep them as ‘low poly’ as possible. Often, this means creating a simplified version of a 3D model for collision purposes.

Motion Planning The Motion Planning channel has four child links.

Page 219: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

219

The first child link requires the current position of an object with pathfinding. The second represents the destination position. The third is the ‘Next node range’. If an object comes within this distance of any given node, it will look at the next node on the calculated route. The fourth is the 3D Graph containing all node and path structure information. The position of a node can be requested using a Get Motion Planning Info Vector channel. It requires the Motion Planning channel as its first child link. The second child link is a Value that defines which node on the 3D Graph is returned. An object with pathfinding can be moved towards its goal. See Chapter 3.6 for more information on moving objects using vectors. Pathfinding Section Layout

Nodes and paths can be placed and erased in the Nature / Pathfinding Section in Quest3D.

Page 220: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

220

Tutor ia l

The following exercise will make an animated character find its way between several waypoints in a city scene. Needed Quest3D scene: • ..\Tutorials\3.7 – Pathfinding\Pathfinding.cgr Needed templates • Pathfinding \ 3D Graph • Collision \ Collision Object • Pathfinding \ Motion Planning • Pathfinding \ Motion Planning Info Vector • Variables \ Value \ Value • Variables \ Matrix \ Matrix Operator • Variables \ Value \ Array Value • Pathfinding \ Triggers \ Vector Proximity Trigger • Variables \ Value \ Set Value Step by step: • Open the file, ‘Pathfinding.cgr’. It contains a smal city block scene, a

character with multiple animations and collision setup and a camera that follows the character.

• Add a 3D Graph channel and connect it to the ‘Pathfinding’ channel. • Drag a Collision Object onto the Channel Graph and connect it to the first

child link of the ‘3D Graph’ channel. • Make a shortcut of the ‘Street’ channel and connect it to the ‘Collision Object’

channel. The 3D Graph is now ready to paint nodes on. • Go to the Nature / Pathfinding Section and click on the ‘Pathfinding Graph’

tab. • Click on the ‘3D Graph’ to select it. • Press the ‘Paint’ button to enter node painting mode. • Move the mouse cursor over the Animation 3D View. Note the red circular

marker. This is the node painting cursor. • In the cityblock environment, find the building with the red bricks, and place

a node in front of one of the doors by left-clicking on the sidewalk. A line is drawn from the node to the current position of the painting cursor. Place another node a few meters away, but still on the side walk. The line still

Page 221: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

221

connects the two nodes, and a new line is drawn to the current painting cursor position. Right click to stop painting.

• Place a few more nodes in the city scene. Keep the 3D Graph as clean as possible. An example of a proper Graph can be seen in the image below.

• When ready, press the ‘Idle’ button to exit node painting mode. Note the Graph disappears.

• Tick the ‘Keep showing graph’ box to make the Graph visible at all times.

• Go to the Channels Section. • Add a Motion Planning channel. • Make a shortcut of the ‘AI Character Position’ channel and connect it to the

first child link of the ‘Motion Planning’. • Drag a Motion Planning Info Vector onto the Channel Graph and connect it to

the second child link of the ‘Motion Planning’ channel. • Make a shortcut of the ‘Motion Planning’ channel and connect it to the first

child link of the ‘Motion Planning Info Vector’ channel. • Add a Value and connect it to the third child link of the ‘Motion Planning’.

Change its value to ‘0.1’. • Make a shortcut of the ‘3D Graph’ channel and connect it to the fourth child

link of the ‘Motion Planning’ channel. • Drag a Matrix Operator onto the Channel Graph and connect it to the ‘Look

At Matrix’ chidlink of the ‘AI Character Motion’ channel. Double click it, and from the drop-down list select ‘Create Translation maxtrix (vector)’. Close the window.

• Connect the ‘Motion Planning’ channel to the ‘Create Translation matrix (vector)’ channel. Note the character looks at node number ‘0’ now.

• Add an Array Value channel and as column and channel name use ‘Destination’. Connect the channel to the second child link of the ‘Motion

Page 222: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

222

Planning Info Vector’.

See Chapter 3.4 for more information on arrays. • Click on the ‘Array Manager’ tab. • Create extra fields from 1 to 5. Examine your 3D Graph and fill in the

numbers of a few interesting nodes. Waypoints. • Click on the ‘Channel Graph’ tab. • Make a shortcut of the ‘Current Destination’ channel and connect it to the

‘Destination’ Array.

• Go to the Animation Section. • Switch to Run Mode. • Test the scene so far by pressing the ‘1’ key. The character should walk to the

node that corresponds to field ‘1’ in the array. Note that on arrival, the character does not stop automatically.

• Switch to Edit Mode. • Go to the Channels Section. • Make a shortcut of the ‘AI Character Position’ channel and connect it to the

first child link of the ‘Get Vector’ channel under the ‘Arrival Trigger’ channel.

• Make a shortcut of the ‘Motion Planning’ channel and connect it to the second child link of the ‘Get Vector’ channel.

Page 223: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

223

• Make a shortcut of the ‘AI Character Speed’ channel and connect it to the second child link of the ‘Set Value’ channel.

• Go to the Animation Section. • Switch to Run Mode. • Test the scene so far by pressing the ‘1’ through ‘5’ keys. Note the character

walks towards the corresponding nodes and stops upon arrival. • The completed version of this tutorial contains extra logic to restrict the

character’s movement. When ready, open the file and examine its structure.

Finished scene: • ..\Tutorials\3.7 – Pathfinding\Pathfinding – Complete.cgr

Page 224: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

224

3.8 Finite state machine

Projects may consist of a number of subprograms, such as various menu screens and 3D scenes. By using the various Quest3D logic channels, it is easy to switch between such screens as long as the structure is fairly simple. To simplify switching between subprograms in more complex structures, the Finite State Machine channel can be used. In the example above, the various menu screens can be considered ‘states’. The Finite State Machine is called ‘FSM’ for short.

The Finite State Machine channel has a number of child links. Values connected to the first child link are checked to trigger state changes. Children of the second child link represent the actual states. Only the current state is called. Finally, children of the third child link can be triggered once on specific state changes

Page 225: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

225

Finite State Machine Graph The properties window of the Finite State Machine looks similar to a Channel Graph.

The various states of an FSM are represented by blue circular items. The current state is highlighted. On the right side of the screen, the properties of the selected state item are shown. The ‘Channel to call on state’ drop-down list contains the names of all the channels connected to the ‘State Call Channels’ child links of the FSM. Connecting state items State items can be connected to each other by dragging a line from one black dot to another. On the right side of the screen, the properties of a selected state link are shown.

Page 226: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

226

The ‘Value channel to trigger transition’ drop-down list contains the names of all the channels connected to the ‘State Change Value’ child links of the FSM. The ‘Channel to trigger on state change’ drop-down list contains the names of all the channels connected to the ‘State trigger channels’ child links of the FSM. Hierarchy In the image below, the current state is ‘Main Menu’. Only the ‘3D Scene’ and the ‘Options Menu 1’ states can be reached. In addition, the ‘Options Menu 2’ state is only reachable from the ‘Options Menu 1’ state. However, from the ‘Options Menu 2’ state it is possible to reach both the ‘Options Menu 1’ and the ‘Main Menu’ state.

Page 227: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

227

Time based state changes It is also posssible to create time based state changes. This feature allows the user a certain amount of time (in millisections) before moving onto the next state. Examples Other examples in which the Finite State Machine can be used include stages in a virtual training simulation, advanced character animation setup and behavior of A.I. characters.

Page 228: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

228

Tutor ia l

The following tutorial shows the workings of the Finite State Machine. It is used to navigate a menu structure. Needed Quest3D scene: • ..\Tutorials\3.8 – Finite State Machine\Finite State Machine.cgr Needed channels: • Logic \ Finite State Machine Step by step: • Open the file, ‘Finite State Machine.cgr’. It contains a main menu screen and

an option menu screen. It also contains two very simple 3D scenes, namely one with a red sphere and one with a blue box.

• Drag a Finite State Machine channel onto the Channel Graph and connect it to the ‘Program’ channel. Note its current value, or ‘state’, is ‘0’.

• Connect the ‘Main Menu’ channel to the ‘State Call Channels’ child link of the ‘Finite State Machine’ channel. Note the ‘Main Menu’ channel is not called, as no state logic has been defined yet. Also note a new ‘State Call Channel’ child link is added to the Finite State Machine, allowing for extra children of that type.

• Connect the ‘Options Menu’ channel to the second (empty) ‘State Call Channel’ child link of the FSM. Note it is not called yet.

• Connect a shortcut of the ‘Main Menu – Options Menu Button Pressed’ channel to the ‘State Change Values’ child link of the ‘Finite State Machine’ channel. Note a new ‘State Change Values’ child link is added to the FSM, allowing for extra children of that type.

• Connect a shortcut of the ‘Options Menu – Main Menu Button Pressed’ channel to the second (empty) ‘State Change Values’ child link of the Finite State Machine.

Page 229: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

229

• Double click on the ‘Finite State Machine’ channel to open its properties

window. Note the area similar to a Channel Graph on the left and the options on the right.

• Press the ‘New Item’ button and click once in the middle of the FSM graph. Note a cicular item is created.

• Click on the item to select it. Note its properties are displayed on the right side of the window. Change its ‘Item name’ to ‘Main Menu’. From the ‘Channel to call on state’ drop-down list, select ‘Main Menu’. Note the ‘Main Menu’ channel is now called, and the main menu screen is displayed in the Animation 3D View window. Note the options in this list correspond to the channels connected to the ‘State Call Channels’ child links of the FSM.

• Create a new item above the ‘Main Menu’ item and select it. Change its ‘Item name’ to ‘Options Menu’. From the ‘Channel to call on state’ drop-down list, select ‘Options Menu’.

• Connect the two items by dragging a link from the black dot in the middle of the ‘Main Menu’ item to the black dot in the middle of the ‘Options Menu’ item. Note the direction of the arrow.

• Click on the link to select it. Note its properties are displayed on the right side of the window. From the ‘Value channel to trigger transition’ drop-down list, choose ‘Main Menu – Options Button Pressed’. Note the Value of the same name in the Channel Graph is now called.

Page 230: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

230

Note the options in this list correspond to the channels connected to the ‘State Change Values’ child links of the FSM.

• Drag a link from the ‘Options Menu’ item back to the ‘Main Menu’ item. Select the link and from the ‘Value channel to trigger transition’ drop-down list, choose ‘Options Menu – Main Menu Button Pressed’.

• Close the Finite State Machine properties window. • Go to the Animation Section. • Switch to Run Mode. • Click on the ‘Options’ button in the Animation 3D View window. Note the

options menu screen is displayed. • Click on the ‘Main Menu’ button to return to the main menu. • Click on the ‘Options’ button once more to bring up the options menu screen. • Switch to Edit Mode. • Go to the Channels Section. • Double click on the Finite State Machine channel to open its properties

window. Note the current state, ‘Options Menu’, is now highllighted. • Close the FSM properties window. In the Channel Graph, note the value of

the Finite State Machine is now ‘1’. Note the ‘Options Menu’ channel is called, and the ‘Main Menu’ channel is not.

Page 231: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

231

Note the ‘Options Menu – Main Menu Button Pressed’ Value is highlighted, and the ‘Main Menu – Options Button Pressed’ Value is not.

• Connect the ‘Scene Selection Menu’ channel to the third (empty) ‘State Call Channels’ child link of the FSM channel.

• Connect the ‘Main Menu –Start Button Pressed’ channel to the third (empty) ‘State Change Value’ child link of the FSM channel.

• Connect the ‘Scene Selection Menu – Main Menu Button Pressed’ channel to the fourth (empty) ‘State Change Value’ child link of the FSM channel.

• Open the FSM properties window. • Add a new item, ‘Scene Selection Menu’. Set it to call the ‘Scene Selection

Menu’ channel. • Connect the ‘Main Menu’ item to the ‘Scene Selection Menu’ item and set it

to the correct value change. • Connect the ‘Scene Selection Menu’ item back to the ‘Main Menu’ item and

set it to the correct value change. • Close the FSM properties window. • Go to the Animation Section. • Switch to Run Mode. • Test the scene by clicking on the functional buttons created so far. • When ready, switch to Edit Mode. • Create Finite State Machine logic for the two 3D scenes. All the needed

channels are already present on the Channel Graph, they only need to be linked correctly.

Page 232: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

232

Finished scene: • ..\Tutorials\3.8 – Finite State Machine\Finite State Machine – Complete.cgr

Page 233: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

233

Part IV: Expert level Part I introduced the basic concepts of Quest3D. Part II and III described in detail 3D objects and animation, and Quest3D programming, respectively. This part of the manual covers advanced topics. Chapter 4.1: Project management This chapter is a general discussion on handling Quest3D development cycles. Chapter 4.2: Physics simulation ODE is Open Dynamics Engine. It allows for amazing physics simulations. Chapter 4.3: Database connectivity Large amounts of information can be stored in a database. Quest3D supports several connection types. To access this functionality, an Enterprise or VR Edition is required. Chapter 4.4: Networking Connecting multiple computers to one another is called ‘networking’. This chapter has the details. To access this functionality, an Enterprise or VR Edition is required. Chapter 4.5: Lua scripting Lua extends the standard Quest3D set of channels.

Page 234: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

234

4.1 Project management

Advanced Quest3D programs may be complex projects. This chapter discusses project managent. Specifically, it describes the benefits of working with a good file structure. Complex Quest3D projects consist of a number of seperate subprograms. Typical subprograms may include, among others: 3D environments, 3D characters, animation, camera system, lighting setup, sound, special effects and user interface.

Creating a project structure beforehand helps in project planning. Empty placeholder channel groups can be linked together to form the back bone of the application. The application as a whole ‘reads’ better – making it more accessible to all team members.

Page 235: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

235

Not only will this structure help anticipate which elements will be needed, it also makes it easier to schedule development. Specific team members and clear deadlines may be assigned to subtasks of the entire project. Artists may work on importing objects into Quest3D and polishing appearance. Sound designers may develop or test music and sound routines. Several specialised programmers may work on their respective subprograms without hindering each other. At any point in time during the development process, any of the subprograms may be updated with a new version provided by the team members working on them. Future projects can greatly benefit from a company standard project structure. In all likelihood, a number of subprograms may be reused. 3D assets may easily be replaced with new content. Elements such as user interfaces may be kept consistent in both style and use.

Page 236: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

236

Tutor ia l

The following tutorial is meant to assist in project management. These steps are not foolproof, as each project has its own unique issues. However, generally speaking, reading through the points below should be a good exercise. Step by step: • Take a piece of paper and write down the name of your project. • In one sentence, try to capture the essence of your project. Will it be a

training program? A product visualisation? An architectural walkthrough? A game? Something else?

• Make a rough sketch of the 3D scenes as you envision them. • Make a clear sketch of (or write down notes about) the graphic user interface. • Compile a list of all the needed elements. First concentrate on the basic

subprograms such as environment, camera system and user interface. Next, make a more detailed list per part, including specific functionality, animations, textures etc.

• Create a ‘back bone’ structure in Quest3D: based on the various subprograms create channel groups and link them together. Use clear and consistent names.

• Write down any extra elements you thought of while creating the back bone structure in Quest3D.

• Make a first estimate of how much time it will take to create all the various

elements. • Write down the names of all team members working on the project. • Group the subprograms and 3D assets based on who will be working on

what. Add the numbers and write down the total amount of time needed per team member.

• Think about dependencies between subprograms. Some parts may not be worked on yet before others are finished. Shuffle the lists where needed to come up with a sensible schedule.

• Discuss the schedule with all team members involved. • If large enough, split the schedule into three or four milestones. These

milestones can also be used in contracts with clients to monitor progress. • Finalise the schedule.

Page 237: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

237

• If needed, write a compact project proposal discussing the application. Include one or two appropriate screenshots if available.

• Discuss the schedule and project proposal with the client. Make adjustments where needed.

• Start development. Try to stick to the schedule as much as possible. • Be aware of adding new features – often they will only add time to the

production process, and weaken the essential design of the application. • Be especially aware of adding features requested by the client. Discuss the

proposals with the relevant team members and listen to their expertise. If needed, propose alternatives to the client. Make it clear to the client that adding features will affect the production schedule, and most likely the compensation involved.

• If possible, plan a user test. Invite someone unrelated to the project and have

him or her try the application. Make notes of any issues, as well as of aspects that went especially well. Make (subtle) changes to the designs if needed.

• When the application is almost done, show it to the client and write down any last minute changes wanted.

• Spend another one or two days polishing the application. • Release version 1.0. • After the project is completed, discuss development with the entire team. • Anticipate feedback from the client and prepare for support. • Make a list of what went right and what went wrong during development. • Make a list of all the various 3D assets and subprograms that could be reused

in future projects. • If there is time in between two projects, have team members optimise their

code and 3D models for future projects. Subprograms can be turned into Quest3D templates.

• If time permits, have team members brush up their skills by reading theory on new channels and functionality and creating tests.

• Prepare for the next project.

Page 238: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

238

4.2 Physics simulation

One of the drawbacks of traditional animation is that it is predefined. Time-based animation may be played back, but will never react to changes to an environment for example. As an alternative to predefined animation, a real-time physics engine can simulate real world movement and behavior. An object’s position and rotation are constantly calculated based on a number of attributes such as shape, mass and friction. External forces such as gravity and collision with other shapes influence an object’s motion as well. ODE Quest3D supports the ‘Open Dynamics Engine’ (ODE). Physics simulations in Quest3D are fairly easy to setup, and often produce great and convincing results. Channels The ODE Body channel is the heart of any project using dynamics. It replaces the regular Motion channel structure of an object.

Page 239: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

239

The first child link of the ODE Body channel is the start motion in rest, before the physics simulation is turned on. A value of ‘0’ or ‘1’ attached to the second child link disables and enables the simulation, respectively. Real-time dynamics must be turned on and off per object. A Toggle/FlipFlop template may be used for easy switching.

ODE Shapes ODE objects can be assigned one of four simulation shapes: Box, Sphere, Plane and Polygon Object. Of these, only Box and Sphere are truly dynamic. Plane and Polygon Object may only be used as static collision objects, such as environments. Complex dynamics shapes may be approximated by adding several Boxes and/or Spheres together.

Polygon shapes An ODE shape of type Polygon Object needs to have a collision object linked to its third child link.

Page 240: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

240

ODE Properties The properties window of the ODE Body channel lists a number of attributes.

The properties for all ODE Body channels can also be accessed in the Animation Section, on the ‘Dynamics’ tab. ODE attributes may only be edited when the simulation is off. A full description of the various properties can be found in the Reference Manual (press F1 in Quest3D to access it). The three ODE object templates that come with

Page 241: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

241

Quest3D represent two often used sets of properties: Stable ODE Body, Slippery ODE Body and ODE Landscape. ODE Joints A powerful feature of the Open Dynamics Engine is its joints functionality. ODE Joint channels can be used to connect several ODE shapes. Only Box and Sphere shapes may be part of a joint, Plane and Polygon Object shapes may not. Four types of joints are supported in Quest3D. • Ball and socket

This joint can be used to simulate a lamp hanging from the ceiling.

• Hinge

This joint can be used to simulate a hinging door.

• Slider

This joint can be used to simulate a piston or a sliding door.

Page 242: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

242

• Hinge2

This joint can be used to simulate the suspension of car wheels, including springs. Axis 1 is used for steering, Axis 2 is used for movement.

Rules for ODE Joints When working with joints, the following points apply: • Two bodies connected by a joint cannot collide with each other. • Two bodies cannot be connected to each other by more than one joint.

Multiple joints between the same two shapes will contradict each other, resulting in unstable simulation.

• Freedom of movement may be restricted for certain joint types. A slider joint cannot rotate around its axis for example.

ODE Commands The ODE Command channel can be used to change a number of simulation settings, including precision, speed, gravity and friction. The ODE Command channel may also be used to dynamically apply forces to bodies. These forces may

Page 243: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

243

be absolute in world space (wind for example), or relative to the body (rocket thrusters for example). ODE Information The ODE Info Value can be used to retrieve information such as forces, velocities and joint rotation angles.

Page 244: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

244

Tutor ia l

The goal of this exercise is to gain experience using the physics simulation in Quest3D. In the first scene, an ODE walkthrough camera system is created. The second tutorial results in a controllable car. Needed Quest3D scene: • ..\Tutorials\4.2 – Physics simulation\Physics simulation 1.cgr Needed templates: • Physics \ ODE Body • Objects \ Collision \ Collision Object • Logic \ Triggers \ Toggle Value • Objects \ Null Object • Physics \ ODE Command Step by step: • Open the file, ‘Physics simulation 1.cgr’. It contains an environment, a

number of boxes, a sphere and a camera. • Detach the ‘Sphere Motion’ channel from the ‘Sphere’ channel. • Drag an ODE Body channel onto the Channel Graph and connect it to the first

child link of the ‘Sphere’ channel. Rename the ODE Body to ‘ODE Sphere’. • Double click on the ‘ODE Sphere’ channel to open its properties window.

From the ‘Shape’ drop-down list, select the ‘Sphere’ option. Press ‘OK’ to accept.

• In the ODESphere properties window, set the ‘Roughness’ to 50, the ‘Angular Velocity Damping’ to 0.1 and the ‘Sphere Radius’ to 0.5. Press ‘OK’ to accept.

• Double click on the ‘ODE Environment’ channel to open its properties window. From the ‘Shape’ drop-down list, select the ‘Polygon Object’ option. Press ‘OK’ to accept.

• Drag a Collision Object channel onto the Channel Graph and connect it to the ‘Collision Object’ child link of the ‘ODE Environment’ channel.

• Create a shortcut of the ‘Environment’ channel and connect it to the Collision Object.

• Double click on the ‘Collision Object’ channel to open its properties window. Press the ‘Create Tree’ button to initialise the channel, and press ‘OK’ to accept.

Page 245: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

245

• Connect the 'Toggle/FlipFlop' to the ‘Enable Body’ child link of the ODE Sphere’ channel.

• Create a shortcut of the ‘Toggle/FlipFlop’ channel and connect it to the ‘Enable Body’ child link of the ‘ODE Environment’ channel.

• Connect the ‘Sphere Motion’ to the ‘Start Motion’ child link of the ‘ODE Sphere’ channel.

• Drag a Null Object onto the Channel Graph and rename it to ‘ODE Sphere Placer’.

• Select and delete the ‘Motion’ folder connected to the ‘ODE Sphere Placer’ channel.

• Connect the ‘Sphere Motion’ channel to the ‘ODE Sphere Placer’ channel.

• Go to the Animation Section. • Switch to Run / Edit Mode. • Click on the ‘ODE Sphere Placer’ object in the list on the left side of the

screen to select it. Move the object to a point a few meters above the ground. Note the ‘Sphere’ object moves along with it.

• Test the scene so far by pressing the spacebar. Note the sphere falls onto the ground.

• Press the spacebar again to stop the physics simulation. Note the sphere is reset to its start motion.

• Move the ‘ODE Sphere Placer’ object to a point just above the ground, on a flat part of the floor.

• Switch to Edit Mode.

Page 246: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

246

• Go to the Channels Section. • Make a shortcut of the ‘ODE Sphere’ channel and connect it to the ‘Get

Movement from Matrix’ channel. This operation parents the camera to the position vector of the Sphere object.

• Add an ODE Command channel and connect it to the ‘Forces’ channel. Double click on the channel to open its properties window. From the drop-down list select the ‘Add Force (ODE Body, vector)’ option. Select the ‘Update channel name’ option and press ‘OK’ to accept.

• Create a shortcut of the ‘ODE Sphere’ channel and connect it to the first child link of the ‘Add Force (ODE Body, vector)’ channel.

• Connect the ‘Force Vector’ channel to the second child link of the ‘Add Force (ODE Body, vector)’ channel. Note the ‘Force Vector’ is made up of key input channels and is corrected by the camera heading.

• Go to the Animation Section. • Make sure the scene in the Animation 3D View window is displayed using

the Project Camera. • Switch to Run Mode. • Press the spacebar to activate the simulation. • Move around using the arrow up and down keys and the mouse. Move up

the slope and note sliding back. Move through the boxes and note they are pushed aside.

• Press the spacebar twice to stop and reset the simulation. • When ready, switch to Edit Mode.

Page 247: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

247

Finished scene: • ..\Tutorials\ 4.2 – Physics simulation\Physics simulation 1 – Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 248: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

248

Needed Quest3D scene: • ..\Tutorials\4.2 – Physics simulation\Physics simulation 2.cgr Needed templates: • Physics \ ODE Joint Step by step: • Open the file, ‘Physics simulation 2.cgr’. It contains an environment, a car

and four seperate wheels. Each of these objects has already been setup as an ODE body.

• Drag an ODE Joint channel onto the Channel Graph and connect it to the ‘ODE Joints’ channel. Rename the ODE Joint to ‘ODE Joint Front Left’. Double click on it to open its properties window. Select ‘Hinge2’ as Joint type. Select the ‘Enable motor’ option, and press ‘OK’ to accept.

• Create a shortcut of the ‘ODE Car’ channel and connect it to the ‘ODE Body 1’ child link of the ‘ODE Joint Front Left’ channel.

• Create a shortcut of the ‘ODE Wheel Front Left’ channel and connect it to the ‘ODE Body 2’ child link of the ‘ODE Joint Front Left’ channel.

• Connect the ‘ODE Car Movement’ channel to the ‘Velocity’ child link of the ‘ODE Joint Front Left’ channel.

• Connect the ‘ODE Car Steering’ channel to the ‘Velocity2/Rotation (Hinge2)’ child link of the ‘ODE Joint Front Left’ channel.

• Create a shortcut of the ‘Car Motion’ channel and connect it to the ‘Parent Matrix’ child link of the ‘ODE Joint Front Left’ channel. The current channel structure should look similar to the one in the image below.

Page 249: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

249

• Go to the Animation Section. • Click on the ‘ODE’ tab. • Select ‘ODE Joint Front Left’. Move the center of the joint to the center of the

front left wheel. The setup should look similar to the one in the image below. Note the other three wheels are properly positioned already.

• Switch to Run / Edit Mode. • Press the spacebar to activate the physics simulation. Note the car falls down

onto the ground. • Drive the car around by using the arrow keys. Note the wheel suspension

behaves convincingly. • When ready, switch to Edit Mode.

Finished scene: • ..\Tutorials\ 4.2 – Physics simulation\Physics simulation 2 – Complete.cgr

Page 250: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

250

4.3 Database connectivity

Quest3D offers two types of database connectivity. The first is native MySQL, the second is ODBC 3.0. These two connection types cover a large portion of the exisiting database technologies. Note that Database connectivity is only available in the Quest3D Enterprise and VR Editions. At the heart of database functionality in Quest3D lies the connection to an external database. The DB Driver MySQL and DB Driver ODBC channels are used to setup a connection using their respective protocols. The DB Source channel represents the actual connection itself.

Queries After a MySQL driver connection has been established, the DB Query channel is used to retrieve and store data. In its properties window, the DB Source must be set and the query must be given a name. The actual query itself may be entered in the dialog, or connected as a Text channel to the first child link of the DB Query channel.

Page 251: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

251

Query parameters The second child link of the DB Query channel, ‘Input’, may be used to add parameters to the query. The first ‘Input’ child is referred to as ‘$$1$$’, the second as ‘$$2$$’, and so forth. Examples of often used MySQL commands include: • SELECT [column] FROM [table] WHERE [condition] • INSERT INTO [table] ([column1, column2]) VALUES [“value1”, “value2”]) • UPDATE [table] SET [column=”value”] WHERE [condition] Please refer to official MySQL documentation for more information on query commands and syntax.

Page 252: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

252

Storing data in Quest3D The results of a query may be stored in channels of type DB Value and DB Text. The properties windows of these two channel types allow you to select the query and field. The child links of these channels can be used to specify row and column number.

Using a For Loop structure, it is possible to retrieve a set of data and for example store it as seperate rows in an Array channel of the appropriate type.

ODBC ODBC in Quest3D work in a way similar to MySQL connections, except for the fact a connection is made with a driver instead of directly with a database. The ODBC driver may be set to connect to dBase, MS Excel and MQIS files, as well as MS Access databases.

Page 253: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

253

Please refer to official ODBC documentation for more information on query commands and syntax.

Page 254: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

254

Tutor ia l

The following steps form an exercise in accessing a remote MySQL database using Quest3D channels. The second example adds array functionality. Note: for this tutorial you will need access to a local or remote MySQL server. The following steps depend on a database named ‘quest3d’, containing a table called ‘player’, with columns for ‘id’, ‘name’ and ‘type’. For best results, the table should contain three or more records. Please feel free to adjust these data to your personal situation. Needed Quest3D scene: • ..\Tutorials\4.3 – Database connectivity\Datase connectivity 1.cgr Needed templates: • Enterprise \ Database \ DB Driver MySQL • Variables \ Text \ Text (x3) • Enterprise \ Database \ DB Source • Enterprise \ Database \ DB Info Value • Enterprise \ Database \ DB Query • Enterprise \ Database \ DB Text • Variables \ Value \ Value Step by step: • Open the file, ‘Database connectivity 1.cgr’. It contains a simple logic

structure. • Drag a DB Driver MySQL channel onto the Channel Graph. • Add a Text channel and connect it to the ‘Host’ child link of the ‘DB Driver

MySQL’ channel. Rename this Text channel to ‘Host’. Double click on the channel and change the text to ‘127.0.0.1’. This is the ‘localhost’ IP address. If you have access to a remote database, use its IP instead. Press ‘OK’ to accept and close the properties window.

• Drag another Text channel onto the Channel Graph and connect it to the ‘Database’ child link of the ‘DB DriverMySQL’ channel. Rename this Text channel to ‘Database’. Double click on the channel and change the text to ‘example’. This is the name of the database on the remote Quest3D webserver. Press ‘OK’ to accept and close the properties window.

Page 255: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

255

• Add another Text channel and connect it to the ‘Username’ child link of the DB DriverMySQL’ channel. Rename this Text channel to ‘User name’. Double click on the channel and change the text to ‘root’. Press ‘OK’ to accept and close the properties window.

• If the server needs a password, add another Text channel and connect it to the ‘Password’ child link. Change the text to the password.

• Drag a DB Source channel onto the Channel Graph. Double click on the channel to bring up its properties window. As ‘Name in Quest3D’, use ‘MySQL’ and select the ‘Rename channel’ option. Press ‘OK’ to accept.

• Connect the ‘DB DriverMySQL’ channel to the ‘DB Source’ channel. • Add a DB Info Value and connect it to the ‘Database’ Channel Caller. Double

click on the DB Info Value channel to open its properties window. From the first drop-down list, select the ‘Database Connected’ option. From the second drop-down list, select ‘MySQL’. Note this is the name of the connection specified in the DB Source channel. Press ‘OK’ to accept.

• Connect the ‘MySQL’ channel to the ‘One Time’ channel. • Double click on the ‘One Time’ channel to bring up its window. Press the

‘Reset’ button to call the channel’s children. After a few moments, the value of the DB Info Value channel should change to ‘1’. Close the properties window of the ‘One Time’ channel.

• Drag a DB Query channel onto the Channel Graph and connect it to the ‘Retrieve Data’ channel. Double click the ‘DB Query’ channel to open its properties window. From the first drop-down list, select ‘MySQL’. As the ‘Name of this query’, use ‘Get Player Info’. As ‘Actual query’, use SELECT * FROM player This will retrieve all data from the ‘player’ table. Press the ‘Execute’ button, then press the ‘Results’ button. A window showing the results of the query pops up. Press ‘Close’, then press ‘OK’ to accept.

• Add a DB Text channel and connect it to the ‘Text Out’ channel. Double click on the DB Text channel to open its properties window. Select the ‘name’ Field of the ‘Get Player Info’ Query. Select the ‘Rename channel’ option and press ‘OK’ to accept. Note a name is displayed on screen in the Animation 3D View window.

• Drag a Value channel onto the Channel Graph and connect it to the first child link of the DB Text channel. Rename the Value to ‘Index’.

Page 256: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

256

• Change the value of the ‘Index’ channel to ‘1’ to request the second record in the ‘name’ column. Note the name on screen changes with it.

Finished scene: • ..\Tutorials\4.3 – Database connectivity\Datase connectivity 1 – Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 257: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

257

Needed Quest3D scene: • ..\Tutorials\4.3 – Database connectivity\Datase connectivity 2.cgr Needed templates: • Variables \ Text \ Array Text (x2) Step by step: • Open the file, ‘Database connectivity 2.cgr’. It contains database connectivity

logic similar to the example above. • Drag an Array Text channel onto the Channel Graph and connect it to the

second child link of the ‘Set Name Text’ channel. Double click on the ‘Array Text’ channel to open its properties window. From the ‘Table’ drop-down list, select ‘Player’. From the ‘Column’ drop-down list, select ‘Name’. Select the ‘Update channel name’ option and press ‘OK’ to accept.

• Right click on the ‘Player: Name’ channel and from the menu, select ‘General Properties’. Set the ‘Update’ to ‘Continuous’ and press ‘OK’ to accept.

• Create a shortcut of the ‘Current Row’ channel and connect it as index value to the ‘Player: name’ channel.

• Switch to Run Mode. • Press the ‘F2’ key to import the database data into Quest3D. • Switch to Edit Mode. • Press the ‘Array Manager’ tab and select the ‘Player’ table. Note the column,

‘Name’ is filled with names from the correct column in the external database. • Press the ‘Channel Graph’ tab. • Add another Array Text channel and connect it to the first (empty) ‘Input’

child link of the ‘Set Player Name’ channel. Set the array to be a reference of the ‘Name’ column in the ‘Player’ table and rename it accordingly.

• Right click on this new ‘Player: Name’ channel and from the menu, select ‘General Properties’. Set the ‘Update’ to ‘Continous’ and press ‘OK’ to accept.

• Create a shortcut of the ‘Current Row’ channel of this For Loop, and connect it as index value to the ‘Player: Name’ channel you just created.

• Double click on the ‘Set Player Name’ channel. Fill in the following query: UPDATE player SET name="$$1$$" WHERE id="$$2$$" This will replace all records in the ‘name’ column of the ‘player’ table in the remote database. The ‘id’ column is used as primary index. Note that ‘$$1$$’ refers to the second child link of the ‘Set Player Name’ channel. ‘$$2$$’ refers to the third child link. Press ‘OK’ to accept.

Page 258: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

258

• Press the ‘Array Manager’ tab. • Change one of the names in the ‘Name’ column in the ‘Player’ tabl. Note the

name is changed in the right column on the screen in the Animation 3D View window, but not in the left column.

• Switch to Run Mode. • Press the ‘F3’ key to update the remote database with the Quest3D array

data. • Press the ‘F2’ key to reimport the data from the remote database into

Quest3D. Note the left column on the screen in the Animation 3D View window is updated.

• Switch to Edit Mode. • Double click on the ‘Insert Player Name’ channel. Fill in the following query:

INSERT player SET name="$$1$$" This will add a new record to the ‘player’ table in the remote database. Note that ‘$$1$$’ refers to the second child link of the ‘Insert Data’ channel. Press ‘OK’ to accept.

• Switch to Run Mode. • Press the ‘F4’ key to insert a new record to the remote database. • Press the ‘F2’ key to reimport the data from the remote database into

Quest3D. Note both left and right columns on the screen in the Animation 3D View window are updated.

Page 259: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

259

Finished scene: • ..\Tutorials\4.3 – Database connectivity\Datase connectivity 2 – Complete.cgr

Page 260: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

260

4.4 Networking

Certain applications might be designed for more than one user. Examples include virtual chat rooms, team-based training simulations and online multiplayer games. Each of the users has to run an instance of the application. Each of the instances needs to continuously communicate its current state. Networking functionality is used for communication between computers. Note that Networking is only available in the Quest3D Enterprise and VR Editions. In most cases, one of the computers in a network is usually made the ‘server’. The other computers are called ‘clients’.

A server handles all data transfer. It receives updates from all clients, and sends data to each of these clients as well. A server only sends when a client actually requests data. Quest3D network applications are set up as regular, ‘single user’ projects. Clients run most of the application locally. Only data influenced by other users are

Page 261: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

261

requested from the server over the network. Examples include user positions, avatar appearances and text in chat windows. Note that a client PC doesn’t need to have Quest3D installed. Clients can run published versions in the form of stand-alone ‘.exe’ files or ‘.q3d’ Viewer files. Usually, the server computer itself is a client as well. If this is not the case, the computer is called a ‘dedicated server’. The transfer speed is limited by both server and client. Quest3D supports network applications for up to 32 users. Larger numbers of users are technically possible, but might result in decreased performance. Logging in A client must ‘log in’ at a server. The server is selected from a list of all running network applications on a local area network (‘LAN’), or on a specified internet address (IP number). Generating or updating such a list of available network programs is called ‘enumerating’. Each network application has a unique ID to ensure clients log in at the correct program. Initialisation After the log-in procedure, the client program is initialised. This may include setting a start position, changing appearance and setting a role or character type. In addition, the ‘control’ over such attributes must be assigned to the newly logged-in client. User control over scene elements may be shared by changing assignments dynamically. Data transfer Network data can be transferred in Quest3D using the Network Value, Network Matrix, Network Text and Network Buffer channels. The first three types are inserted between a parent and its child.

Page 262: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

262

Network Values, Network Matrices and Network Texts may be sent and received in groups. In addition, a transfer guarantee may be set, to make sure data actually arrives at its destination. This option is slightly slower than regular transfer. Finally, Network Values and Network Matrices may be set to ‘Continuous’ movement, resulting in smoother animation. Buffers Channels of other types may be transferred over the network using the Network Buffer channel. It must be called independently, and the shared channel must be linked as its child.

Page 263: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

263

Network actions The Network Actions channel contains a number of functions such as creating and removing a server, disconnecting a client and setting user control. It also contains a number of triggers for events such as server creation, client log-in and connection refusal. Network information The Network Info Value channel contains a number of functions such as connection status, current user number and total number of connected clients. The Network Info Text channel holds the session and computer names. Network triggers Network Triggers can be used to guarantee an event is triggered on all clients. Regular triggers can be too imprecise for networking purposes.

Page 264: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

264

Tutor ia l

Network functionality allows for communication between two or more computers. Network projects in Quest3D are set up as ‘single user’ programs. They usually contain code for both server and client. The following exercise demonstrates creation of and connection to a server in Quest3D. The second tutorial is an advanced case, showing user control of variables. Needed Quest3D scene: • ..\Tutorials\4.4 – Networking\Networking 1.cgr Needed templates: • Enterprise \ Network \ Network Actions (x3) • Logic \ Expression Value • Enterprise \ Network \ Network Info Value Step by step: • Open the file, ‘Networking 1.cgr’. It contains a simple logic structure. • Drag a Network Actions channel onto the Channel Graph and connect it to the

‘Create Server Trigger’ channel. Double click on the ‘Network Actions’ channel to open its properties window. From the drop-down list in the properties window, choose ‘Create Server’. Select the ‘Update channel name’ option and press ‘OK’ to accept.

• Add another Network Actions channel and connect it to the ‘Create Server’ channel. Set and rename this Network Actions channel to ‘This PC created a server’.

• Drag another Network Actions channel onto the Channel Graph and connect it to the ‘Network Logic’ channel. Set and rename this Network Actions channel to ‘Connect to own server’.

• Connect the unlinked ‘MessageBox’ channel to the ‘This PC created a server’ channel.

Page 265: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

265

• Add an Expression Value and connect it to the ‘Player Connected?’ channel. • Drag a Network Info Value channel onto the Channel Graph and connect it to

the Expression Value you just added. Double click on the Network Info Value and set and rename it to ‘Connection Status’.

• Double click on the Expression Value and change the formula to ‘A==9’. Select the ‘Rename Channel to formula’ option and press ‘OK’ to accept. Note that a connection status of ‘9’ means a connection was established.

• Switch to Run Mode. • Press the ‘F2’ key. Note that after a few moments, a server is made and the

‘Connect to own server’ is triggered. Also note the ‘A player connected’ message on screen a few moments later.

• Switch to Edit Mode.

Page 266: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

266

Finished scene: • ..\Tutorials\4.4 – Networking\Networking 1 – Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 267: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

267

Needed Quest3D scene: • ..\Tutorials\4.4 – Networking\Networking 2.cgr Needed templates: • Enterprise \ Arrays \ Array Channel • Enterprise \ Network \ Network Matrix Step by step: • Open the file, ‘..\Tutorials\Networking 2.cgr’. It contains an environment, a

character and a 3rd person walkthrough camer, as well as network logic. • Go to the Animation Section. • Switch to Run Mode. • Press the ‘F2’ key to create a server. Note that after a few moments, the actual

3D scene is displayed. This means a server was created and a client connection was made.

• Test the scene by walking around. • When ready, switch to Edit Mode. • Go to the Channels Section. • Switch to Edit Mode. • Go to the Channels Section. • Disconnect the link between the ‘Animated Character’ channel and the

‘Character Motion’ channel. • Add an Array Channel channel. From the first drop-down list, select the

‘Characters’ table. From the second list, select the ‘Character Motion Network’ column. Select the ‘Update channel name’ option and press ‘OK’ to confirm.

• Add a Network Matrix channel and connect it to the ‘Characters: Character Motion Network’ Array Channel.

• Connect the ‘Character Motion’ channel to the ‘Network Matrix’ channel. • Create a shortcut of the ‘Current Iteration’ channel and connect it to the first

child link of the ‘Characters: Character Motion Network’ Array Channel.

Page 268: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

268

• Go to the Animation Section. • Switch to Run Mode. • Test the scene so far by moving around using the arrow keys and the mouse.

Press the ‘1’ through ‘3’ keys to switch the texture. The following part of the tutorial requires a second computer which will function as client. The two computers need to be connected through a local area network. • From the File Menu, choose ‘Save As’. Save the current project to your

project directory. • From the File Menu, choose ‘Publish’. Publish the project as a stand-alone

‘.exe’ file. • Copy the ‘.exe’ file onto the client computer. • Run the ‘.exe’ file on the client computer.

Page 269: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

269

• On the host computer, press the ‘F4’ key to log-in as client. Note after a few moments, the 3D scene is displayed.

• On the client computer, test the scene by moving around using the arrow keys. On the server computer, note the client character walking around.

• On the server computer, press the ‘1’ through ‘4’ keys to change the appearance of the server character. Note the changes are reflected in real-time on the client computer.

Finished scene: • ..\Tutorials\4.4 – Networking\Networking 2 – Complete.cgr • ..\Tutorials\4.4 – Networking\Networking 2 – Complete.exe

Page 270: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

270

4.5 Lua scripting

Quest3D channels are building blocks containing precompiled C++ and DirectX code. The entire set of channels provides functionality for many aspects of real-time 3D development. Despite the open and logical structure of the channels system, certain functionality can be handled more efficiently or more easily in script language. Quest3D supports Lua, a free third party scripting environment. Lua in Quest3D is especially applicable for cases such as loading and unloading channel groups, complex calculations and iterative structures (‘for loops’). The script of a Lua channel is displayed in its properties window:

Lua functions Lua channels can have one of two functions, or both. The first is ‘CallChannel’, and is executed when the channel is simply called.

Page 271: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

271

The second is ‘GetValue’, and is executed when the Lua channel is used as a value. The actual value of the Lua channel itself is equal to the value the script ‘returns’ at the end of the function. Variables Just like in other programming and scripting languages, variables used in a Lua script must be ‘declared’. This statement assigns memory to the variable. The word ‘local’ means that the variable is only used in one particular place, in this case the Lua channel. As soon as the script is done, the memory is cleared again. local variable You can also assign a value to a variable upon declaration. local variable = 1 Calculations work in a similar way to other programming languages. variable = variable + 1 Group functions Quest3D supports the following standard Lua group functions: ‘base’, ‘string’ and ‘math’. In addition, there is a ‘q’ group containing Quest3D specific functions. Two example functions are: local variable = math.cos(value) local variable = q.GetTick() The first example calculates the cosine of the value between the brackets. The second example retrieves the Tick Count, from the Quest3D Lua group ‘q’. Children Any number of children of any type may be connected to a Lua channel.

Page 272: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

272

Children may be accessed in a Lua script using the appropriate function. As usual, they have to be declared first. The statement below accesses the first child connected to the Lua channel (at position ‘0’). local variable = channel.GetChild(0) Children may be called using the following statements: local variable = channel.GetChild(0) variable:CallChannel() Note the difference between using functions of predefined and local structures. For predefined structures such as ‘channel’, a function is preceded by a ‘.’ (dot). For local structures such as variables, a function is preceded by a ‘:’ (double colon punctuation mark). The actual value of a Value channel connected to a Lua channel may be accessed using the following commands. local variable = channel.GetChild(0) local value = variable:GetValue() Text can also be retrieved, using the statements below. local variable = channel.GetChild(0) local text = variable:GetText() The value or text of a child may be set using the following commands: variable:SetValue(value) variable:SetText(text)

Page 273: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

273

For Loops Iterative structures, similar to ‘For Loops’ in Quest3D, can be written using the following statement: while i < max do i = i + 1 end Group loading Especially useful are the functions to load and unload channel groups. The statements are: q.LoadChannelGroup("group.cgr", "PoolName", instance) q.RemoveChannelGroup("PoolName", instance) These commands make group management within Quest3D very easy. More information on Lua in general can be found on the official website: http://www.lua.org

Page 274: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

274

Tutor ia l

Lua extends the ‘out of the box’ functionality set of Quest3D channels. The following exercise aims to familiarise you with the inner workings of the Lua channel and its two main functions: ‘CallChannel’ and ‘GetValue’. The second tutorial details a more advanced use of Lua in Quest3D: dynamic loading. Needed templates: • Logic \ Empty Lua Script (x2) • Logic \ Channel Caller. • Variables \ Value \ Value (x2) • Logic \ User Input \ User Input Step by step: • Start a new Quest3D project by choosing ‘New Project’ from the File Menu. • Drag a Lua channel onto the Channel Graph. Note it is automatically set to be

the Start Channel. Double click it to open its properties window. Note the window already contains script for two functions.

• In the ‘GetValue’ function, declare a new variable by typing in the following code: local currentvalue = 1

• Set the value of the Lua channel to the value of the variable by replacing the follow line: return -1 with return currentvalue

• Press the ‘CallValue’ button to execute the ‘GetValue’ function. Note the

actual value of the Lua channel changes to ‘1’.

Page 275: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

275

• Add a Channel Caller channel and rename it to ‘Project Start’. Set it to be the Start Channel.

• Add a Value channel and connect it to the ‘Project Start’ channel. • Connect the Lua channel to the Value. The Lua channel is now called as a

value every frame. In other words, the ‘GetValue’ function of the Lua script is now executed each frame. Or: the value of the ‘currentvalue’ variable is calculated and ‘returned’ each frame.

• Change the script to the following: function GetValue() local currentvalue = 1 currentvalue = currentvalue + 1 return currentvalue end Press ‘OK’ to accept. Note the value of the Lua channel is now ‘2’.

• Drag another Value channel onto the Channel Graph and connect it to the Lua channel. Change its value to ‘3’.

• Access the child by changing the Lua script to the following: function GetValue() local child0 = channel.GetChild(0) local currentvalue = child0:GetValue()

Page 276: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

276

return currentvalue end Press ‘OK’ to accept. Note the value of the Lua channel is now the same as the value of its child: ‘3’.

• Add another Value channel and connect it to the second child link of the Lua channel. Change its value to ‘4’.

• Change the script so it returns the sum of the values of the two children. Multiple solutions are possible. One is given below: function GetValue() local child0 = channel.GetChild(0) local value0 = child0:GetValue() local child1 = channel.GetChild(1) local value1 = child1:GetValue() local sum = value0 + value1 return sum end Press ‘OK’ to accept. Note the value of the Lua channel is now ‘7’, the sum of the values of its two children.

Page 277: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

277

Also note that for simple calculations, the Expression Value channel is easier to use.

• Drag another Lua channel onto the Channel Graph and connect it to the ‘Project Start’ channel.

• Add a User Input channel and connect it to the Lua channel. • Drag a Channel Caller onto the Channel Graph and connect it to the second

child link of the Lua channel. • Add another Channel Caller and connect it to the first Channel Caller. • Change the script for the ‘CallChannel’ function so that it only calls the

second child when the value of the first child is equal to ‘1’. It should look similar to the code below. function CallChannel() local child0 = channel.GetChild(0) local userinput = child0:GetValue() local child1 = channel.GetChild(1) if userinput == 1 then child1:CallChannel() end end Press ‘OK’ to accept. Note the first Channel Caller is active. This is because of the ‘GetChild’ statement in the script.

Page 278: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

278

• Switch to Run Mode. • Test the script by pressing and holding the spacebar. Note that while the

spacebar is pressed, the second Channel Caller is also called. Release the spacebar. Note the second Channel Caller is no longer called.

Also note that for simple conditional channel calling, the Quest3D If channel is easier to use.

Finished scene: • ..\Tutorials\4.5 – Lua Scripting\Lua scripting 1 – Complete.cgr If you wish, you can save the current channelgroup to your project directory. The following steps deal with a new scene.

Page 279: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

279

Needed Quest3D scene: • ..\Tutorials\4.5 – Lua Scripting\Lua scripting 2.cgr Step by step: • Open the file, ‘Lua Scripting 2.cgr’. It contains a simple logic structure. Note

the blue Public Call Channel. It reports the error, ‘Not Found’. This is correct. • Double click on the ‘Lua: Load Group’ channel to open its properties. Type in

the following code: function CallChannel() q.LoadChannelGroup (“Environment.cgr”, “Environment”, 0) end This script loads the channel group ‘Environment.cgr’ into the pool, ‘Environment’. The zero indicates the instance. Press ‘OK’ to accept.

• Switch to Run Mode. • Press the spacebar to load the specified group. Note the environment is

displayed in the Animation 3D View. • Switch to Edit Mode. • Add a line to load the group ‘Character.cgr’ into the pool ‘Character’.

function CallChannel() q.LoadChannelGroup (“Environment.cgr”, “Environment”, 0) q.LoadChannelGroup (“Character.cgr”, “Character”, 0) end

• Switch to Run Mode. • Press the spacebar to load both specified groups. Note the character is not yet

displayed in the Animation 3D View. This is because it is not yet called. • Switch to Edit Mode.

• Press the ‘Groups’ tab. • Drag the ‘Character’ pool onto the lower Channel Graph. • Drag a link from the ‘Character’ channel in the lower Channel Graph to the

‘Render’ channel in the upper Channel Graph. Note the ‘Character’ channel turns red, and a blue channel is created in the upper Channel Graph.

Page 280: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

280

• Press the ‘Animation 3D View’ tab. Note the character is displayed in the window.

• Double click on the blue ‘Character: Character -> Character’ channel to open its properties window. Select the ‘Disable Autoload’ option and press ‘OK’ to accept.

• Open the ‘Lua: Unload Group’ channel and type in the following code: function CallChannel() q.RemoveChannelGroup (“Character”, 0) end This script unloads the pool, “Character”. The zero indicates the instance. Press ‘OK’ to accept.

• Switch to Run Mode. • Press the backspace key to unload the specified group. Note the character

disappears from the Animation 3D View window. Also note the blue ‘Character’ channel reports a ‘Not Found’ error.

• Press the spacebar to load the specified groups again. Note the character reappears, and the blue ‘Character’ channel is valid again.

Finished scene: • ..\Tutorials\4.5 – Lua Scripting\Lua scripting 2 – Complete.cgr

Page 281: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

281

Appendices

Page 282: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

282

A1 Importing from Max and Maya

3D Studio Max Preparation tips • Delete all unnecessary objects (help lines etc.) • Select all remaining objects • Convert all objects to ‘Editable Mesh’ • Apply ‘ResetXForm’ to all objects • Convert all objects to "Editable Mesh" again. • In some cases you will see that some objects will be messed up with normals

pointing in the wrong direction. • Flip polygons for those objects that need it (mostly objects that were

mirrored) • If you have a skinned object, make sure that the stack only has an ‘Edit

Mesh’-modifier and a ‘Physique’/’Skin’-modifier above it. Modeling tips • Weld all vertices that need it with a ‘0,001’-distance. • Make sure all objects have smoothing applied (even if they don't need it, all

objects must have smoothing group(s) assigned). If you do not apply it manually, but rely on the automatic smoothing that primitives are created with, you can't be sure that it will be transferred correctly to Quest3D.

• Perform an ‘Attach List’ to reduce many objects sharing the same material to one (for example steps of a staircase). This will make it easier in Quest3D if you decide to change the materials.

• Whenever an object is mirrored, you'll most likely need to flip its polygons. This is only evident when you've applied a ‘ResetXForm’ and an ‘EditMesh’-modifier (as preparation for .X export).

• Don't create models where 2 planar surfaces overlap each other with little height distance. This will cause Z-buffer problems in Quest3D (flickering when the camera is high above the overlapping surfaces).

• Keep in mind that only faces and polygons will be visible in Quest3D. Lines cannot be exported.

Page 283: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

283

Material tips • No 2-sided materials are allowed. If any objects should be seen from both

angles, make a clone of the object with flipped polygons and attach it to the original.

• Always use the standard 3DSMax-material. • Materials with ‘Wire’ set to ‘on’ are useless in Quest3D. If you want to create

thin objects (such as rope or wire), you must model them using conventional geometry.

• Keep in mind that only objects mapped with the UVWmap-modifier or the UnwrapUVW-modifier are correctly exported to .x. Don't use the mapping features in the material editor (scale, crop etc.) as they're not exported.

Texture tips • Keep all the textures that you use in a given 3DSMax scene in the same

folder. When you import an .X file in Quest3D, it will scan the folder looking for the scene textures, so make sure to export your .X scene to the folder where your textures are located.

• Don’t use JPG textures with less than 8x8 pixels. This will make DirectX crash.

• For non-transparent objects, use JPG textures (or DDS textures if your target platform has graphics cards that support this). Texture sizes must adhere to a power of 2, meaning that 8, 16, 32, 64, 128, 256, 512 pixels are all valid sizes. 1024 & 2048 pixels are also allowed if the graphics card supports it (most modern cards do that)

• Keep in mind that the difference between a 512x512 texture and a 1024x1024 texture is 1:4, so the last-mentioned texture takes up 4 times as much memory of your graphics card than the smaller one. If you use textures that don't adhere to the power of 2-rule, Quest3D will automatically convert them by rounding up (i.e. a 768x972 texture will be converted to a 1024x1024) texture.

• For a transparent object, you can use one TGA (32-bit with alpha-channel included) or 2 JPGs (where the second holds the alpha channel information) or 1 PNG file. Keep in mind that TGAs are the better choices because they can be mipmapped (as opposed to using two JPGs).

• For transparent objects, you can also use a DDS with an alpha channel. If you pre-generate the MIP maps in Photoshop, your Quest3D project will start up faster: normally, all textures that have mipmapping enabled will have their mipmaps generated upon starting up the application. With DDS you can do this in advance.

Page 284: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

284

Maya Quest3D ships with .X Exporters for Maya up to version 6. There are several ways to install an .X exporter for Maya. You can use the way descripibed below or you can install the Microsoft DirectX 9.0c SDK. The Microsoft DirectX 9.0c SDK can be downloaded from the following page: http://msdn.microsoft.com/directx/ We recommend using the exporter from Microsoft, if needed, follow these steps for the installation and usage of the Maya 5 exporter. The steps also apply for older versions. • In the Start Menu, locate the directory,

‘Act3D/Quest3D/Extras/Exporters/Maya’. • Click on the ‘X exporter for Maya 5 (Vertex Color)’. • A message will remind you to read the ‘readme.txt’ in the file. Click OK. • Extract all files to a temporary directory, such as ‘C:\Temp’. You can delete

this directory when the installation is complete. The following instructions are taken from the Readme.txt file, and revised. • Make sure that Maya is not running • Copy ‘xExport.mll’ to the ‘\bin\plug-ins’ subdirectory in the Maya program

folder on your harddisk. • Copy ‘xfileTranslatorOpts.mel’ to ‘\scripts\others’. • Copy ‘bicubicBezierPatches.mel’ to ‘<mayapathname>\scripts\others’. • Copy ‘msvci70.dll’ and ‘msvcr70.dll’ to ‘<WINDIR>/system32’. • Run Maya. • Select ‘Window->Settings/Preferences->Plug-in Manager’ from the main

menu bar. • Turn on the ‘auto load’ checkbox next to ‘xExport.mll’. • Turn on the ‘loaded’ checkbox next to ‘xExport.mll’. To use the exporter, do the following: • Create an object or open your scene • Choose File -> Export All. Don't click on the name, but on the Options Box. • The Exporter Options will be shown. First change the Filetype in the drop-

down menu to “Xfile”. Several options will appear:

Page 285: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

285

• File Options deals with the way the file is constructed. Ascii will do fine. • Tesselation Options only apply if you use Nurbs or Subdiv patches. It is

recommended not to use these settings, but to convert all objects to polygons first. The result will be more accurate and predictable because of the control you have with the regular converting tools.

• Material Options deal with the textures. You can flip the U/V coordinates, and make the texture path relative or absolute. If you don't have textures, you can turn the “Export Materials” option off.

• Animation Options let you control the way in which the movement is exported. If you export the keyframes only, Quest3D will re-calculate the inbetweens. If you export every frame, the file will be much larger but more accurate.

• Skinning options apply if you have a skinned character. If you don't use bones, you can turn the “Export Skinning” option off.

• Click on ‘Export All’. A file dialog appears. Specify the filename and click on Export. The x file will be created, and you can import it in Quest3D.

Page 286: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

286

A2 User interface actions list

Move the mouse cursor to a specific position

Move the mouse to move the on-screen cursor to a specific position on the screen

Click Press the left mouse button and release Double-click Press the left mouse button, quickly

release and quickly press again, and release

Right-click Press the right mouse button and release

Press and hold the left button Press and hold down the left mouse button, do not release

Drag the mouse Press and hold down the left mouse button, do not release, and move the mouse around

Drag from a to b Press and hold down the left mouse button, do not release, and move the on-screen cursor to a specific position on the screen

Select an item Press the left mouse button while the on-screen cursor is over an on-screen item and release

Deselect an item Hold down the control key and press the left mouse button while the on-screen cursor is over a selected on-screen item

Multi-select items Move the on-screen cursor to the top left corner of the area you want to select, press and hold down the left mouse button, move the on-screen cursor to the bottom right corner of the area you want to select, and release

Add item to selection With other items currently selected, hold down the control key, press the

Page 287: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

287

left mouse button while the on-screen cursor is over the to be selected on-screen item and release

Drag onto the Channel Graph / Add

Drag the name of a channel or template in the Channels / Templates list onto the Channel Graph

Connect channel 1 to channel 2 / Link channel 1 to channel 2 Drag a link from channel 1 to channel 2

Drag a line from the top child link square of channel 1 to the middle of channel 2 / Select channel 1, hold down the ‘L’ key and click on channel 2.

Connect channel 1 to the first child link of channel 2

Drag a line from the top child link square of channel 1 to the first child link square below channel 2

Delete a channel Click on the channel once to select it, then press the ‘delete’ key.

Detach a channel / Unlink a channel / Delete the link between two channels

Click on the line between the two channels to select it and press the ‘delete’ key.

Create a shortcut of a channel Right-click on a channel and select the ‘Create Shortcut’ option / Right-click on a link and select the ‘Create Shortcut’ option

Open the properties window of a channel

Double-click on a channel / Right-click on a channel and select the ‘Channel Properties’ option

Rename a channel Right-click on a channel and select the ‘General Properties’ option, type in the new name in the appropriate field and press the ‘OK’ button to accept

Store a selection in a folder Make a selection, then press spacebar Explode a folder Click on a folder once to select it and

press the spacebar Go to a Section Press the appropriate Section button on

the Toolbar / Select the Section from the Application Menu under ‘Sections’ / Press the appropriate function key

Switch to Run / Edit / Run/Edit Mode

Press the appropriate button on the toolbar / Press ‘Pause Break’ key (toggles between Run and Edit Mode)

Page 288: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

288

A3 Keyboard shortcuts

F1 Help F2 Channels Section F3 Animation Section F4 Object Section F5 Arrays Section F6 Nature / Pathfinding Section Control C Copy channels Control X Cut channels Control V Paste channels ` Create channel shortcut Spacebar Create / explode folder Backspace Level up Pause Break Toggle Run / Edit Mode

Page 289: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

289

Glossary

Page 290: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

290

.dds file format, 93 .MP3 format, 126 .Wav format, 125 .X files, 87, 147, 151 ‘Doppler Factor’, 126 2D images, 121 2D layer, 120, 121 2-sided materials, 283 3D assets, 235, 236, 237 3D Graph, 217, 218, 219, 220, 221,

222 3D object, 57, 59, 64, 65, 69, 73, 90,

93, 94, 107, 110, 129 3D objects, 5, 8, 14, 15, 54, 56, 68, 69,

70, 73, 76, 77, 78, 87, 91, 106, 132, 175, 180, 205, 206, 233

3D positioning, 126 3d Studio Max, 87 3D Studio Max, 110, 130, 143, 282 3rd person, 115, 151, 267 ActiveX, 55, 62 alpha, 72, 74, 97, 100, 131, 139, 283 animation, 3, 8, 55, 69, 73, 78, 79, 82,

83, 85, 86, 87, 114, 125, 143, 144, 147, 150, 151, 152, 169, 200, 227, 233, 234, 238, 262

Animation, 3, 14, 15, 16, 23, 47, 50, 53, 55, 59, 69, 73, 75, 76, 78, 80, 81, 83, 84, 86, 90, 101, 106, 111, 112, 114, 117, 118, 122, 123, 128, 129, 136, 137, 141, 148, 150, 151, 152, 181, 182, 188, 191, 192, 193, 194, 203, 210, 211, 220, 222, 223, 229, 230, 231, 240, 245, 246, 249, 255, 258, 259, 279, 280, 285, 288

Animation 3D View, 16, 47, 50, 53, 59, 75, 76, 81, 90, 101, 111, 117, 118, 122, 128, 129, 136, 137, 141, 148, 151, 181, 182, 191, 192, 193,

194, 203, 220, 229, 230, 246, 255, 258, 259, 279, 280

Animation Section, 14, 16, 23, 80, 81, 83, 84, 86, 90, 106, 111, 112, 117, 118, 122, 123, 137, 148, 150, 151, 152, 194, 210, 211, 222, 223, 230, 231, 240, 245, 246, 249, 288

Anti Aliasing, 110, 112, 113 array, 153, 185 Array Command, 189 Array Manager, 186, 188, 191, 193,

194, 222, 257, 258 Array Table, 185, 186, 187, 189, 191 background color, 33, 35, 47, 56 Basetype, 32, 33, 35 biped, 143 bones, 143 Buffers, 262 camera, 5, 14, 56, 57, 68, 69, 75, 81,

95, 103, 114, 115, 116, 118, 121, 126, 128, 129, 132, 134, 135, 136, 138, 151, 208, 210, 211, 214, 215, 216, 220, 234, 236, 244, 246, 282

Camera, 54, 56, 57, 59, 81, 102, 103, 114, 115, 117, 118, 119, 122, 129, 147, 148, 159, 179, 180, 181, 196, 202, 206, 210, 211

channel, 3, 8, 9, 15, 18, 20, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 64, 68, 73, 74, 75, 76, 78, 79, 81, 82, 83, 84, 85, 86, 89, 90, 107, 108, 109, 111, 112, 117, 118, 121, 122, 123, 125, 126, 127, 128, 129, 133, 136, 137, 138, 139, 141, 142, 144, 145, 146, 148, 149, 150, 151, 152, 153, 155, 156, 157, 159, 160, 161, 162, 163, 164, 165, 166,

Page 291: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

291

167, 168, 169, 171, 172, 173, 174, 176, 178, 181, 182, 183, 185, 186, 187, 189, 191, 192, 193, 194, 196, 197, 198, 199, 202, 203, 204, 205, 206, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 226, 228, 229, 230, 231, 234, 236, 238, 239, 240, 242, 244, 245, 246, 248, 250, 251, 252, 254, 255, 256, 257, 258, 262, 263, 264, 265, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 283, 287, 288 start channel, 49

Channel Caller, 9, 25, 29, 30, 37, 38, 49, 51, 54, 128, 154, 155, 159, 162, 163, 181, 196, 255, 274, 275, 277, 278

Channel Callers, 36, 49, 52, 154, 159 channel graph, 68 Channel Graph, 16, 18, 19, 20, 21, 24,

25, 26, 28, 44, 57, 58, 59, 68, 83, 86, 90, 111, 112, 117, 118, 128, 129, 141, 142, 148, 149, 151, 159, 160, 161, 162, 163, 171, 172, 174, 181, 191, 192, 193, 202, 203, 211, 213, 214, 215, 220, 221, 222, 225, 228, 229, 230, 231, 244, 245, 248, 254, 255, 257, 264, 265, 274, 275, 277, 279, 287

Channel Group, 15, 18, 32, 52 Channel list, 17 Channel Properties, 41, 42, 287 Channel Switch, 54, 144, 157, 162,

163, 199 Channels, 5, 8, 9, 14, 15, 17, 23, 31,

38, 40, 43, 44, 48, 68, 76, 83, 85, 86, 111, 118, 123, 136, 149, 151, 176, 177, 188, 196, 197, 199, 211, 221, 222, 225, 228, 229, 230, 231, 238, 246, 262, 287, 288

Channels Section, 14, 15, 17, 23, 44, 76, 83, 85, 86, 111, 118, 123, 136, 149, 151, 211, 221, 222, 230, 246, 288

character animation, 143 Character animation, 150, 151, 152 characters, 7, 70, 82, 108, 109, 217,

227, 234 Child, 31, 32 Clear Screen, 32, 33, 34, 35, 36, 37, 38,

44, 45, 46 click, 22, 286 client, 237, 260, 261, 263, 264, 267,

268, 269 clipping planes, 115 Collision Object, 118, 137, 141, 215,

218, 220, 244 Collision Response, 118, 151, 209,

214, 215 color, 14, 33, 34, 35, 38, 40, 71, 72, 74,

76, 77, 78, 123, 138, 139, 164, 176, 183

Compression, 92 Context Menu, 41, 43, 46, 49, 53 Continuous Update, 176, 177, 182,

183, 193, 257, 262 Data storage, 187 data transfer, 260 database, 7, 55, 233, 250, 252, 254,

257, 258, 259 Database, 4, 55, 233, 250, 254, 255,

256, 257, 259 DB Query, 55, 250, 251, 254, 255 DDS, 283 dialog, 41, 47, 250, 285 Diffuse, 73, 74, 76, 107 Dimensions, 91 DirectX, 2, 11, 61, 62, 64, 65, 66, 87,

270, 283, 284 Distance Factor’, 126 double-click, 22, 54, 286

Page 292: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

292

dragging, 19 Edit, 75, 81, 117, 118, 123, 128, 129,

150, 151, 152, 161, 162, 172, 173, 174, 183, 214, 215, 222, 230, 231, 245, 246, 249, 257, 258, 265, 279, 282, 287, 288

Emissive, 73, 74, 77, 90, 107, 123, 183 Enterprise, 61, 233, 250, 254, 260,

264, 267 envelope, 73 Envelope, 78, 79, 82, 83, 85, 142, 146,

151, 152, 169, 171, 174 Envelopes, 78, 83, 139, 141, 142, 169,

170 exe, 11, 13, 61, 62, 63, 64, 65, 67, 261 Executable, 64, 65 exporter, 87, 284 Expression Value, 167, 171, 172, 173,

181, 210, 213, 265 Expressions, 168, 178 Finished scene, 48, 53, 60, 77, 86, 90,

105, 113, 117, 119, 124, 129, 137, 142, 150, 152, 163, 174, 184, 192, 195, 204, 212, 216, 223, 232, 247, 249, 256, 259, 266, 278, 280

finite state machine, 224 Finite State Machine, 54, 153, 224,

225, 227, 228, 229, 230, 231, 232 Fog, 2, 116, 132 folder*, 48, 60, 63, 64, 65, 90, 93, 101,

102, 103, 118, 122, 123, 135, 245, 283, 284, 287, 288

for loop, 175 For Loop, 3, 153, 175, 176, 178, 179,

180, 181, 182, 189, 200, 252, 257 For Loops, 189, 190, 200, 273 frame, 51, 52, 82, 83, 85, 121, 132,

148, 150, 153, 175, 176, 179, 181, 182, 275, 285

framerate, 51, 109, 121, 123

Functions, 197, 198, 199, 200, 203 games, 7, 115, 138, 260 Getting started, 3, 5, 8 Gizmo, 85, 210 graph, 75, 78, 81, 169, 170, 174, 194,

221, 229 graphics cards, 96, 131, 283 grid, 34, 112, 130, 141 Group loading, 273 group management, 273 Head-up Display, 120 Height maps, 130 Helper item, 34 HTML, 66 If, 11, 13, 24, 25, 40, 54, 64, 65, 66, 90,

103, 115, 116, 117, 118, 126, 150, 155, 157, 161, 162, 168, 175, 192, 212, 219, 236, 237, 247, 254, 255, 256, 261, 266, 278, 282, 283, 285

index value, 144, 185, 187, 257 Initialisation, 261 installation, 10, 11, 14 installer, 61, 64, 65 interface, 44, 53 Iterations, 178, 181, 183 Joints, 241, 242, 248 keyboard shortcuts, 288 Landscapes, 3, 69, 96, 101, 102, 130,

135, 137 License fees, 62 light, 24, 57, 68, 77, 97, 106, 107, 108,

109, 110, 111, 112, 113, 131, 132, 181, 183, 202, 207

Light mapping, 109, 110 Lighting, 3, 69, 75, 106, 110, 111, 112,

113, 132 lightmapping, 106 Lightwave, 2, 87 Lines, 282

Page 293: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

293

link square, 31, 32, 33, 37, 38, 39, 40, 58, 59, 68, 155, 194, 287

link squares, 31, 32, 34, 36, 37, 38, 39, 40, 44, 68, 187, 194

Linking, 37, 197, 206 Lite Edition, 61 Log bar, 75, 82 logic, 25, 153, 154, 159, 160, 171, 184,

223, 224, 228, 231, 254, 257, 264, 267, 279

Logic, 3, 9, 25, 118, 128, 147, 153, 154, 159, 163, 181, 213, 228, 244, 264, 274

Look At, 208, 210, 211, 221 Lua, 4, 233, 270, 271, 272, 273, 274,

275, 276, 277, 278, 279, 280 lua (scripting), 270 Material, 24, 73, 74, 75, 76, 77, 103,

104, 107, 113, 183, 283, 285 Math, 3, 153, 164, 171, 174 Mathematical operators, 3, 153, 205,

210, 212, 213, 216 Matrix, 54, 115, 193, 196, 205, 206,

208, 210, 211, 213, 214, 220, 221, 246, 248, 261, 267

Maya, 2, 4, 87, 110, 130, 282, 284 Mipmaps, 92 Modeling, 282 motion, 73 Motion, 73, 81, 122, 129, 138, 182,

193, 194, 205, 206, 208, 210, 211, 215, 217, 218, 219, 220, 221, 222, 238, 244, 245, 248, 267

Motion Planning, 219, 221 motionset, 144 Motionset, 55, 144, 145, 146, 147, 148,

149, 151, 152 motionset blender, 145 multiplayer, 260 Multiple passes, 131

music, 3, 55, 69, 125, 128, 129, 154, 235

MySQL, 250, 251, 252, 254, 255 Nature Painting, 132, 134, 180 Nature painting versus For Loops,

180 network, 260, 261, 262 Network, 55, 187, 261, 262, 263, 264,

265, 267 networking, 260 Networking, 4, 233, 260, 264, 266,

267, 269 object, 70 Object 3D View, 75 Object Section, 14, 23, 74, 75, 76, 77,

90, 95, 96, 98, 100, 101, 107, 110, 112, 134, 135, 288

ODBC, 250, 252, 253 ODE, 55, 209, 233, 238, 239, 240, 241,

242, 243, 244, 245, 246, 248, 249 Operator, 153, 189, 205, 206, 213, 214,

215, 220, 221 Parameters, 199 Parent, 31, 206, 210, 248 Parenting, 206 Particle, 3, 54, 69, 138, 139, 140, 141,

142 Particle Flow Grid, 139, 141 pathfinding, 7, 217, 219 Pathfinding, 3, 133, 134, 136, 137,

153, 217, 219, 220, 223, 288 physics, 7, 233, 238, 239, 244, 245,

249 Physics, 4, 55, 233, 238, 244, 247,

248, 249 polygon, 71 Polygon Object, 239, 241, 244 Polytrans, 87 position, 19, 22, 28, 29, 40, 45, 73, 77,

81, 85

Page 294: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

294

Project Camera, 59, 90, 101, 102, 117, 129, 137, 148, 151, 191, 193, 211, 246

Project management, 4, 233, 234 properties, 3, 5, 14, 41, 44, 47, 69, 75,

78, 79, 81, 84, 85, 86, 89, 91, 101, 103, 105, 106, 114, 125, 126, 128, 131, 134, 135, 139, 141, 142, 148, 156, 157, 161, 163, 165, 167, 172, 173, 174, 182, 185, 186, 187, 188, 189, 191, 193, 194, 198, 225, 229, 230, 231, 240, 244, 246, 248, 250, 252, 254, 255, 257, 264, 270, 274, 279, 280, 287

Public Call Channel, 197, 198, 200, 203, 279

publishing, 68 Queries, 250 real-time, 5, 7, 16, 51, 71, 72, 91, 106,

108, 109, 132, 153, 175, 205, 238, 270

references, 43, 187 Reflection map, 95, 103 Reject Alpha Pixels, 100, 104 render, 51, 56, 96, 112, 117, 118, 132,

176, 181, 202, 203 Render, 25, 54, 56, 57, 58, 59, 90, 107,

108, 111, 112, 117, 118, 141, 147, 148, 159, 179, 202, 203, 210, 279

resolution, 56, 113, 121, 174 RGB, 33, 74, 120 Rolloff Factor’, 126 Run, 65, 75, 81, 86, 90, 117, 118, 122,

123, 128, 129, 137, 150, 151, 152, 161, 162, 172, 173, 174, 182, 214, 215, 222, 223, 230, 231, 245, 246, 249, 257, 258, 265, 278, 279, 280, 284, 287, 288

Run/Edit, 75, 81, 287

Save, 9, 15, 47, 48, 55, 60, 64, 65, 66, 88, 127

screensaver, 61, 64 scripting, 4, 233, 270, 271, 278, 279,

280 sections, 14 server, 67, 254, 255, 260, 261, 263,

264, 265, 267, 269 shadow planes, 108 shadows, 3, 7, 69, 96, 106, 108, 109,

110, 111, 112, 113, 132 Shadows, 108 shortcut, 11, 111, 112, 122, 123, 129,

137, 142, 151, 152, 181, 182, 183, 193, 194, 210, 211, 215, 220, 221, 222, 223, 228, 244, 245, 246, 248, 257, 287, 288

shortcuts, 4, 43, 194, 211 skeleton, 143, 144 Sky domes, 131 sliders, 69, 76, 77, 120, 122 smoothing, 282 smoothing group, 282 sound, 11, 78, 125, 126, 128, 129, 234,

235 Sound, 3, 55, 69, 125, 126, 128, 129,

235 Sound Command, 126, 128, 129 special effects, 138, 139, 234 Specular, 73, 74, 77, 90 Stand-alone, 61, 62 Stencil Shadow, 108, 112 surface, 71 Surface properties, 101, 105 surfaces, 54, 75, 92, 98, 99, 104, 113,

115, 130, 141, 282 template, 21, 54, 57, 59, 68, 86, 90,

111, 115, 117, 118, 141, 142, 148, 151, 181, 182, 215, 239, 287 templates list, 19

Page 295: Quest3D 3.0 Tutorial Manual_中文化

Q u e s t 3 D 3 . 0 T u t o r i a l M a n u a l

295

Template list, 17 templates, 9, 21, 54, 55, 57, 83, 89,

111, 114, 117, 118, 128, 135, 141, 147, 151, 159, 171, 181, 191, 193, 202, 210, 213, 220, 237, 240, 244, 248, 254, 257, 264, 274

Templates, 3, 5, 9, 19, 21, 25, 54, 57, 58, 68, 69, 121, 134, 287

texture, 14, 69, 71, 72, 73, 74, 75, 77, 87, 91, 92, 93, 94, 95, 96, 97, 100, 101, 102, 103, 108, 110, 112, 113, 131, 134, 135, 136, 194, 200, 203, 283, 285

Texture, 54, 73, 74, 75, 76, 95, 96, 97, 101, 102, 103, 104, 110, 112, 134, 135, 136, 187, 192, 194, 203, 283

Texture Blend Factor, 73, 74 textures, 72, 74, 75, 91, 92, 93, 94, 97,

99, 101, 121, 131, 135, 139, 194, 236, 283, 285

Time based state changes, 227 Time Slider Bar, 82, 84 Timer, 55, 78, 79, 80, 82, 83, 84, 148,

149, 211 Timer Commands, 79, 83 Toggle/FlipFlop, 239, 245 Toolbar, 16, 23, 59, 75, 81, 287 transparency, 69, 72, 74, 75, 77, 78,

90, 91, 95, 96, 99, 100, 101, 131, 134, 138

Transparency, 72, 75, 77, 95, 96, 103, 104

transparent, 283 trees, 101, 104, 132, 137 Triggers, 155, 156, 220, 244, 263 tutorial, 1, 8, 23, 48, 57, 63, 76, 83, 88,

101, 122, 159, 171, 181, 223, 228, 236, 244, 254, 264, 274

Tutorial, 23, 44, 53, 57, 63, 76, 83, 88, 101, 111, 117, 122, 128, 135, 141,

147, 159, 171, 181, 191, 202, 210, 220, 228, 236, 244, 254, 264, 274

user input, 156 User input, 35, 68, 120, 157 User Input, 35, 54, 121, 146, 147, 149,

156, 157, 160, 161, 162, 173, 174, 213, 274, 277

user interface, 3, 5, 22, 23, 44, 53, 69, 120, 122, 124, 234, 236

UV mapping, 93, 94, 95, 103, 110 UV Mapping, 93 value, 73 Value, 9, 31, 32, 33, 34, 35, 36, 37, 38,

41, 44, 45, 47, 54, 55, 77, 78, 79, 80, 81, 82, 83, 84, 85, 95, 96, 97, 103, 123, 134, 139, 141, 142, 145, 146, 147, 148, 149, 150, 151, 152, 160, 163, 164, 165, 166, 167, 171, 172, 173, 178, 180, 181, 182, 183, 185, 187, 189, 191, 192, 193, 194, 196, 199, 202, 203, 205, 206, 210, 211, 213, 215, 216, 219, 220, 221, 223, 226, 229, 230, 231, 243, 244, 252, 254, 255, 261, 263, 264, 265, 272, 274, 275, 276, 277

Value Damping, 147, 151 Variables, 44, 54, 141, 147, 151, 171,

181, 185, 191, 193, 202, 210, 213, 220, 254, 257, 271, 274

vector, 73, 74, 85, 106, 107, 108, 112, 118, 141, 185, 186, 205, 206, 214, 215, 221, 246

vertex, 70 virtual reality, 7, 68, 205 visualisation, 63, 114, 115, 236 VR Edition, 233 WinAmp, 55, 61, 64 Z buffer, 121