Virtools User Guide
Virtools User Guide
Virtools may make improvements and changes to the product described in this document at
any time without notice. Virtools assumes no responsibility for the use of the product or this
document except as expressly set forth in the applicable Virtools license agreement or license
agreements and subject to the terms and conditions set forth therein and applicable Virtools
policies and procedures. This document may contain technical inaccuracies or typographical
errors. Periodic changes are made to the information contained herein: these changes will be
incorporated in new editions of the manual.
Windows and Internet Explorer are registered trademarks of Microsoft, Navigator and Com-
municator are registered trademarks of Netscape Communications. All other brand or product
names are the trademarks or registered trademarks of their respective holders.
Thanks to Ouali Chabi and idenao (G. Lancrey and R. Enjalbert) for help with the tutorials,
and to Erwann Surcouf and Boris Duong for line art.
Table of Contents
1
Table of Contents
5 Document Conventions. . . . . . . . . . . . . . . 27
5.1 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.2 Emphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.3 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.4 Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.5 Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.6 Building Blocks (BBs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.7 Parameter Operations (paramOps) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.8 Parameter Names (pNames) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.9 Parameter Types (pTypes). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.10 Parameter Values (pValues) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.11 File, Resource and Object Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.12 Graphical User Interface (GUI) Elements . . . . . . . . . . . . . . . . . . . . . . 31
5.13 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2
Table of Contents
3
Table of Contents
4
Table of Contents
5
Table of Contents
6
Table of Contents
7
Table of Contents
8
Table of Contents
30 Glossary . . . . . . . . . . . . . . . . . . . . . . . 181
30.1 How to Use the Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
9
Table of Contents
10
1
PART 1 - INTRODUCING
VIRTOOLS DEV
Welcome to Virtools Dev. Start here and we should have you up and running
in no time at all.
Part 1 contains:
1 What is Virtools Dev? - a short description of the components that
make up Virtools Dev
2 About this User Guide - an overview of this user guide
3 Installing Virtools Dev - installation requirements and installation
procedures
4 Getting More Information - how and where to find further infor-
mation
5 Document Conventions - how to interpret the style guidelines used
in this User Guide
11
1 Introducing Virtools Dev
12
What is Virtools Dev? 1
13
1 Introducing Virtools Dev
perform its duties. Some of these managers (such as the TimeManager) are an
internal part of the Behavioral Engine while others (such as the SoundMan-
ager) are external to the Behavioral Engine.
Virtools Dev's Behavioral Engine is often referred to as CK2, the name of the
central software component.
14
What is Virtools Dev? 1
• replace the Virtools Dev render engine with a render engine of your
choice
• create a custom executable file (.exe)
• modify and extend the Virtools Dev render engine – full source code
to the rendering engines is provided.
These are just a few examples – your creativity is the only limit to how far you
can go!
15
1 Introducing Virtools Dev
16
About this User Guide 1
17
1 Introducing Virtools Dev
18
About this User Guide 1
The particles tutorial is just a sample of what is to come. Further tutorials will
be posted to the Virtools website on a regular basis and you can even find
some previews in the Virtools MiniSite.
The Virtools MiniSite is installed in the Documentation folder. However, if
you chose not install this component, you will have to launch the installation
program once more, and choose to install the MiniSite only.
2.6 Appendix
At the end of the User Guide, last - but certainly not least - is the Appendix.
Our appendix is larger than most - mostly because of our extensive glossary.
The Virtools Glossary contains definitions for many Virtools words and terms
that newcomers and pros alike will come to appreciate for their clarity and
valuable contextual information.
The Glossary is not all there is to the Appendix - you will also find further
help for those tricky orientation and transformation questions.
19
1 Introducing Virtools Dev
20
Installing Virtools Dev 1
3.1 Hardware
• Pentium II or equivalent
• 64 MB of RAM
• CD-ROM drive
• Monitor capable of displaying 1024 by 768 in 16 bit color (65536 color/
Hi-color)
• Direct3D or OpenGL compatible 3D graphic accelerator card with 8 MB
of RAM
• Pointing device (mouse, trackball, etc.)
• Sound Card (not a requirement but recommended)
3.2 Software
• Microsoft Windows (95, 98, 98SE, ME, 2000 or NT 4.0 (with Service Pack
6))
• Microsoft Internet Explorer 4.0 or higher (for the Online Reference)
• Microsoft DirectX 5.0 or higher for DirectX compatible 3D graphic accel-
erator cards
21
1 Introducing Virtools Dev
disk space.
1. Insert the Virtools Dev CD
2. Follow the on-screen instructions
3. If your CD-ROM drive does not automatically run the installation pro-
gram, manually execute Setup.exe in the Dev folder of the Virtools Dev
CD-ROM
NOTE If you have previous versions of Virtools software installed on your computer,
ensure that you install this version in a new program folder to avoid any poten-
tial upgrade problems.
NOTE Virtools Dev uses a new file format that is not backwards-compatible with file
formats used by previous versions of Virtools products. However, Virtools Dev
can open and use files saved by previous versions of Virtools products.
22
Getting More Information 1
4.1.1 Screentips
Screentips are available for all icons and most buttons in the Virtools Dev
interface. A screentip is a text popup that appears when the mouse hovers over
an icon or button. Screentips are used by Virtools Dev to display the name of
an icon or button, and to display the keyboard shortcut for that icon or button
if one exists.
23
1 Introducing Virtools Dev
24
Getting More Information 1
25
1 Introducing Virtools Dev
26
Document Conventions 1
5 DOCUMENT CONVENTIONS
This section defines the document conventions used throughout the User
Guide.
NOTE You are strongly encouraged to refer to the Glossary whenever you encounter a
term that is unfamiliar. Virtools Dev uses a wide variety of terms, some that are
unique to this development environment. These terms, and many terms from
the field of 3D graphics, are explained in the Glossary.
5.1 Organization
The User Guide is organized into five numbered Parts. Each Part presents an
overview of the Sections contained in that Part. Sections, and the topics within
each Section, are organized using outline numbering.
For example, a series of Sections with the following numbering indicates that
the material is organized and related as stated.
2 Major Topic
2.1 Sub-topic of 2
2.1.1 Sub-topic of 2.1
2.1.2 Sub-topic of 2.1
2.2 Sub-topic of 2
5.2 Emphasis
Emphasis is used to draw your attention to
• a particular point that is important to comprehension of the matter
under discussion.
For example:
Objects instantiated from these classes are the objects that can have
behaviors attached to them but they are not required to have behaviors.
27
1 Introducing Virtools Dev
• the first time a term specific to Virtools Dev is used. You are advised
to consult the Glossary for further information on that term.
For example:
In Virtools Dev the point of reference is identified as the referential.
NOTE Emphasis is also conveyed using notes like this.
5.3 Lists
Numbered lists indicate that the list elements are related in an ordered manner.
For example, the list elements may enumerate all possible options or detail a
sequence of events.
Bulleted lists indicate that list elements are related but that no special order is
implied by the sequence in which the list elements are presented. For example,
the list elements may provide a partial list of possible options or suggested
applications.
5.4 Figures
A figure is presented in the section that first references the figure. Within a
paragraph, a figure reference is presented as shown.
If you look at the Material Setup in 8-4, you can see...
5.5 Acronyms
Many terms have acronyms in Virtools. The first time a term commonly
referred to by an acronym is used in a section, the term is spelled out followed
by the acronym in brackets.
• Software Development Kit (SDK)
• Building Block (BB)
Once an acronym is introduced, the acronym is used interchangeably with the
28
Document Conventions 1
29
1 Introducing Virtools Dev
30
Document Conventions 1
5.13 Attributes
All Attributes are formatted as shown.
The frame now has the attribute Particle Plane Deflector.
31
1 Introducing Virtools Dev
32
2
PART 2 - LOOKING AT
VIRTOOLS DEV
Looking At Virtools Dev is a brief guided tour of the Virtools Dev interface.
The icons used by Virtools Dev are presented, identified, and briefly
described.
If you like to know what the user interface controls mean before you use a
product, then this is the part for you.
6 Virtools Dev at Start-Up - a guided tour of the Virtools Dev inter-
face in its default state
7 Menu Bar - a closer look at the Menu Bar and some of its enhanced
features
8 3D Layout - the tools for manipulating your compositions
33
2 Looking at Virtools Dev
34
Virtools Dev at Start-Up 2
Virtools Dev is effectively divided into three main regions, with a menu bar at
the top and a status bar at the bottom.
The top left region contains the 3D Layout window, used to visualize your
project in real-time. The top right region contains resources in the form of
35
2 Looking at Virtools Dev
To return window sizes to their start up state, choose Refresh Windows (F5)
from the Options menu.
36
Menu Bar 2
7 MENU BAR
The menu bar is at the very top of the Virtools Dev screen. There are five
menus in Virtools Dev: File, Resources, Editors, Options and Help.
To the right of the Help menu, the menu bar also contains the name of the
current scene and the file name and path of the current composition (CMO).
7-1 The Menu bar.
Below you will find the name of all Virtools Dev menus followed by short
description.
File Menu: file management, open, save and export files.
Resources: resource management, create new data resources, import media.
Editors: additional managers and debuggers.
Options: General Preferences and several useful tools for managing the inter-
face.
Help: the Online Reference and the About... box.
Please refer to the Online Reference (Interface) for further information about
the options within in each menu.
37
2 Looking at Virtools Dev
38
3D Layout 2
8 3D LAYOUT
The default position for the 3D Layout window is the top left region. 3D Lay-
out consists of a top toolbar, a left toolbar and the rendering window.
8-1 3D Layout
The type of elements and how they appear in the render window depends
greatly on the preferences you have set. See the Online Reference for further
information (Interface/Menu Bar/Options Menu/General Preferences).
Not all tools are visible at all times. For example, the tools for choosing an axis
constraint or planar constraint appear only when you choose either Select and
Translate or Select and Rotate.
Below you can find all the icons contained in the 3D Layout, each icon with its
name and a short description. For further information, including how to use
each tool, refer to the Online Reference (Interface/3D Layout).
39
2 Looking at Virtools Dev
3D Layout Explorer
Tool for inspecting all elements in 3D Layout.
Selection Group
Choose an existing selection group or create a new selec-
tion group.
Select Camera
Displays the current active camera, lists all available
cameras.
General Preferences
Opens the General Preferences dialog box.
40
3D Layout 2
Constrain X, Y or Z Axis
Constrains movement to either the X, Y or Z Axis.
NOTE The Constrain Axis icons only appear when either Select and Translate or
Select and Rotate is active.
Constrain Plane
Constrains movement to the XY, YZ or ZX plane.
NOTE The Constrain Plane icons only appear when either Select and Translate or
Select and Rotate are active.
Referential Axis
Selects the referential for translation and rotation operations in
the 3D Layout.
NOTE The Referential Axis icon only appears when either Select and Translate or
Select and Rotate are active.
Toggle Snap
Selects the Snap mode for the movement.
NOTE The Toggle Snap icon only appears when one of the transformation tools is
active.
Toggle Hierarchy
Determines if the movement should apply to the selection’s children.
NOTE The Toggle Hierarchy icon only appears when one of the transformation tools is
active.
Pivot Axis
Determines the pivot point (Object, Local, Selection Center)
for a rotation or scale operation.
NOTE The Pivot Axis icon only appears when either Select and Rotate or Select and
Scale are active.
41
2 Looking at Virtools Dev
NOTE If you do not want a Setup to open when you create an entity, change the set-
tings in the 3D Layout - Interface section of the General Preferences. See
the Online Reference for further information (Interface/Menu Bar/Options Menu/
General Preferences)
42
3D Layout 2
NOTE The Roll Camera icon only appears when the currently active camera does not
have a target.
Camera Pan
Moves the camera and its target (if any) along the camera’s XY plane.
Orbit Target/Orbit Around
Orbit (rotate around) the selection or rotate the camera about its
own origin.
43
2 Looking at Virtools Dev
44
Building Blocks and Data Resources 2
Building Blocks contains the behaviors provided with Virtools Dev and used
by you to make your content interactive. VirtoolsResources is the sample
Data Resource provided with Virtools Dev. VirtoolsResources contain
media data (with or without scripts attached) and Behavior Graphs in file for-
mats that Virtools Dev can use.
Perhaps the most appropriate analogy is to consider Building Blocks as a
library of behaviors, organized by the type of behavior and/or by the type of
element to which the behavior can be attached. Data Resources can be con-
sidered project management tools - you organize your media on a per project
basis, creating a new Data Resource for each project. Of course, you do not
have to use Data Resources in this way - you are free to keep all of your
45
2 Looking at Virtools Dev
Building Blocks (BBs), however, cannot be added in the same manner - they
must also be attached to a Behavioral Object (BeObject). You can either drag a
BB onto a BeObject in the 3D Layout or Level View, or drag a BB directly
into a script in the Schematic.
For more information, see the Understanding Virtools Dev part of this User
Guide and also refer to the Online Reference (Interface/Building Blocks
Resource and Interface/Data Resources).
NOTE If you performed a typical install, the default Data Resources are VirtoolsRe-
sources. You can remove the VirtoolsResources from the display (by right
clicking on the tab and closing the window). You can also create and add your
own Data Resources.
46
Level Manager 2
10 LEVEL MANAGER
The default position for the Level Manager is in the bottom half of the
screen. The Level Manager consists of a top toolbar, a left toolbar and the
main window listing all elements of the Level or Scene by CKClass.
10-1 The Level Manager
The Level Manager helps you to organize your composition, and contains a
wealth of information.
NOTE There are two modes for the Level Manager: Level (the default mode) and
Scene.
Below you can find all icons and buttons contained in the Level Manager,
each icon and button with its name and a short description. For further infor-
mation, including how to use these tools, refer to the Online Reference (Inter-
face/Level Manager).
47
2 Looking at Virtools Dev
Expand Selected
Expands the selected branch.
Collapse Selected
Collapses the selected branch.
IC for Selected
Sets Initial Conditions (IC) for the selected elements.
48
Schematic 2
11 SCHEMATIC
The default position of the Schematic is in the bottom half of the screen,
behind the Level Manager. The Schematic consists of a top toolbar and,
once you have started creating interactivity, scripts.
11-1 The Schematic at start up
NOTE The Schematic usually contains scripts (without scripts, you cannot have any
interactivity!). See “Behaviors and Scripts” on page 107 and the Online Refer-
ence (Interface/Schematic) for further information on scripts.
The Schematic allows you to manage and edit your scripts. Scripts contain the
interaction of a composition; scripts visually describe behaviors.
NOTE You do not actually create scripts in the Schematic. New scripts are created in
the 3D Layout or Level Manager and interactivity is assembled in the Sche-
matic.
Below you will find all icons and buttons contained in the Schematic, each
icon and button followed by its name and a short description. For further
information, including how to use these tools, refer to the Online Reference
(Interface/Schematic).
49
2 Looking at Virtools Dev
50
Schematic 2
51
2 Looking at Virtools Dev
52
Status Bar 2
12 STATUS BAR
The Status Bar is at the very bottom of the Virtools Dev screen.
12-1 The Status Bar.
Below you will find an image of these information fields or icons, followed by
the name and a short description. For further information, including how to
use these tools, refer to Online Reference (Interface/Status Bar).
Selection
Displays the name of selected element.
Action
Displays the name of the action you are perform-
ing.
Coordinates
Displays the XYZ coordinates of a selected object.
Event Log
Opens the Event Log. Ongoing Event
Log messages are displayed next to
the Event Log icon as they occur.
Profiler
Opens the Profiler.
FPS (Frames Per Second)
Displays the current number of frames per second; displays NA
while in Author mode and updates continually in Play mode.
53
2 Looking at Virtools Dev
54
3
PART 3 - 3D SPACE IN
VIRTOOLS DEV
3D Space in Virtools Dev describes how Virtools Dev creates its 3D space
and the rules that govern it. Just how can you have a 3D space on a 2D screen?
This part is essential reading for those new to 3D and recommended for those
who have been working in 3D for some time. Concentrating on the basic con-
cepts of 3D, and how they are expressed in Virtools Dev, this part starts off
nice and easy and before you know it, you are done!
If you can't get enough of vectors and matrices, there are one or two sections
in the Appendix that will interest you too.
13 Virtools Dev and 3D Graphics - some basic terminology to get
you started
14 Coordinate Systems - how Virtools Dev measures things, con-
trols position and controls orientation; the basics of the mathematics
behind the scenes
15 Transformations - how to translate, rotate, and scale with a mini-
mum of mathematics
16 Matrix Operations - a brief introduction to the mathematics
behind transformations
17 Worlds and Levels, Places and Scenes - how Virtools Dev
implements classic game constructs
18 Cameras and Rendering - how Virtools Dev decides what to
show in the render window
19 The Render Engine - an overview of the Virtools Dev rendering
architecture
55
3 3D Space in Virtools Dev
56
Virtools Dev and 3D Graphics 3
57
3 3D Space in Virtools Dev
58
Coordinate Systems 3
14 COORDINATE SYSTEMS
Coordinate systems define the space or volume of a simulated environment
(called a Level in Virtools Dev, often called a World in other products).
Virtools Dev uses two coordinate systems: a 2D coordinate system for screen
positions and a 3D coordinate system for rendering 3D elements.
59
3 3D Space in Virtools Dev
14-2 A 2D point
60
Coordinate Systems 3
NOTE The center of the world coordinate system is not necessarily the center of the
visible elements in the Level. You can place the visible elements of your compo-
sition at any position that you choose, not just centered about the origin of the
world coordinate system.
61
3 3D Space in Virtools Dev
14.2.2 3D Coordinates
A 3D coordinate is a position in a 3D coordinate system (i.e. within a level),
expressed as (X,Y,Z) where:
1. X is the horizontal displacement of the point from the origin,
2. Y is the vertical displacement of the point from the origin, and
3. Z is the depth displacement of the point from the origin (the displace-
ment into or out of the screen).
For example, 14-3 illustrates a 3D point with coordinates (4,4,4).
14-3 A 3D Point
14.2.3 Vectors
Direction (such as the direction a character is facing) and length (such as the
distance between two elements in a level) are expressed as vectors. A vector is
expressed as (X,Y) for vectors within a 2D coordinate system (called a
Vector2D in Virtools Dev) and expressed as (X,Y, Z) for vectors within a 3D
coordinate system (called a Vector in Virtools Dev).
62
Coordinate Systems 3
NOTE The syntax for expressing points and vectors is identical! Therefore, you must
always be careful to determine the context when presented with a value in the
form (X, Y, Z).
For example, the origin of the character’s local coordinate system may be set to
the heel of the character’s left foot. The positions of the various body parts are
then defined relative to the origin of the local coordinate system. The right
foot might be 0.3 units from the origin in the positive X direction (+X) and
the head might be 0.15 units in the positive X direction (+X) and 1.5 units in
63
3 3D Space in Virtools Dev
The position, orientation and scale of an element in the local coordinate sys-
tem are stored in a data structure called the local matrix.
64
Coordinate Systems 3
14.2.7 Orientation
Every 3D Entity also has an orientation. The orientation of a 3D Entity (includ-
ing Characters) is defined by three vectors:
1. The Right vector.
From the 3D Entity’s perspective, the Right vector points to the right.
The default Right vector for a 3D Entity is the positive X axis of the
local coordinate system.
2. The Up vector.
65
3 3D Space in Virtools Dev
Y Z
UP DIR
X
RIGHT
66
Coordinate Systems 3
vector = (0,0,1)). Both elements have the expected Up vector of (0,1,0) and
both elements face in the direction of the world’s X-axis.
14-7 Orientation and the Referential
Z
X
Local Dir
-Z
Local Right
Element 1
-X
Z
Local Dir
X
Local Right
Element 2
Default Dir
-X X
Default Right
World
67
3 3D Space in Virtools Dev
NOTE All coordinate systems in 14-7 are viewed from above with the positive Y-axis
toward the reader.
68
Transformations 3
15 TRANSFORMATIONS
Transformations are simple operations that can be performed on an element:
1. Translation – move the entity.
2. Rotation – change the facing direction of the entity.
3. Scale – change the size of an entity.
You can perform transformations on elements in Author mode by using the
transformation tools in 3D Layout, or changing the parameters for an element
in its Setup. Alternatively, you can use transformation BBs.
Transformations are always performed relative to a referential entity. The ref-
erential entity can be the entity itself, the world coordinate system, or any
other entity in the world that has a local coordinate system. 15-1 summarizes
the most common transformation BBs.
15-1 Transformation BBs
Translation
Translate Move the target entity, relative to the referential entity,
within the current frame.
Move To Move the target entity, relative to referential entity, over a
specified number of frames or over a fixed period.
Rotation
Rotate Rotate the target entity about the local origin (the origin
of the target entity’s local coordinate system), according
to an axis defined relative to the referential entity coordi-
nate system
Rotate Around Rotate the target entity about the referential origin (the
origin of the referential entity’s local coordinate system),
according to an axis defined relative to the referential
entity coordinate system
69
3 3D Space in Virtools Dev
Scale
Scale Change the size of the target entity. The new size can
specified as Absolute (in the world coordinate system) or
as Relative (in the target entity’s local coordinate system)
70
Matrix Operations 3
16 MATRIX OPERATIONS
Matrix operations provide the greatest degree of direct control over transfor-
mations. However, you do not have to use matrices to manipulate the elements
of your composition. Virtools Dev provides many BBs (e.g. Translate,
Rotate, Scale, and Set Position (all in 3D Transformations)) that allow you to
manipulate the elements of your composition without matrices.
Matrices are shown differently in the Edit Parameters dialog box, as shown in
16-1, and in the Parameter Debugger, as shown in 16-2.
71
3 3D Space in Virtools Dev
72
Worlds and Levels, Places and Scenes 3
The Level is the ancestor element for all parts of a composition. As an ele-
ment, the Level has the special name --NULL-- when used as a referential.
A Place is an abstract element used to identify the elements found within a
physical locale in a composition. For example, within a building, each room
can be defined as a separate Place.
A Scene is an abstract element used to define the elements within a narrative
unit of a composition and is not restricted to a physical locale within a compo-
sition. Scenes can be used to control which elements are active at what time: in
this part of the story, only these elements are active whereas in that part of the
story only those elements are active.
73
3 3D Space in Virtools Dev
Places and Scenes are mechanisms used to organize the media within your
composition and to optimize the performance of your composition. The ele-
ments within a Place or a Scene can be made Active or Inactive. Only active ele-
ments are processed; significant performance gains can be realized through
the proper application of Places and Scenes.
74
Cameras and Rendering 3
75
3 3D Space in Virtools Dev
76
Cameras and Rendering 3
what will be drawn when by remembering that smaller numbers (including nega-
tive values) mean further away and larger numbers (more positive) mean
closer. 2D Entities that are farther away are drawn before 2D Entities that are
close.
18-1 Z order number and rendering order, relative to the active Camera.
77
3 3D Space in Virtools Dev
78
The Render Engine 3
79
3 3D Space in Virtools Dev
80
4
PART 4 - UNDERSTANDING
VIRTOOLS DEV
Understanding Virtools Dev explains (almost) all you ever wanted to know
about Virtools Dev but didn't know who to ask. This part answers questions
like: Is it possible to have more than one level in a composition? and Why can some behav-
iors only be applied to certain elements?
Whatever your experience level, this part is essential reading for everyone. You
could get along working in Virtools Dev without reading this part, but why
make things hard for yourself ?
20 Elements, Classes, and Object Oriented Design - explores and
explains the relationships between the elements of a composition
21 The Elements of a Composition (CMO) - the pieces that you
assemble to form a composition
22 The Virtools Dev Process Loop - an introduction to processing
behaviors and rendering the results
23 The Behavioral Engine - how the Behavioral Engine decides
what to do, and when
24 Behaviors and Scripts - the Virtools Dev approach to program-
ming and program flow control
25 Parameters - script variables in Virtools Dev, there is more here
than meets the eye at first glance
26 Parameter Operations (paramOps) - an introduction to the data
manipulation tools
27 Attributes - element variables in Virtools Dev
81
4 Understanding Virtools Dev
82
Elements, Classes, and Object Oriented 4
Design
83
4 Understanding Virtools Dev
Behavioral Object
Light
Light Target
Camera
Camera Target
Character
3D Sprite
Grid
Curve
Curve Point
Place
84
Elements, Classes, and Object Oriented 4
Design
20.2 Inheritance
One advantage of using a class hierarchy is the principle of inheritance. That is,
any element has its own unique characteristics and the element inherits the
characteristics of all of its ancestor classes.
For example, the class CKLight descends from
1. CK3DEntity, which descends from
2. CKRenderObject, which descends from
3. CKBeObject.
Therefore, a light has special characteristics that apply only to objects of the
CKLight class – characteristics like:
• the type of light (point, directional, etc.)
• the color of the light (white, red, etc.)
• the range over which the light is visible
These characteristics can be changed via the light’s setup or via a behavior.
Secondly, a light is a 3D Entity, which means it has inherited the characteristics
of a 3D Entity– characteristics like position and orientation in the 3D space.
Since a light is also a 3D Entity, any behavior that can be applied to a 3D
Entity can also be applied to a light.
Thirdly, a light is a Render Object, which means that it can be rendered (seen
in playback). Since a light is a Render Object, any behavior that can be applied
to a Render Object can be applied to a light.
Finally, a light is a Behavioral Object, which means that it can have a behavior
attached to it (some Virtools Dev classes, such as classes that store internal
data only, can not have behaviors attached to them). Since a light is a Behav-
ioral Object, any behavior that can be applied to a Behavior Object can be
applied to a light.
For more information on the specific properties of a class, see the Setup for
85
4 Understanding Virtools Dev
20.3 Specialization
Virtools Dev supports the specialization of inherited behaviors so that the
behaviors can be optimized for a specific task (also known as polymorphism).
For example, moving a 3D Frame is much simpler than moving a Character so
the behavior for moving a 3D Frame can be optimized for the simpler task.
Optimized behaviors reduce the computing time for a given task resulting in a
composition that is smaller, that is more responsive to user input, and that ren-
ders at an acceptable frame rate.
20.4 Aggregation
Virtools Dev supports aggregation, the logical relationship between elements
where a first element is a part of a second element yet both elements are dis-
tinct.
For example, if you look at the 3D Object Setup in 20-2, you can see a col-
umn labeled Object Meshes. A 3D object may have several meshes, although
only one mesh may be active at a time.
20-2 3D Object Setup with Mesh column circled
If you look at the Mesh Setup in 20-3, you can see a column labeled Materi-
86
Elements, Classes, and Object Oriented 4
Design
als Used. A mesh may have several materials, several of which may be active at
a time.
20-3 Mesh Setup with Materials column circled
If you look at the Material Setup in 20-4, you can see a field labeled Texture.
A material may have only one texture.
20-4 Material Setup with Texture circled
87
4 Understanding Virtools Dev
quickly and easily. In fact, the entire element can be exchanged with another
compatible element! For example, you could change a 3D Object's Mesh,
Material, or Texture – or any combination of these without changing the fact
that the 3D Object exists.
NOTE If you change the mesh on a Character, it is very likely that your Animations will
no longer work as expected.
88
Elements, Classes, and Object Oriented 4
Design
For example, two chairs could share the same mesh, material, and texture – the
chairs would appear to be identical and would differ only in name. However,
the chairs could have the same mesh, but have different materials and textures
– the chairs would then have the same form, but look different.
Sharing elements can greatly reduce file size and the work-load for CPUs and
graphic cards. Reducing the number of elements in a composition also makes
managing the development of your composition easier.
20.5 Association
Association allows Virtools Dev to create a logical relationship between ele-
ments that are not directly related through a parent-child inheritance relation-
ship in the CKClass hierarchy. Objects that are associated communicate with
each other but remain distinct in all respects.
For example, a character is often associated with a Group of 3D Entities for
the purpose of collision detection, management, and prevention.
89
4 Understanding Virtools Dev
90
The Elements of a Composition (CMO) 4
21 THE ELEMENTS OF A
COMPOSITION (CMO)
21-1 shows the Virtools Dev class hierarchy slightly differently than in 20-1 on
page 84. Comments have been included to help you place each CKClass in
context with respect to the other CKClasses. Indentation indicates that the
indented label is a child of the closest previous level of indentation. For exam-
ple, a 2D Entity and a 3D Entity are children of RenderObject. Sprite Text is a
not a child of RenderObject but Sprite Text is a descendent of RenderObject.
You can find a complete description of Virtools Dev classes in the Online Ref-
erence.
21-1 Elements of a composition, according to type and arranged alphabetically
91
4 Understanding Virtools Dev
92
The Elements of a Composition (CMO) 4
There is only one Level in a composition. The Level can contain one or more
Scenes and zero or several Places to organize your composition into manage-
able portions.
NOTE The Level always contains at least one scene: the Level Scene.
21.3 Scenes
A Scene in Virtools Dev is just like a scene in the movies:
• only one Scene is filmed (active) at a time - the director can only be in
one place at a time!
• only the actors (elements in Virtools) in that scene are active - every-
one else must wait their turn
• only those active in the scene are filmed by the camera (in Virtools,
only active elements are processed by the Behavioral Engine and ren-
dered)
The elements that are not members of the active scene are, by definition, inac-
tive. They are not rendered and their scripts are not processed.
Therefore, scenes are the perfect way to segment compositions into large scale
narrative elements or large time-based periods. Scenes are very useful when
working in collaboration with other people: each person can work on a specific
scene, which can then be saved as a CMO and later merged into one CMO via
Merge Composition as New Scene (File menu).
The Level Scene (containing all the objects of the Level) is made the active
scene of the Level at start-up. When a new scene is made active (started), the
previously active scene is automatically deactivated.
93
4 Understanding Virtools Dev
94
The Elements of a Composition (CMO) 4
21.5.1 Groups
Groups are the simplest yet most powerful organizational entity of Virtools
Dev. Groups are ordered lists of Behavioral Objects that can implement any
logical association that may be required and are not restricted to containing
elements of the same CKClass or type.
Groups can be created in Author mode or by BBs at run-time. Groups can be
reordered, iterated over, etc. – many standard BBs are provided for group
management.
A Group is a BeObject. Therefore, behaviors and attributes can be attached to
the Group. Groups can be part of other Groups.
21.5.2 Arrays
Arrays are simple tables containing cells organized as rows and columns.
Arrays are organized as typed columns (all the elements of a column must
have the same type).
95
4 Understanding Virtools Dev
96
The Virtools Dev Process Loop 4
97
4 Understanding Virtools Dev
98
The Virtools Dev Process Loop 4
99
4 Understanding Virtools Dev
SDK.
22.2 Rendering
Rendering displays the composition and is performed by a separate render
engine. The engine is chosen by the User and depends on the capabilities of
their graphics card and operating system.
You can choose the render engine (Render Device) for Author and Play
modes while working in Virtools Dev: from the Options menu choose Gen-
eral Preferences and select the 3D Layout - Rendering tab.
Typically, rendering is the most time intensive portion of the process loop and
is highly dependent on the capabilities of the underlying hardware.
100
The Behavioral Engine 4
NOTE To properly interpret the following series of tasks (the algorithm) you must take
note of the indentation level of each statement. An indentation indicates a sub-
tlest that must be performed as part of the prior sequence of tasks. For exam-
ple, task 3.1.1 states “For each BB attached to Start that has not yet been
activated, activate the BB with the highest priority”. This means that all sub-
tasks (3.1.1.1, 3.1.1.2 and their subtasks) must be performed to complete task
3.1.1. The “For each” portion of the task description means that this task (and
all subtasks) is performed repeatedly until the required condition – that all BBs
attached to Start have been activated – is met.
101
4 Understanding Virtools Dev
1. For each active element within a Level, sort the elements in priority
order to establish the element processing order.
2. For each element, the scripts applied to that element are sorted in prior-
ity order to establish the script processing order for that element
3. For each element, from the highest priority to the lowest priority, pro-
cess the highest priority element remaining
3.1. For each script attached to the currently processing element,
process the highest priority script remaining
3.1.1.For each BB attached to Start that has not yet been acti-
vated, activate the BB with the highest priority
3.1.1.1 Process the BB, calculating pOuts, activating
any bOuts, and sending any messages
3.1.1.2 For each bOut that activates a behavior link
3.1.1.2.1. If the behavior link has a delay of 0
then activate and process the next BB. Continue
in this manner until all BBs in this part of the
Script are processed or the behavior link has a
delay greater than 0.
3.1.1.2.2 If the behavior link has a delay greater
than 0 then add the BB to the stack for processing
in the required frame. For example, if the link
delay is 1, then the BB is processed in the next
frame. If the link delay is n, then the script is kept
active and the BB is processed in the nth frame
after the current frame.
NOTE The Level is always active and is the highest priority element in every frame. All
currently inactive elements are ignored in the remaining tasks.
Processing continues in the current frame until all BBs are processed or the
link delay is greater than 0. When all behavioral processing is complete, CK2
provides the required information to the rendering engine to draw an image
102
The Behavioral Engine 4
on screen, the image is rendered, any link delays that are greater than 0 are
reduced by 1, and behavioral processing starts again.
You can watch behavioral processing in action by activating Trace mode in the
Schematic. When the composition is played, the sequence of activations and
BB processing are highlighted in red in the Schematic.
Any behavior loop may have a cumulative delay of zero, as long as the loop is
not constantly active and as long as the number of iterations in a frame does
not exceed the value of Max Behavioral Iterations. If the number of iterations
in a frame exceeds the value of Max Behavioral Iterations then the behavioral
engine assumes that an infinite loop has occurred and processing is halted.
For example, Array and Group iterators (Logics/Array and Logics/Groups)
often have a loop delay of 0 so that all elements within the Array or Group are
103
4 Understanding Virtools Dev
23.2 Priority
Once CK2 has sorted which elements are active, how does CK2 know which
element to process first? The answer lies with that element's priority: the high-
est priority element is processed first.
You can set the priorities for Behavioral Objects, Scripts and Building Blocks.
The priority of a Behavioral Object and the priority of a Script are set in the
Level Manager. The priority of a BB is set in the Schematic.
If two or more elements have the same priority, then the processing order is
random.
23-2 Priority
With respect to 23-2, note that both Counters (Logics/Loop) and All But
104
The Behavioral Engine 4
One (Logics/Streaming) are all connected to Start with a 0 frame delay. There-
fore, the Behavioral Engine must determine which BB to activate first based
on the priority of each BB.
23-3 Priorities as seen in 23-2
5. All But One (at priority 50): the lowest bIn (In 2) is activated by Start
then the upper two bOuts (Out 0 and Out 1) are activated
At the end of the first frame All But One has been activated three times –
probably not the expected result.
NOTE As a general rule, when multiple BBs can activate the same BB (as in this exam-
ple), the receiving BB should have a lower priority than the BBs that can acti-
vate it to ensure that all prior BBs are processed first.
105
4 Understanding Virtools Dev
106
Behaviors and Scripts 4
107
4 Understanding Virtools Dev
108
Behaviors and Scripts 4
BBs are processed. The sequence of BB processing is called the activation flow
whereby activations propagate across bLinks.
Every bLink has a Link Delay that specifies when CK2 should process the BB
at the end of the bLink. The Link Delay can be 0 (meaning that the BB is pro-
cessed in the current frame) or n (meaning that the BB is processed in the nth
frame after the current frame).
24-5 Two bLinks - the left link has a link delay of 0, the link to the right 10
109
4 Understanding Virtools Dev
110
Behaviors and Scripts 4
24.1.7 C, S, and V
Some BBs are marked with one or more of the letters C, S or V in the lower
left corner.
C in the in the lower left corner means the BB has a Custom Dialog Box used
to configure complex parameters (e.g. Animation Synchronizer (Characters/
Animation)).
24-9 Animation Synchronizer Custom Dialog Box
S in the lower left corner means the BB has Settings. Settings typically control
which parameters are processed by the BB or how the parameters are processed
111
4 Understanding Virtools Dev
by the BB.
24-10 After editing Settings, only 3 bOuts are now calculated
V in the lower left corner of the BB means that the BB has a variable configu-
ration. That is, you can do one or more of the following:
• add bIns
• add bOuts
• add pIns
• add pOut
• change some or all of the types of the pIns and/or pOuts
Check the individual documentation for a BB in the Online Reference to
determine exactly what can be changed.
112
Behaviors and Scripts 4
24.1.8 Messages
A BB may have message icons, meaning that the BB sends or receives mes-
sages. Typically, messages are used to signal a change in state, to request that
some task be performed, and to signal that some task has completed.
NOTE There is a one frame delay between sending and receiving a message. See “The
Virtools Dev Process Loop” on page 97 for more information.
24.1.9 BB Processing
There are three kinds of BB that are processed at run-time, that is, in Play
mode.
1. Single Action: the BB completes processing within the current frame.
A Single Action BB can stand alone or be part of a behavior loop.
Example: Set Fog (World Environments/Global).
113
4 Understanding Virtools Dev
There are also a few BBs that are not activated at run-time, but when they are
attached to an element. An example of such a BB is Create Nodal Path (3D
Transformations/Nodal Path).
24-15 A BB activated when attached
NOTE You should always check the individual Help page from the Online Reference to
see precisely how a BB works.
114
Behaviors and Scripts 4
If you compare the image of the closed BG with BB images already presented
above, you will notice the differences in the font and border weight used that
help to distinguish between a BG and BB.
115
4 Understanding Virtools Dev
116
Parameters 4
25 PARAMETERS
A parameter consists of a name (pName), a type (pType), and a value (pValue).
Parameters are the Virtools Dev equivalent of variables in traditional program-
ming.
Parameters are used to transfer data across Parameter Links (pLinks):
• between behaviors - from Parameter Outputs (pOuts) to Parameter
Inputs (pIns)
• between Parameter Operations (paramOps)
• between paramOps and pIns
• between paramOps and Local Parameters
Parameters can also be used to assign values to an element’s Attributes.
117
4 Understanding Virtools Dev
4. Special
The parameter does not fit in the prior categories. There are only three
such parameter types, Reflected Object, Obstacle and Floor.
For a more detailed description of parameter types, see the SDK documenta-
tion.
118
Parameters 4
NOTE Two unique Local Parameters are allowed to have the same name. However, this
practice is not recommended due to the potential for confusion. For instance,
when you copy and paste a Local Parameter, you copy the Parameter’s name,
the Parameter’s type and the Parameter’s value to a new local Parameter: these
two Parameters are different, even though they have the same name (due to
the copy and paste operation). You are encouraged to use unique names for
each Parameter that you create.
25.6 This
This is a special local parameter that refers to the owner of the script. When
you create a This parameter in a script (via the context menu, see Schematic/
Script Body/This Parameter in the Online Reference for further information),
it automatically sets its value to the identity of the owner of the script.
119
4 Understanding Virtools Dev
120
Parameter Operations (paramOps) 4
26 PARAMETER OPERATIONS
(PARAMOPS)
Parameter Operations (paramOps) are simple operations performed on a sin-
gle parameter or performed between a pair of parameters. A paramOp is rep-
resented in the Schematic as a standard sized block with a name, two pIns and
one pOut (see 26-1).
26-1 3 different paramOps
121
4 Understanding Virtools Dev
122
Parameter Operations (paramOps) 4
123
4 Understanding Virtools Dev
124
Parameter Operations (paramOps) 4
125
4 Understanding Virtools Dev
126
Attributes 4
27 ATTRIBUTES
Attributes are a means of adding information to elements. Attributes are a
kind of parameter that belongs to an element instead of belonging to a script.
Virtools Dev includes numerous predefined attributes. You can also define
your own attributes.
Only Behavioral Objects can have attributes. A Level is a BeObject and can
have attributes. Level attributes are, effectively, global attributes.
An attribute has a Name and may also have a Category. An attribute typically
consists of one or more parameters that you can edit. However, some
attributes (such as ZBuffer Only) can not be edited.
For example, an element with the Floor attribute is identified to the Behavioral
Engine as an element that should be treated as a floor so that characters walk
on the element and not through the element.
Attributes are added to elements during Author mode via the Level Manager
context menu, via an element’s Setup, or via the Attributes Manager.
The Attributes Manager (27-1) allows you to inspect and manage which ele-
ments have what attributes.
27-1 The Attributes Manager
127
4 Understanding Virtools Dev
128
5
PART 5 - AUTHORING IN
VIRTOOLS DEV
This is the part that everybody asks about - where can I find tutorials for Vir-
tools Dev? This part contains two tutorials: a Quick Start for those of you just
starting out in Virtools Dev, and a fun and informative tutorial on particles for
those of you who have already some experience with Virtools Dev.
For the Quick Start, we would prefer you to peruse (and even read) the other
parts beforehand. But if you are too impatient, we have taken care to make the
Quick Start accessible to everyone and we sincerely hope we don’t lose anyone
on the way. Just make sure you read the other parts after!
The particles tutorial is just a sample of what is to come. Further tutorials will
be posted to the Virtools website on a regular basis and you can even find
some previews in the Virtools MiniSite.
The Virtools MiniSite is installed in the Documentation folder. However, if
you chose not install this component, you will have to launch the installation
program once more, and choose to install the MiniSite only.
Part 5 contains:
• 28 Quick Start - a detailed walkthrough for creating your first com-
position
• 29 Particles - an introduction to the world of Virtools Dev particle
systems
129
5 Authoring in Virtools Dev
130
Quick Start 5
28 QUICK START
28.1 Overview
The Quick Start tutorial is your introduction to the power and simplicity of
Virtools Dev.
The Quick Start tutorial is structured very much like a real project in Virtools
Dev. You will follow these steps:
1. organize resources
2. plan the content to be implemented - what do you want the composi-
tion (CMO) to do?
3. import the media; the models and characters that form and inhabit the
world
4. arrange the scene
5. implement interactivity within the scene
6. test the scene
7. refine the scene based on the results of your tests
8. go back to (6) and continue to test and refine until you are satisfied
that the scene meets the requirements you chose in (2)
9. release the composition
NOTE In actual production, you would plan the content before organizing the
resources. However this is a Quick Start tutorial, so things are done a bit differ-
ently!
131
5 Authoring in Virtools Dev
132
Quick Start 5
Normally, all your media are stored and organized in a data resource. A data
resource is structured as a set of nested folders and files, just like the file sys-
tem on the computer. When a data resource tab is selected, the window is
divided in two sections. On the left hand side of the window is the directory
structure for the data resource. On the right hand side of the window is a list-
ing of the contents of the current folder.
Whenever you are instructed to select a file from VirtoolsResources, the loca-
tion of the file is given in brackets. For example, in step 1 below you are
instructed to select the file Apartment.nmo (3D Entities/Worlds). This means
you should open the folder 3D Entities, then the sub-folder Worlds where you
will find Apartment.nmo.
1. From VirtoolsResources, select Apartment.nmo (3D Entities/Worlds)
and drag it into 3D Layout to add the contents of the file to your scene.
The file Apartment.nmo contains a scene created in a popular 3D modeling
application and exported to Virtools Dev, as shown in 28-1 below. The
scene contains a number of textured objects (such as walls, chairs, a TV,
etc.) and three cameras. The scene does not use any lights; instead object
materials were self illuminated. Self-illumination is a good technique to use
to avoid CPU intensive real-time lighting.
28-1 The file Apartment.nmo, as seen in the 3D Layout
133
5 Authoring in Virtools Dev
8. In Material Setup, click the color box next to Emissive. In Color Box,
enter values of 255 for R, G, B and L as shown in 28-2 and then click OK to
close it.
134
Quick Start 5
The character is now visible because you have adjusted the characteristics
of the character’s material so that it looks as if the material emits light. In
other words, the character is self-illuminated.
9. Click the cross in the upper right corner of Material Setup to close the
Setup.
10. In VirtoolsResources, hold the CTRL key down and click Run.nmo,
Walk.nmo, Wait.nmo and WalkBackward.nmo (Characters/Animations/
SkinCharacterAnimations/Eva) to select the four files. Drag these anima-
tion files onto the character. Release the mouse button only when you see
a yellow bounding box (indicating that the character is selected) appear
around the character.
Each of these animations (Run.nmo, Walk.nmo, Wait.nmo and WalkBack-
ward.nmo) were exported one at a time and separately from the character
that you imported earlier in this tutorial.
135
5 Authoring in Virtools Dev
or creating objects.
This scene does not need any lighting for all elements in the scene are self illu-
minated.
Three cameras were exported, with the scene, from the 3D modeling applica-
tion (these cameras are used later in this tutorial). However, for the purposes
of this tutorial, you will add another camera to the scene and set the view point
for the camera.
136
Quick Start 5
13. Next, right-click in 3D Layout and in the menu that appears choose
Select Camera then Perspective View. Then select Camera Dolly and
move your mouse slightly toward you until you see a white box, as in 28-4.
The white box you can see is the camera. The white lines represent the
camera’s view frustum. The yellow line links the camera to the camera tar-
get.
28-4 The Camera you just created, represented by a white box
137
5 Authoring in Virtools Dev
28-5 The script created by attaching Set As Active Camera to the camera.
138
Quick Start 5
18. Click Link, then click the Behavior Output (bOut), the pin on the right of
Look At, and then the Behavior Input (bIn), the pin on the left of Look At.
19. Right-click the behavior loop and choose Edit Link Delay. Make sure the
value for Link delay is 1, as shown in 28-8.
28-8 The Edit Link Delay dialog box
The camera you created will now look at the character every frame, adjusting
its orientation if needed to always keep the character centered in the FOV.
139
5 Authoring in Virtools Dev
140
Quick Start 5
board Controller translates the arrow keys that you press into messages.
Character Controller receives each message and executes the animation cor-
responding to that message. Holding the INSERT key while moving the char-
acter enables the Run Animation.
28.7 Test
Now that you have a simple scene with some interactivity, the next step is to
test it out.
NOTE Implement, test and refine, implement, test and refine, implement, test and
refine! The "implement, test and refine" cycle allows you to rapidly develop new
compositions a piece at a time. By checking your work often, you can never go
too wrong!
NOTE Don't forget to regularly save your work. Virtools strongly recommends the fol-
lowing incremental save technique. When starting a new project, immediately
name your composition and append a version number to the end of the file
name (e.g. MyComposition00.cmo) then save the composition. Every time you
achieve a short term goal in the development cycle, save the composition to a
new version number (e.g. MyComposition01.cmo, MyComposition02.cmo, etc.).
The multiple versions of the composition provide a complete development his-
tory and a ready source of backups in case you change your mind about a
design decision or disaster strikes your working version of the composition.
141
5 Authoring in Virtools Dev
28.8 Refine
The next step is to improve the scene. At the moment the character walks
above the floor and is able to walk straight through supposedly solid objects,
such as the desk, chairs, walls, etc.
27. Click Link, then click the Behavior Output (bOut), the pin on the right of
Character Keep On Floor, and then the Behavior Input (bIn), the pin on
the left of Character Keep On Floor.
28. A behavior loop is created, as shown in 28-10. Right-click the behavior
loop and choose Edit Link Delay. Make sure the value for Link delay is 1
142
Quick Start 5
29. Next, right-click the floor in 3D Layout and choose 3D Object Setup
(Room_Sun). In the 3D Object Setup that opens, click Attribute on the
left side of the window to switch to attribute mode.
30. Click Add Attribute, and in the dialog box select Floor (Floor Manager), as
shown in 28-11.
28-11 The Add Attribute dialog box
143
5 Authoring in Virtools Dev
144
Quick Start 5
36. Right-click the selection, and choose Place Selected in New Group.
A new group is created that references all 3D Objects in the scene.
37. Rename this group from New Group to Obstacles.
NOTE You can rename any element in the Level Manager by right-clicking the element
and choosing Rename. All references to the renamed element, throughout your
composition, are automatically updated to reflect the new name.
145
5 Authoring in Virtools Dev
42. Right-click Switch On Key and choose Construct -> Add Behavior Out-
put. Repeat this operation so that you have a total of four bOuts (one
bOut for each camera). Right-click Switch on Key and choose Edit
Parameters. Configure the pIns as follows (shown in 28-15): X for Key 0,
C for Key 1, V for Key 2, B for Key 4.
146
Quick Start 5
43. Right-click Parameter Selector and choose Contruct -> Add Behavior
Input. Repeat this operation so that you have a total of four bIns. Right-
click the parameter output (the pOut, just under the V in the lower left
hand corner) of Parameter Selector, and choose Edit Parameter. In the
Edit Parameter dialog box, change Parameter Type from Float to Cam-
era (as shown below in 28-16), then click OK.
45. Right-click the Set As Active Camera you added a moment ago and
choose Add Target Parameter.
Now all that remains is to add behavior links between these building blocks
(BBs) and a parameter link from a pOut on one BB to a pIn on another BB
(see 28-18).
46. Click Link on the Schematic toolbar then click the bOut and bIn you
want to link.Working from the left, link the bOut of Set As Active Cam-
era to the top bIn of Switch On Key. Next link the bOuts of Switch On
147
5 Authoring in Virtools Dev
You have completed all behavior links (bLinks). The last thing that
remains is a parameter link, to pass information from one BB to another.
NOTE You can also use the keyboard shortcut L to activate the Link button.
47. Link the pOut of Parameter Selector to the target parameter of Set As
Active Camera.
NOTE Switch on Key only needs to be activated once; Switch on Key remains active
until it is deactivated. For more information on the different types of BB, See
“BB Processing” on page 113
148
Quick Start 5
149
5 Authoring in Virtools Dev
51. From the File menu, select Export to Virtools Player. Choose a name and
location for your composition.
This file can now only be opened by a Virtools player, such as the Virtools
Web Player.
150
Quick Start 5
28.15 Congratulations
You have successfully completed the Quick Start tutorial! In this tutorial, you
have learned how to do a number of things:
• add media, in the form of models, a character and animations to a
scene
• create a camera, target the camera, and activate the camera at the
beginning of a scene
• attach BBs to objects, and add BBs to existing scripts
• edit a BB - both the parameter type (pType) and the parameters them-
selves
• link BBs to other BBs (activation flow) via behavior links
• link parameter outputs (pOuts) of one BB to the parameter inputs
(pIns) of another BB (data flow) via parameter links
• open and close Entity Setups
• add attributes to an element (just a reminder - attributes are parameters
that belong to an element rather than to a script)
• create a group and add elements to that group
• save your file in an editable format
• export your file to a Player only format
151
5 Authoring in Virtools Dev
152
Particles 5
29 PARTICLES
29.1 Introduction
In this tutorial you will learn how to generate sophisticated visual effects like
sparks, smoke, snow, fireworks, and clouds of dust using the Virtools Dev par-
ticle systems.
The Virtools Dev particles system can be divided into four distinct parts:
1. emitters
2. particles
3. deflectors
4. interactors
29.2 Emitters
An emitter is a source of particles. Many different emitters are supported
(spherical, disc, point etc) - choose the type of emitter according to the desired
effect. Most emitters can be applied to any 3D Entity (and, therefore, to their
descendent classes also) but are typically applied to 3D frames. However, the
CurveParticleSystem emitter can only be applied to Curves and the Object-
ParticleSystem can only be applied to 3D Objects.
29-1 Emitters, from left to right: Cubic, Cylinder, Disc, Linear, Planar, Point and Spherical.
153
5 Authoring in Virtools Dev
29.3 Particles
Particle systems have many different parameters that control how particles
behave. For example, you can control a particle's lifespan, speed, weight, and
color. The particles themselves can be of different styles: simple points, lines,
textured sprites (animated or still), or 3D objects.
29-2 Particles, from left to right: Point, Line, Sprite, Orientable Sprite, Radial Sprite and
Fast Sprite.
29.4 Deflectors
Deflectors are types of obstacles that modify the path of particles by getting in
their way and ‘bouncing’ them in another direction. There are different types
of deflectors (spherical, cylinder, infinity, plane, etc.) that can be applied to
frames or any 3D object.
Each type of deflector is identified by a unique icon.
29-3 Deflectors, from left to right: Box, Cylinder, Infinite Plane, Plane and Sphere.
29.5 Interactors
Finally, there are interactors (wind, gravity, magnetic fields, and mutation
boxes) that modify the behavior, course or appearance of particles. With the
154
Particles 5
155
5 Authoring in Virtools Dev
NOTE Particles use a lot of system resources. To maintain a satisfactory frame rate,
keep the number of emitters to a minimum and avoid creating large numbers of
particles from each emitter. The default number of particles is 100. In some
cases you may need to use more, but generally you can obtain a satisfactory
effect by fine-tuning a few of the parameters.
156
Particles 5
157
5 Authoring in Virtools Dev
29.8.1 Start
1. Open the file ParticlesExercise01.cmo.
A small town, in the middle of the night, is displayed as shown in 29-7.
Use the camera navigation tools if you wish to change the viewpoint. The
3D frames necessary for the emitters are already present, as is a curve used
in a later exercise.
29-7 3D Frames ready for particle system BBs
4. The Edit Parameters dialog box for this BB opens - just click OK for now.
5. Click Zoom on Selection.
You can see that the 3D frame now has an orange wire-frame spiral repre-
senting the emitter, as shown in 29-8.
158
Particles 5
NOTE Sometimes it can be easier to drag a BB onto an object in Level Manager than
onto an object in 3D Layout. In this example, the 3D frame is on the inside of
the street light. If you attempted to drag the BB into 3D Layout and onto the
3D frame you would be unsuccessful. Instead of attaching the particle BB to the
3D frame, the BB would try to attach to the street light - and would have gener-
ated an incompatibility error message.
159
5 Authoring in Virtools Dev
NOTE It is not necessary to click Pause each time you want to change a parameter,
opening the Edit Parameters dialog box pauses the composition. On closing
the dialog box, play automatically continues. You only need to click Reset IC if
you add a new particle system or other BB. You do not have to click Reset IC if
you just change some parameters.
The particles change from the first color to the second as they move away
from the street light.
11. To allow each of these colors to vary, open the Edit Parameters dialog
box once again and adjust the Variance for each. To see these changes
more easily, alter the particle Lifespan from 1000 ms to 2000 ms.
NOTE Alpha is the name given to transparency, encoded in 8 bit grayscale for 32 bit
color and as a single bit mask for 16 bit color. When Alpha is set to black, parti-
cles are entirely transparent, and when Alpha is set to white, particles are com-
pletely opaque. Use Alpha to create translucent systems, such as smoke.
160
Particles 5
The particles now have a texture and appear as small flakes. These textures
are static, but you will see later that you can also use animated textures.
NOTE If you have graphics editing or viewing programs installed and associated with
the texture file types, you can edit or view the texture by double-clicking the
texture in the data resource. Virtools Dev automatically opens the file in the
associated graphics program.
With Initial Size and Ending Size you can obtain astonishing results:
from flows of lava to vibrating halos, as illustrated in the completed ver-
sion of this exercise Particles01Finished.cmo.
NOTE Particles with a high Speed value do not require a long Lifespan. High speed
particles are quickly out of camera range. For optimum performance, a particle's
Lifespan should only be long enough for the particle to exit the camera's view
frustum.
161
5 Authoring in Virtools Dev
29.8.8 Conclusion
In this exercise you learned how to modify the basic parameters of a parti-
cle system: Color, Texture, Speed, Size and Lifespan.
162
Particles 5
4. In the Edit Parameters dialog box that appears, select Star as the Tex-
ture.
5. To obtain a better visual effect, change Lifespan to 800 ms, Speed to 0.01
ms, and Initial Size to 2 with a Variance of 1. You can also change the
Variance for InitialColorAndAlpha and EndingColorAndAlpha.
163
5 Authoring in Virtools Dev
164
Particles 5
Gravity is positive then your particles will sink rather than rise. Using Weight
Variance values that cause Weight to have both positive and negative values
allows you to have both falling and rising particles from the same particle sys-
tem.
NOTE Particle Gravity and Particle Atmosphere are the only attributes of the Interactor
type that can be applied to any entity or object in Virtools Dev - including parti-
cle emitters. All other attributes must be applied to 3D frames.
165
5 Authoring in Virtools Dev
how Particle Wind (Local or Global) affects individual particles. The Surface
parameter adjusts the apparent surface area of a particle – the larger the sur-
face area, the greater the effect of the Particle Wind parameter. A value for the
Surface parameter that is of the opposite sign to the Particle Wind attribute
creates an inverse reaction and the particle moves in the opposite direction of
the Particle Wind.
17. In Level Manager, select Fan_Frame (Global/3D Frames). You will now
add an emitter to this 3D frame, but first you should deactivate the
attribute Particle Local Wind.
18. In the Attribute part of 3D Frame Setup, double-click the Value cell of
Particle Local Wind: Force/Decay and in the Edit Parameter dialog box
ensure that the X and Y values are set to 0.
19. From Building Blocks, add DiscParticleSystem (Particles) to Fan_Frame
in the Level Manager.
20. In the Edit Parameters dialog box that appears, set the following parame-
ters: Speed 0.1, Lifespan 800, Weight 0.5 with a Variance of 0 for each
parameter. To generate a jet of particles, set Yaw Variance and Pitch
Variance to 0. Finally, choose a Texture, such as Spark. Click Play to test
your composition and refine your parameters in real-time if you think they
need to be changed.
166
Particles 5
21. In the 3D Frame Setup, re-activate the attribute Particle Local Wind for
Fan_Frame by double-clicking the Value cell, and setting a value of 0.001
for X in the Edit Parameter dialog box. Click Play.
You can now see the influence the fan has on the particles.
22. Press F2.
The view is now the perspective of a camera mounted at the front of the
pink car. Press F2 to switch between cameras.
167
5 Authoring in Virtools Dev
29-12 The same particle system, but different effects obtained by editing the parameters
29.9.6 Conclusion
In this exercise you learned to use more advanced emitter parameters such as
Weight, and Surface in conjunction with dynamic attributes - that is interac-
tors. You also learned to place these attributes, such as Particle Local Wind:
Force/Decay, Particle Gravity on moving and stationary 3D frames.
168
Particles 5
29.10.1 Start
1. Open the file Particles03.cmo.
This is the same scene as before but with a few changes: there are now par-
ticle systems at the front of the pink car and on the rotating fan. The street
lights no longer have particle systems - this is to lighten the CPU load.
Finally, the Particle Gravity interactor has been applied to the Level.
2. Click Play.
Particles pass through buildings and through the ground as there is a slight
gravitational pull.
29-13 Creating particle system deflectors
169
5 Authoring in Virtools Dev
4. Double-click the cell under Value for Particle Infinite Plane Deflector and
change Response to 0.7 and Friction to 0.4.
You can also change the value of the parameter Bounce for each emitter
(by right-clicking the appropriate BB). The parameter Bounce allows you
to have unique qualities for each particle system (as you have already seen
with Weight and Surface in the prior exercises).
170
Particles 5
8. Click Select and Scale, ensuring you are in Uniform Scaling mode with
the X axis constraint still selected. Move your mouse so the deflector is
approximately the same length as one side of the terrain.
9. Do the same for BoundaryFrame02, but along the Z axis this time. Play
the scene.
You will see that the particles now bounce back off the deflectors, towards
the center of the terrain.
171
5 Authoring in Virtools Dev
On the left you will find all attribute types. As you select each attribute on
the left, the elements in your current scene with that attribute are listed on
the right.
13. Open Particle Systems Deflectors and select Particle Object Deflectors.
You will see all the objects in the scene that have this attribute. You can
easily edit, copy or paste any parameters using the context menu, or you
can use the appropriate icons in the Attributes Manager toolbar.
29.10.6 Conclusion
In this exercise you learned to place different deflectors on several objects, to
resize them and to edit their parameters via the Attributes Manager. Other
types of deflectors (spheres, cylinders, etc.) are created, resized and managed in
the same way.
172
Particles 5
All four colored numbers appear at the same time. You need to tell Vir-
tools Dev that the texture actually contains four separate images.
6. In Schematic, right-click SphericalParticleSystem and choose Edit
Parameters. Enter 4 under Texture Frame Count, and click OK.
NOTE Another interesting parameter for this exercise is Texture Loop - you should
leave it at No Loop for the moment but later try both Loop and To and Fro.
7. Click Play.
You will see that the particles cycle through the four images. Next you will
alter the Variance slightly, so that all images are visible at the same time.
8. In Schematic, right-click SphericalParticleSystem and choose Edit
Parameters. Set the Texture Speed Variance to 400 ms, then click OK.
You will see that all four numbers are now visible at the same time. Try
experimenting with the other Variances in the Edit Parameters dialog
box.
Once you have finished with numbers, try re-doing this exercise with the tex-
ture Compound.jpg, also found in VirtoolsResources (Textures/Particles).
You can also create your own textures - for example you could create a texture
with nine images showing differing flames, and use the particle system to cre-
ate a fire effect. Patience and a good graphics program are all you need!
NOTE Animated particle textures must be arranged in a square grid format. Legal val-
ues for the number of images within an animated particle texture are 4, 9, 16,
25, etc.
173
5 Authoring in Virtools Dev
NOTE You must place your objects into a new group when they are to be used for a
particle system. You can, of course, use more than one object for object parti-
cles.
You will see particles composed of the 3D object (Cone) floating around
the emitter, similar to 29-14.
174
Particles 5
5. Open the BB’s Edit Parameters dialog box, and modify Speed and Size
to investigate the different visual effects you can achieve.
6. In Level Manager, select another simple mesh object from VirtoolsRe-
sources (such as those contained in 3DEntities/Primitives) and add it to
your group (by dragging it to the group). Click Reset IC and then Play.
NOTE The BBs contained in Logics/Groups allow you to create particle systems with
dynamic content by adding objects at run-time.
29.12.1 Conclusion
In this exercise you learned how to create particle systems composed of 3D
objects. You learned that you must use a group and choose only simple 3D
objects with a low polygon count. Finally, you learned that you can use the
BBs in Logics/Group with object particle systems to create particle systems
with dynamic content.
175
5 Authoring in Virtools Dev
Alternatively, you can attach multiple particle system BBs to a single emitter
and switch between the particle systems as necessary.
176
Particles 5
• Only use Object mode (under Particle Rendering in the Edit Set-
tings dialog box) with small simple objects of few faces.
• Try to place your emitters so they are not all in the camera view frus-
tum at the same time. When a particle system is not in view, you can
deactivate or freeze that particle system.
NOTE It is better to freeze a particle system, if you have not finished with that particle
system, rather than stop a particle system, for it takes time for a particle sys-
tem to become stable.
177
5 Authoring in Virtools Dev
178
6
PART 6 - APPENDIX
At the end of the User Guide, last - but certainly not least - is the Appendix.
Our appendix is larger than most - mostly because of our extensive glossary.
The Virtools Glossary contains definitions for many Virtools words and terms
that newcomers and pros alike will come to appreciate for their clarity and
valuable contextual information.
The Glossary is not all there is to the Appendix - you will also find further
help for those tricky orientation and transformation questions.
The Appendix contains:
30 Glossary - until you become a pro, one of your most valuable
resources; the Glossary is the definitive source for Virtools terminol-
ogy
31 Controlling the Orientation of an Element - a short tutorial on
controlling orientation
32 Example Transformations - more details on the matrices that
underlie 3D rendering
179
6 Looking at Virtools Dev
180
Glossary 6
30 GLOSSARY
30.1 How to Use the Glossary
This Glossary contains definitions for and contextual information about
words, phrases, and relationships that are used in Virtools Dev.
Many of the definitions refer to one of the following fundamental terms,
reproduced here for your convenience. Words that are capitalized have their
own entries in the Glossary. Before you start reading the Glossary, we advise
you to review the following entries:
Behavior
A description of how an element responds to the environment. Applying a
Behavior makes an element interactive, either with the User or with other ele-
ments of the composition.The term Behavior is a general description and can
be used in place of Building Block (BB), Behavior Graph (BG) or Script.
CKClass
A generic label for any class or class definition used by Virtools Dev.
181
6 Looking at Virtools Dev
Element
A generic label for any non-behavioral (non-BB, non BG, non-Script) “thing”
within a composition.
NOTE All BeObjects are Elements but not all Elements are BeObjects: neither a Param-
eter nor an ObjectAnimation are BeObjects yet both are Elements.
182
Glossary 6
Dev SDK. The headings for these entries are of the form:
2D Entity, CK2dEntity
The first term in the entry, 2D Entity, is the form used as a pType. The second
term in the entry, CK2dEntity, is the formal name of the corresponding class
within the Virtools Dev SDK. The formal name always starts with the letters
“CK”.
183
6 Looking at Virtools Dev
2D Entity, CK2dEntity
A CKClass. An element with a position and scale in the screen’s 2D coordinate
system.
NOTE The CKClasses 2D Sprite (CKSprite) and Sprite Text (CKSpriteText) descend
from this Class.
2D Frame
An instance of CK2dEntity. A 2D Frame may have a Material and a Texture. A
2D Frame is typically used as a place holder when creating a user interface.
2D Sprite, CKSprite
A CKClass. A 2D image rendered in the background (behind all 3D elements)
or in the foreground (in front of all 3D elements), a 2D Sprite can be of arbi-
trary size.
2D Sprites are often used to create interface elements. However, whenever
possible, use a 2D Frame (with a material and texture) for 2D Frames require
less processing power than 2D Sprites.
3D Entity, CK3DEntity
A CKClass. An element in Virtools Dev that has a position, orientation and
scale in 3D space.
184
Glossary 6
3D Frame
An instance of the class CK3dEntity. A 3D Frame has a position, orientation,
and scale. A 3D Frame does not have an Author controlled Mesh. When visi-
ble, a 3D Frame is represented as a 3D cross.
A 3D Frame is often used as a reference point. For example, placing a camera
relative to the 3D Frame's position or orientation.
3D Object, CK3dObject
A CKClass. An element in Virtools Dev that has the characteristics of a 3D
Entity and a Mesh.
3D Sprite, CKSprite3D
A CKClass. An element composed of a 2D image that is rendered in 3D space.
A 3D Sprite can have a position, orientation, and scale.
Absolute Coordinates
In 2D, a screen position expressed in pixels.
In 3D, a position expressed in the world coordinate system.
Ambient Color
See “Material Color” on page 201.
Ambient Light
A pName. The non-directional, background light in a composition.
Ancestor, Parent
Any element, within a hierarchical relationship, that has one or more Child ele-
ments (children) or Descendents. Strictly, a Parent refers to the immediate
Ancestor only.
185
6 Looking at Virtools Dev
Angle
A pType. A value expressed in the form Turns:Angle where Turns is the
number of complete rotations and Angle is expressed in degrees.
NOTE CK2 performs <Angle> calculations using radians and not degrees. There are
2*PI radians in 360 degrees. An Angle of 0:180, expressed as a Float, has a
value of PI (approximately 3.14159).
NOTE CK2 considers the pTypes <Percentage>, <Float> and <Angle> as being the
same type.
Animation
A pName. A process by which an element is modified in 3D space, making the
element appear dynamic (rather than static). An Animation is composed of
Keyframes, where each Keyframe has a position, scale and orientation.
Animation Step
A pName. The current position within an Animation, expressed as a Percent-
age.
186
Glossary 6
Array, CKDataArray
A CKClass. A rectangular arrangement of cells, created as rows and columns,
where the columns define the types of data stored in the array and where the
rows contain values. Each cell contains a distinct data element. The data types
supported by Arrays include:
• Integer
• Float
• String
• CKObject
• Parameters
Attribute
A Parameter associated with a BeObject. An Attribute has a Name and may
also have a Category. An Attribute typically consists of one or more Author-
editable Parameters. However, some Attributes, such as ZBuffer Only, cannot
be edited by the Author.
For example, an element with the Floor attribute is identified to the Behavioral
Engine as an element that should be treated as a floor so that Characters walk
on the element and not through the element.
Virtools Dev includes numerous predefined Attributes. Authors can also
define their own Attributes.
187
6 Looking at Virtools Dev
Author
A person using Virtools Dev to create interactive content or an application.
Author Mode
A state within Virtools Dev; Author Mode occurs when a composition is not
playing, and the Behavioral Engine is not active.
Axis
A pName. A vector used to define a coordinate system.
Behavior
A description of how an element responds to the environment. Applying a
Behavior makes an element interactive, either with the User or with other ele-
ments of the composition.
The term Behavior is a general description and can be used in place of Build-
ing Block (BB), Behavior Graph (BG), or Script.
188
Glossary 6
189
6 Looking at Virtools Dev
Behavior Graph, BG
A graph composed of one or more of the following elements: BBs, Parameter
Operations, Parameters, Behavior Links, Parameter Links, Comments, Short-
cuts, other BGs, etc. In other words, a BG is a visual representation of a
Behavior.
At first glance, a BG can look almost exactly like a Script. However, a BG is
distinct from a Script because the Author of the BG deliberately encapsulated
the Behavior. The Author encapsulated and named the BG so that the BG can
be saved and reused.
Virtools Dev treats a BG exactly the same as a BB. A BG can be attached to an
element and applied to an element in the same manner as a BB.
A BG can be considered an Author defined BB that, to an Author, works in
exactly the same way as a BB – a BG can have pIns, pOuts, bIns and bOuts.
NOTE Any time the documentation for Virtools Dev refers to using a (Behavior) Build-
ing Block or a BB within a composition, the reader can substitute Behavior
Graph or BG.
190
Glossary 6
191
6 Looking at Virtools Dev
Behavior Loop
A series of BBs (and/or BGs) connected by bLinks. BBs are connected
together in a manner that causes the BBs to be activated or triggered in a
repetitive fashion.
In other words, a Behavior Loop is the visual representation of a repetitive
operation. A repetitive operation is also known as an Iteration and the pro-
cess of repeating an operation is also known as Iterating.
In any implementation of a repetitive operation, a significant concern is to
ensure that there is an acceptable upper limit to the number of times that the
operation repeats. In other words, there needs to be a mechanism to ensure
that an operation is not repeated indefinitely.
Virtools Dev allows the Author to define the maximum number of operations
that may be performed in a single Frame via the Max Behavioral Iterations setting
in the Schematic.
NOTE The default value for Max Behavioral Iterations is 8000. The value of Max
Behavioral Iterations is saved with the composition.
Any Behavior Loop may have a cumulative delay of zero, as long as the loop is
not constantly active and as long as the number of iterations in a Frame does
not exceed the value of Max Behavioral Iterations. For example, Array and
Group Iterators (Logics/Arrays and Logics/Groups) often have a loop delay
of 0 so that all elements within the Array or Group are operated on within a
single Frame. However, the loop delay can be any positive value in the range of
0 to 32767.
NOTE Looping BBs (such as Timer (Logics/Loops)) that are time-based require a
cumulative loop delay of 1 Frame or the BB automatically changes to Frame-
based processing.
192
Glossary 6
Bezier (Curve)
A pType. A Bezier Curve (see Bezier Progression (Logics/Loops)) is a type
of a 2D Curve characterized by smooth transitions between curve segments
(as compared to Linear (see Linear Progression (Logics/Loops)).
Billboard
A pValue. An orientation constraint applied to an element. An element with a
Billboard constraint always faces the current viewpoint.
BodyPart, CKBodyPart
A CKClass. One or more 3D Entities combined to form a Character.
Boolean
A pType. A data type with only two permitted values, represented as a check
box. The check box is either selected (TRUE) or not selected (FALSE).
Bounding Box
The smallest box or rectangular volume that encloses an element or set of ele-
ments. A bounding box is typically used in performing collision detection.
Camera, CKCamera
A CKClass. An element that provides a viewpoint from which a composition
is rendered.
NOTE A Target Camera (CKTargetCamera) descends from this Class. A Target Camera
is a Camera that always points towards its Target.
193
6 Looking at Virtools Dev
Cell
A data point within an Array. For example, an Array with two rows and three
columns contains six cells.
Character, CKCharacter
A CKClass. A 3D Entity composed of one or more BodyParts, arranged as a
Hierarchy. A Character typically has Animations.
Channel
A pName. A Material added to a Mesh that blends with other Materials to cre-
ate a visual effect. Virtools Dev supports a maximum of 10 Channels per
Mesh.
Child, Descendent
Any element, within a hierarchical relationship, that has a Parent (Ancestor)
element. Strictly, a Child refers to the immediate Descendent only.
CKClass
A generic label for any class or class definition used by Virtools Dev.
Class Hierarchy
A classification system whereby classes are related via parent – child relation-
ships. A parent class is more general than a child class. A child class is a spe-
cialization of a parent class and inherits the characteristics and behaviors of the
parent class unless specifically redefined in the child class.
194
Glossary 6
CK2
The Virtools Dev Behavioral Engine, responsible for the execution of all
behaviors within a composition.
CK_ID
A unique identifier assigned to every element in a composition. The CK_ID is
assigned as the element is added to a composition. The CK_ID for a given ele-
ment is regenerated every time a composition is loaded and is not guaranteed
to remain constant between reloads.
Curve, CKCurve
A CKClass. An element formed by a set of Curve Points that define a series of
line segments connected to create a single line.
Curves are Open (the Curve forms a line) or Closed (the Curve forms a loop).
Curves and curve sections are Linear (composed of straight line segments) or
Spline (composed of smoothly varying curves).
The Curve Points of the curve lie on the curve. The shape of the curve is
changed by moving or editing the Curve Points.
Curves are 3D elements and can be made visible or invisible in Author Mode
and Player Mode.
195
6 Looking at Virtools Dev
Default Orientation
The default relationship between an element and the world coordinate system.
The Default orientation assumes that the element faces in the direction of the
positive Z-Axis (Dir), that the top of the element is in the direction of the posi-
tive Y-Axis (Up) and that the right side of the element is in the direction of the
positive X-Axis (Right).
Dependency (Options)
A pName. How a copy or delete operation affects the CKObjects used by
(aggregated with) that element.
For example, when deleting an element, the Author can choose to
• delete the element only (No Dependencies)
• delete the element, and all elements used by that element (Full Depen-
dencies)
• delete the element, and only selected elements used by that element
(Custom Dependencies)
Descendent, Child
Any element, within a hierarchical relationship, that has a Parent (Ancestor)
element. Strictly, a Child refers to the immediate Descendent only.
Dest, Destination
A pName. From Material, sets a surface's destination blending coefficient.
From Transformation, the end point of a translation. The Destination can be a
coordinate (expressed as a <Vector>) or an element within the composition.
196
Glossary 6
Diffuse (Color)
See “Material Color” on page 201.
Diffuse (Light)
A pName. The directional light in a composition.
Dir
A pName. The facing direction of an element, generally the positive Z-axis.
Element
A generic label for any non-behavioral (non-BB, non BG, non-Script) “thing”
within a composition.
NOTE All BeObjects are Elements but not all Elements are BeObjects: neither a Param-
eter nor an ObjectAnimation are BeObjects yet both are Elements.
Emissive (Color)
See “Material Color” on page 201.
Extents
A pName. The bounds or limits of an element, typically as projected onto
another element or onto the planes defined by the world coordinate system.
Face
A triangular geometric element formed by three Vertices, a part of a Mesh.
Flow (Activation)
The order in which the BBs within a Script are processed. The activation flow
follows a path through the graph formed by BBs and bLinks.
197
6 Looking at Virtools Dev
Grid, CKGrid
A CKClass. An element that divides the volume enclosed by the Grid into a
2D array of rectangular volumes known as squares. A Grid provides a mecha-
nism for projecting an element’s position in 3D coordinates to a 2D coordi-
nate system.
Group, CKGroup
A CKClass. A collection of references to elements, used to create a logical rela-
tionship between the members of the Group.
Guide
In Author mode, a rectangular grid used to guide placement of elements.
Hierarchy
From object oriented design, a logical organization that enforces a parent-child
organization on arbitrary elements.
For example, the file system on a computer is a hierarchical organization
where each drive is organized as a hierarchy with the drive letter as the root of a
given hierarchy. Organization proceeds in a tree-like structure where a drive
can contain folders and files and where folders can contain further folders or
files but files can not contain other files. Any folder is the parent to all folders
and files within the folder. A folder within another folder is a child of the
encompassing folder. Therefore, a folder can be both a parent to other folders
198
Glossary 6
and files and a child of another folder. A folder can have many children but a
folder can only have one parent.
Note that root is a relative term; any parent is also the root for all of that par-
ent’s child elements within a hierarchy.
Within Virtools Dev, a Character is the most common form of a hierarchical
element. The various elements that form the body (such as torso, legs, arms,
etc.) are arranged in a hierarchical manner.
Hierarchies can be explored, created and altered using the Hierarchy Man-
ager or BBs.
Hierarchy (pIn)
A pName. A Boolean pIn in the form of a check box – if the check box is
selected, then the BB affects the elements' children.
Homogeneous Coordinates
In 2D, a screen position expressed relative to the current screen resolution
along each axis. Homogeneous Coordinates are used to ensure that, no matter
the screen resolution, 2D elements can maintain a constant relative size.
Homogeneous Coordinates are limited to the range 0.0 to 1.0.
199
6 Looking at Virtools Dev
Instance, Instantiation
An Object is an instance of a Class; an Element that complies with or was cre-
ated from a Class Definition. An Object is Instantiated from a Class Defini-
tion.
Interpolator, Interpolate
A BB that interpolates between two values, that calculates a value between the
two values.
Interpolation determines the value at a given Percentage of the way between
the first value and the second value.
Iterator, Iterate
A BB that Iterates from a first value to a second value; for example: Counter
(Logics/Loops). Iteration counts from a first value to a second value using a
given increment per iteration.
A BB that Iterates over all members of a Collection; for example: Collection
Iterator (Logics/Loops).
Layer, CKLayer
A CKClass. On a Grid, a set of values associated with each square of the Grid.
Multiple Layers can be associated with a single Grid.
Light, CKLight
A CKClass. An element used to provide real-time lighting as opposed to using
pre-lit lighting.
NOTE A Target Light (CKTargetLight) descends from this Class. A Target Light is a Light
that always points toward its Target.
200
Glossary 6
Level, CKLevel
A CKClass. The root element for a composition; the ancestor for all elements
in a composition.
Local Parameter
A Parameter contained within a Script, represented by a small rectangle. Local
Parameters are either located above pIns (the small triangles on top of a BB/
BG/paramOp) or located by themselves within a Script. Local Parameters are
connected to pIns by Parameter Links.
NOTE Two unique Local Parameters are allowed to have the same name. However, this
practice is not recommended due to the potential for confusion. For instance,
when you copy and paste a Local Parameter, you copy the Parameter’s name,
the Parameter’s type and the Parameter’s value to a new local Parameter: these
two Parameters are different, even though they have the same name (due to
the copy and paste operation). The Author is encouraged to use unique names
for each Parameter that they create.
Virtools Dev maintains a unique identifier for each local Parameter. To view a
local Parameter's identifier (called the CK_ID), select "CK Properties" in the
local Parameter's context menu.
Manager
A Plugin that performs system wide tasks such as collision management.
Material, CKMaterial
A CKClass. The surface characteristics of an element, how light affects the ele-
ment. A Material often has a Texture.
Material Color
The perceived color of an element, defined by the way the element's Material
interacts with the scene lighting. The Material Color has four components:
1. Ambient Color: describes how a Material reflects the ambient light in a
scene. Ambient light and ambient reflection are non-directional.
201
6 Looking at Virtools Dev
Typically, the ambient light level in a scene is much lower than the dif-
fuse light level. Therefore, ambient reflection typically has a lesser
impact on the perceived color of a Material than diffuse reflection and
is most noticeable when little or no diffuse light reflects off the Mate-
rial.
2. Diffuse Color: describes how a Material reflects the diffuse light in a
scene. Diffuse reflection is directional - the angle of incidence of the
diffuse light affects the overall intensity of the reflection.
Typically, the diffuse light is the dominant light source in a scene.
Therefore, diffuse reflection typically plays the largest part in deter-
mining the perceived color of a Material.
NOTE The alpha value of the diffuse color is used for alpha transparency calculations.
Matrix
An ordered collection of data. The local matrix and the world matrix associ-
ated with each 3D Entity are used to store the position, orientation, and scale
of that element.
202
Glossary 6
Mesh, CKMesh
A CKClass. A collection of faces that define the geometric surface of an ele-
ment. A Mesh is usually covered by a Material.
Message, CKMessage
A CKClass. A means of transferring information between elements or
between Scripts. Typically, messages are used to signal a change in state, to
request that some task be performed, and to signal that some task has com-
pleted.
NOTE Messages always have a delay of one pass through the process loop. That is, a
message is sent in the current Frame but the message is not received until the
next Frame (process loop). In other words, messages experience a one Frame
delay before they are delivered.
Nodal Link
A link between Nodes in a Nodal Path. A Nodal Link may allow movement in
one direction only or in both directions. A Nodal Link also has a difficulty value
used to determine the cost of following that Nodal Link.
Node
An endpoint for a Nodal Link, a junction between links in a Nodal Path.
203
6 Looking at Virtools Dev
Object
From object oriented design, an instance of a class; an element rather than a
description of an element (a class).
Obstacle
An element tested by collision detection mechanisms.
Orientation
The correlation between an element’s Right, Dir, and Up vectors, an element’s
local coordinate system, and the world coordinate system.
Origin
The point at which the vectors that define a coordinate system intersect.
Parameter
Used to transfer data values between behaviors and to add information to
BeObjects (through Attributes). Many behaviors use the values of their pIns to
control their processing.
A Parameter has a name (pName) and contains a value (pValue) expressed in a
given type (pType) such as <Integer>, <String>, <Vector>, etc. A Parameter
can be static (the value is fixed, such as a value entered by the Author) or
dynamic (the value can change, based upon other factors). The value of a
Parameter is provided to a Behavior or to a paramOp via a pLink or via a
shortcut.
204
Glossary 6
205
6 Looking at Virtools Dev
Parent, Ancestor
Any element, within a hierarchical relationship, that has one or more child ele-
ments (children) or Descendents. Strictly, a Parent refers to the immediate
Ancestor only.
Percentage
A pType. A value bound to the range 0.0 to 1.0, a value expressed as a percent
in the range of 0% to 100%.
NOTE CK2 considers the pTypes Percentage, Float and Angle as being the same type.
Place, CKPlace
A CKClass. An abstract element used to define the elements found within a
physical locale in a composition. A Place is a geometric construct used to
define an area of related geometry.
For example, within a building, each room can be defined as a separate Place.
Places contain the elements within the Place. An element in a Place does not
appear in the Global list of elements.
206
Glossary 6
Places are very useful when using portal optimization to reduce the processing
requirements of a composition.
Player
An application, such as the Virtools Web Player, that can process and render a
Composition.
Player Mode
A state within Virtools Dev; Virtools Dev enters Player Mode when a compo-
sition is playing and rendered in 3D Layout.
Plugin
A Dynamic Link Library (DLL) that extends the capabilities of the base CK2
engine.
Portal
A connector between two Places, used by the Portal Manager to reduce the
render processing requirements of a composition. A Portal is a special 3D
Entity (a 3D Frame with a Portal flag) that is used to determine which Places
are potentially visible from the current viewpoint and, therefore, rendered.
Priority
Allows the Author to control the activation order of elements and behaviors in
the current Frame.
By default, Virtools Dev implements a pure message passing model where
each object acts independently and asynchronously. In a pure message passing
model, there is no priority – each object exhibits the appropriate behavioral
207
6 Looking at Virtools Dev
208
Glossary 6
Progression
A BB that iterates from a first value to a second value.
A Progression counts from a first value to a second value using a given incre-
ment per iteration. The increment can be fixed (Linear Progression (Logics/
Loops)) or variable (Bezier Progression (Logics/Loops)).
Progression Curve
A pName. A mechanism for visually describing the increment used at each
step of a Progression.
Referential
A pName. The element used as the point of reference for an operation. Typi-
cally, the element used as the point of reference for calculating a Transforma-
tion (for example, a translation).
209
6 Looking at Virtools Dev
Resource
Any element, BB, or BG, that can be directly imported into a composition (via
drag and drop or file selection); any element in a Virtools Dev compatible file
format.
Right
If an element is assumed to be a Character, the direction of the element’s right
hand with respect to the origin of the Local Coordinate System.
Root
The topmost element within a hierarchy. Root is also a relative term; any par-
ent is also the root for all descendent elements within a hierarchy.
The Level is the root of a composition.
Scale
A pName. A factor that describes the element's current size compared to it's
original size.
Scene, CKScene
A CKClass. An abstract element used to define the elements within a narrative
unit of a composition. A Scene is a logical construct used to define a group of
related elements and is not restricted to a geometric locale within a composi-
tion.
For example, scenes can be used to control which elements are active at what
time: in this part of the story, only these elements are active whereas in that part
of the story only those elements are active. Remember, only active elements are
processed.
Scenes contain references to elements and not copies of elements or the ele-
ments themselves.
Scenes are very useful when attempting to reduce the processing requirements
of a composition.
210
Glossary 6
Script
The visual representation of a behavior, applied to an element, as represented in
the Schematic.
A Script is composed of two parts – a header and a body.
The Script header displays the name and owner of the Script, and optionally a
small snapshot.
The Script body is composed of the Start and one or more BBs, BGs, para-
mOps, Parameters, bLinks, pLinks, comments, etc.
Mathematically, a Script is a graph whose nodes represent operations (BBs or
paramOps) and whose edges represent possible paths of data flow (pLinks)
and program flow (bLinks).
A Script is processed by following the bLinks as directed by the BBs contained
within the Script.
Setting
An S in the bottom left corner of a BB indicates that the BB has internal set-
tings that can be edited through its’ context menu.
Settings can take many forms. For example, Settings can control whether a BB
is time-based or Frame-based (Linear Progression (Logics/Loops)), or what
aspects of a BB are actually calculated at each activation (the Settings for
Mouse Waiter (Controllers/Mouse) control what bOuts are available and,
therefore, calculated each Frame).
Setup Parameter
A parameter available in the Setup for an element.
Sibling (Classes)
Classes that share a common parent class.
211
6 Looking at Virtools Dev
Sound, CKSound
A CKClass. A data set containing a digital representation of a sound.
NOTE Midi Sound (CKMidiSound) and Wave Sound (CKWaveSound) descend from this
Class.
(Parameter) Shortcut
A Parameter Shortcut is similar to the desktop shortcuts used in Windows. A
Parameter Shortcut is composed of a destination and a source, each identified
by arrow icons.
A Shortcut is actually another instance of a particular Parameter. Therefore,
the CK_ID of the destination has the same CK_ID as the source.
A Shortcut is dynamically updated and is often used to make a Parameter avail-
able across Script boundaries (the source is in one Script and the destination is
in another Script) or used to make a Parameter available within a Script with-
out using a pLink. A Shortcut can also be used to make a Parameter available
to multiple locations without requiring a pLink between the source and each
destination.
NOTE An Attribute is a Parameter attached to a BeObject. Therefore, a shortcut to an
Attribute can also be created.
Specular
See “Material Color” on page 201.
Specular (Light)
A pName. A directional light with the specular flag set, a light responsible for
highlights on a Material.
212
Glossary 6
Src, Source
A pName. From Material, sets a surface's blending coefficient.
From Transformation, the start point of a translation. The Source can be a
coordinate (expressed as a <Vector>) or the identity of an element within the
composition.
Start
The left-most icon within the body of a Script, the point at which a Script
begins.
Target Parameter
A special type of pIn used to explicitly identify the element affected by the
Behavior.
When a Behavior is attached to an element, that element becomes the owner of
the Behavior. Typically, a Behavior attached to an element is implicitly targeted at
the Script owner.
For example, Translate (3D Transformations/Basic) normally modifies the
position of its owner.
However, an Author may want a Behavior to affect a different element than
the owner. In this case, the Behavior must be explicitly targeted at a different ele-
ment.
Alternatively, an Author may attach a Behavior to an element of a different
type than the type supported by the Behavior (for example, an Author can
attach a Rotate behavior to a texture). A Target Parameter is automatically gen-
erated by Virtools Dev in the case of an incompatible class.
A BB is targetable only if there is a “T” in the Targetable column (between the
“Apply to” and “Description” columns) within the Building Blocks window.
If a Target Parameter does not already exist on a targetable behavior, a Target
Parameter can be added by selecting “Add Target Parameter” from the context
menu. A new pIn is created as the leftmost pIn. A Target Parameter input is
213
6 Looking at Virtools Dev
identified by a pair of small squares (rather than the usual single small triangle
for a regular pIn).
See also Applying Building Blocks to Elements.
Texture, CKTexture
A CKClass. An image used by a Material to give an element a certain appear-
ance. A Texture should have dimensions that are an integer power of 2 (e.g. 32
* 64, 128 * 128).
Transformation
An operation that affects one or more of the position, orientation, and scale of
an element.
Up
The Y-Axis in the default orientation.
User
A person interacting with a CMO or with an application created using Virtools
Dev; the end user.
214
Glossary 6
UV (Texture Coordinates)
The coordinate system used to define texture coordinates on a Mesh.
U and V coordinates are normalized to the size of the texture. A UV coordi-
nate of (0,0) indicates the top left corner of the texture. A UV coordinate of
(1,1) indicates the bottom right corner of the texture.
Variable
A V in the bottom left corner of a BB indicates that the Behavior is variable.
That is, the Author can do one or more of the following:
1. add bIns,
2. add bOuts,
3. add pIns,
4. add pOuts,
5. change some or all of the types of the pIns and/or pOuts.
For example, Sequencer (Logics/Streaming) supports the construction of
additional bOuts via the context menu. Parameter Selector (Logics/Stream-
ing) supports the construction of additional pIns via the context menu.
NOTE When changing pTypes, not all pTypes are available for all BBs.
Vector
A pType. A directed quantity; a magnitude and a direction. A Vector is always
defined relative to a Referential.
Virtools Dev uses two types of vectors: a Vector2D for 2D coordinate systems
(for example, screen coordinates expressed as [X,Y]) and a Vector for 3D
coordinate systems (for example, world coordinates expressed as [X,Y,Z]).
215
6 Looking at Virtools Dev
The magnitude of a vector (also known as the length of a vector) is defined as:
1. Vector2D
Magnitude = SquareRoot(X2 + Y2)
2. Vector
Magnitude = SquareRoot(X2 + Y2 + Z2)
The magnitude of a vector can be calculated using the paramOp Get Magni-
tude:
1. Vector2D
<Float> Get Magnitude <Vector2D>
2. Vector
<Float> Get Magnitude <Vector>
The direction of a Vector is defined as a ray (a directed line) with the origin of
the ray at the origin of the Referential and extending through the point (rela-
tive to the origin of the Referential) defined by the value of the Vector.
Vertex
A point in 3D space, used to define a Face in a Mesh. A Face is defined with
three vertices.
Workset
An arbitrary collection of elements and scripts constructed in the Level Man-
ager. A Workset is used to organize a composition (without regard to the type
of an element) and to control the visibility (within the Schematic) of the
Scripts attached to members of the Workset.
216
Controlling the Orientation of an Element 6
31 CONTROLLING THE
ORIENTATION OF AN ELEMENT
Virtools Dev can control the orientation of an element in two ways:
1. temporarily (until the next time the orientation is deliberately
changed), via Set Orientation (3D Transformation/Basic), and
2. permanently (within the composition) with Change Referential
(Mesh Modifications/Local Deformation).
Set Orientation calculates a transform (a transformation matrix) that applies
the appropriate operations to transform the element’s local coordinate system
into the desired coordinate system. The transform is applied to the desired ele-
ment every time Set Orientation is activated.
Set Orientation is often used to keep an element facing in the same direction
as the referential, particularly if the referential changes often. Virtools Dev can
maintain a copy of the element’s original orientation (via Initial Conditions) if
you need to be able to restore the element to its original orientation.
Change Referential also calculates a transform (a transformation matrix) that
applies the appropriate operations to transform the element’s local coordinate
system into the desired coordinate system. The transform is applied to the
desired element when Change Referential is activated and, within the com-
position, the change is permanent. You must ensure that no Initial Conditions (IC)
are set on an element before applying Change Referential.
The Change Referential BB is often used to ensure that a group of elements
share a common orientation.
Set Orientation, due to its dynamic nature, is more flexible than Change Ref-
erential. However, the increased flexibility comes at the cost of additional
processing overhead at runtime.
For example, to temporarily transform the orientation of Element 1 in 14-7 on
page 67 to match the Virtools Dev default coordinate system, perform the fol-
217
6 Looking at Virtools Dev
lowing steps.
1. Apply Set Orientation to Element1 and open the Edit Parameters dialog
box.
2. Set Referential to --NULL-- to ensure that orientation calculations are per-
formed relative to the orientation of the world.
3. Leave Up, Dir, and Local Up set to the default values.
4. Set Local Dir to (X=1, Y=0, Z=0) to inform Virtools Dev that the ele-
ment’s forward facing direction is the element’s local positive X-axis.
Element1 now faces in the same direction as the world’s positive Z-axis. Now,
when you direct Virtools Dev to move the element forward in the default ori-
entation (in the positive Z-axis direction relative to the world coordinate sys-
tem), the element moves forward as expected.
218
Example Transformations 6
32 EXAMPLE TRANSFORMATIONS
The essential data for each coordinate system is stored in a Local matrix and a
World matrix respectively. The local matrix and the world matrix are both 4 * 4
matrices of the form show in 32-1.
32-1 A coordinate system matrix
Xx Xy Xz 0 Right
Yx Yy Yz 0 Up
Zx Zy Zz 0 Dir
Xo Yo Zo 1 Position
where:
(X,Y,Z)x = The world space coordinates of the X axis of the local coordinate
system expressed as a unit vector (the first three rows of the first column)
(X,Y,Z)y = The world space coordinates of the Y axis of the local coordinate
system expressed as a unit vector (the first three rows of the second column)
(X,Y,Z)z = The world space coordinates of the Z axis of the local coordinate
system expressed as a unit vector (the first three rows of the third column)
(X,Y,Z)o = The world space coordinates of the origin of the local coordinate
system (the first three columns of the fourth row)
For each axis, the axis is defined as a unit vector (a vector of length 1) in the
world coordinate system.
The values contained in the fourth column are constant.
In the Parameter Debugger, this matrix is displayed as:
[Xx, Xy, Xz, 0][Yx, Yy, Yz, 0][Zx, Zy, Zz, 0][Ox, Oy, Oz, 1]
[Right][Up][Dir][Position]
219
6 Looking at Virtools Dev
32.1 Translation
A translation with respect to the local coordinate system is expressed as:
32-2 Translation matrix
1 0 0 0
0 1 0 0
0 0 1 0
Xt Yt Zt 1
where:
(X,Y,Z)t = The translation vector that defines how far the target entity moves
relative to the target entity’s current position.
32.2 Rotation
32.2.1 About Local X Axis
A rotation about the local X axis is expressed as:
32-3 Matrix for rotation about X axis
1 0 0 0
0 Cx Sx 0
0 -Sx Cx 0
0 0 0 1
where:
Cx = the cosine of the angle of rotation about the X axis
Sx = the sine of the angle of rotation about the X axis
220
Example Transformations 6
Cy 0 -Sy 0
0 1 0 0
Sy 0 Cy 0
0 0 0 1
where:
Cy = the cosine of the angle of rotation about the Y axis
Sy = the sine of the angle of rotation about the Y axis
Cz Sz 0 0
-Sz Cz 0 0
0 0 1 0
0 0 0 1
where:
Cz = the cosine of the angle of rotation about the Z axis
Sz = the sine of the angle of rotation about the Z axis
221
6 Looking at Virtools Dev
32.3 Scale
A scale factor is expressed as:
32-6 Scale factor
Sx 0 0 0
0 Sy 0 0
0 0 Sx 0
0 0 0 1
where:
Sx = the scale factor along the X axis
Sz = the scale factor along the Y axis
222
Index
223
Index
C D
C, Custom Dialog Box 111 Data organization 83
Cameras Depth of field 75
activating at Scene start 137 Depth sort 76
creating 42, 136 DirectX5 80
default 136 DirectX7 80
in rendering process 75 Document conventions 27
navigating 43, 134 Documentation 23
selecting 40
switching dynamically 146 E
targeting 138 Element 57
Characters Event log, displaying 53
adding to a Scene 134
controlling 139 F
CKClass 84
Class hierarchy, class system 83 Frame, process loop 97
Compositions (CMO) 57, 91 Frames per Second (FPS) 98
exporting to VMO 149 Further resources 23
saving 141
sharing with others 150 G
Coordinate system 59 Grids, creating 42
2D 59 Groups 95
3D 60 creating 48, 145
local/relative 63 selection 40
world/absolute 64 Guides, reference and screen 42
Create Web Page 150
Creation tools H
3D Layout 42 Help, getting 23
Level Manager 48
Curves, creating 42 I
IC, see Initial Conditions
224
Index
225
Index
226
Index
V
V, Variable BB 111
Vector2d, see Vectors
Vector3d, see Vectors
Vectors 62
Virtools Dev
Authoring Application 13
227