Title: CS461561 Virtual Environments: Principles
1CS461/561Virtual Environments Principles
ApplicationsVirtools Basics
- 1-21-2008
- Prof. Searleman
- SC375
- jets_at_clarkson.edu
2Overview
- Basic Concepts in Virtools
- Homework
- Virtools Exercise 1, due today
- Virtools Exercise 2, due Wednesday, 1/23/08
- Complete the Virtools Introduction
31. Virtools Authoring
- The authoring application allows you to create
compositions (CMOs) where 3D objects are given
behaviors and attributes. - Virtools is not a modeling application. Other
applications, such as 3D Studio Max can be used
to create models, which then can be imported into
Virtools.
42. Behavioral Engine
- The behavior engine, CK2, processes the behaviors
of how each object acts in a given environment. - Behavior Building Blocks (BBs) are used to
create behaviors. Virtools has an extensive
library of BBs. - Managers are used to support the behavior engine.
Examples are the LevelManager, ResourceManager,
SoundManager HierarchyManager
53. Render Engine
- This performs the graphics rendering, and can be
customized with the SDK it consists of 2 parts - - CK2_3D determines what should be drawn (list of
visible items) - - Virtools Rasterizers, which support Direct X
and OpenGL, draw the items on-screen
64. Web Player
- The Web Player allows playback of a virtools
application via a web browser. - Virtools compositions (.cmo) can be exported to
the Web Player (.vmo)
75. Software Development Kit
- The SDK allows you to customize the Behavioral
Engine and the Render Engine. That is, you can
write your own functions in C and convert them
to building blocks. - create new behaviors or modify existing ones
- create new parameter types
- create media plugins to read any media types
- replace the Virtools render engine with a render
engine of your choice - create a custom executable file (.exe)
- modify extend the render engine full source
code to the rendering engine is provided
8Creating a Virtual Environment in Virtools
9Elements of a Composition (CMO)
- BeObject an object to which a behavior can be
applied - RenderObject visible in play mode
- Objects that may be visible, but usually are not
Camera, Curve, Grid, Light - Objects that are not visible Array, Group,
Level, Material, Mesh, Place, Scene, Sound,
Texture
10Steps to create a composition
- Import objects (ResourcesImport)
- Use the Level Manager to set up the object
- rename it
- double-click the object to get 3D Object Setup
- adjust the world coordinates (0,0,0)
- rotate it as desired
- change the color textures (if desired)
- Add lighting
- Add cameras
- SET INITIAL CONDITIONS
11Reminders
- Save your composition often (say every 15 mins or
so, or when you make a change in the objects) - Set initial conditions whenever you change any
setting about an object, before you run the
composition - A directory has been set up for the class on
Atlas - S\Classes\Computer Science\cs461\
12Basic Concepts in Virtools
- Level Manager organizes the composition
- use to set up objects, lights and cameras
- THEN SET INITIAL CONDITIONS
- Schematic creates edits scripts
- a script describes how an object behaves
- Building Blocks (BBs)
- a library of behaviors, organized by the type of
behavior and/or by the type of object to which
the behavior can be applied - Media objects created in other apps (e.g. Maya)
- e.g. model, sound or image
- Data Resources ResourcesOpen Data Resource
- used to import media objects into the VE
133D Entity
- A 3D Entity defines a position, an orientation,
and a scale - 3D Frame
- - null object
- - no geometry (invisible)
- - used to provide a referential
- 3D Object
- - have a geometry (i.e. mesh)
- - may have gt1 mesh, but only 1 is active
- - cannot be created within Virtools
14Shared Mesh and/or Material
Dependency if you delete Kens mug, you will be
asked about dependencies. If you select full,
Andys mug no longer has a shape!
15Recap Object, Mesh Material
Objects can share a mesh. A mesh can share a
material. If you delete an object that is sharing
a mesh or material, specify no dependencies
(meaning that it will not delete the shared mesh
or material).
163D Coordinate System
- defaults to metric (1 unit 1 meter)
- X horizontal Y vertical Z depth
(Left-handed coordinate system) - Local coordinate system set when a 3D entity is
created typically this is 1 corner of the
bounding box or is the barycenter (geometric
center) of the entity - World coordinate system (absolute coordinates)
shared by all elements in a composition
17Referential
- point of reference for a 3D transformation (e.g.
scale, rotate, translate) - used as a parameter input to a BB (pIn)
- referential value --NULL--
- means the world coordinate system
- referential value name of the entity
- means the local coordinate system
18Mesh
- Geometry (wireframe)
- triangular faces vertices
- cannot create a mesh in Virtools
- List of materials
- Channels gt 1 layer of material
- Lit mode
- lighting done by Virtools
- prelit static object (done in 3DS or Maya)
- Texture Wrap
- Sharing
- gt1 object can share a mesh
- gt1 meshes can share a material
19Lights
- There are 3 types of lights in Virtools
- directional light point light spot
light
directional lt point lt spot (in terms of
complexity)
20Add Lighting
- Add a spot light
- use the level manager to rename it
- use Setup to position it
- Add directional lighting
- use the level manager to rename it
- use Setup, select Directional
- Position it, say at (0,10,0)
- Change its orientation to (90,0,0)
21Cameras
- There are 2 types of cameras in Virtools
- Target camera
- - always looking at a target defined by a
frame - - cannot specify orientation
- Free camera
- - useful since you can change the
orientation - Create Camera button creates both a camera a
target to get a free camera, delete the target
using the level manager
22Camera
23Rendering
- View Frustrum (view volume)
- defined by the current camera its near far
clipping planes
24Building Block
- blue Behavior Inputs (bIn)
- green Behavior Outputs (bOut)
- red Parameter Inputs (pIn)
- violet Parameter Outputs (pOut)
25Rendering a Frame
- Process Loop
- repeat
-
- forever
Process Behaviors Render
1 frame
26BB Operating Cycle
- BB is inactive
- At least 1 input is activated gt BB is activated
- BB reads the input parameters performs its
function - At least 1 output is activated
- Some BBs stop here (go back to 1) and others
reactivate themselves even if no input is active
(go back to 3)
27Example Delayer BB
one Behavior In (BIn) / one Behavior Out (BOut)
28BIn/BOut Building Blocks
Some building blocks have one In and one Out.
The BB starts out as inactive. When you activate
the In, the BB performs its operation, activates
the Out, and becomes inactive. To repeat a
behavior, you must explicitly have a link back to
the behavior In in order to reactivate the
BB. Examples Delayer BB (above), Rotate BB,
Translate BB.
29Example Timer
one Behavior In (BIn) / one Behavior Out
(BOut) one Loop In / one Loop Out
30Loop In/Loop Out Building Blocks
Some building blocks have an In, a Loop In, an
Out, and a Loop Out. The BB starts out as
inactive. When you activate the In, the BB
performs its operation and then activates the
Loop Out. To repeat a script, connect from Loop
Out to the looping scripts In, and have a link
from the looping scripts Out back to the BBs
Loop In. When the loop is finished, the BBs Out
is activated. Example Timer BB.
31Loop In/ Loop Outdetails
- BB is inactive
- In is activated the BB activates Loop Out
following the pink link BB is still inactive - We link Loop Out to the script we want to execute
for the specified time (in this case, 3 seconds).
To have the timer active again, My Looping
Script needs to reactivate Loop In. Then, during
3s, the timer will work following the violet
link - Inactive -gt Loop In -gt Active -gt Loop Out -gt
Inactive - Finally, when Loop In is activated but the time
elapsed gt 3s, the timer will work according to
the orange link and activates Out. The BB is
inactive. Back to 1.
32Example Chrono
On / Exit On Off / Exit Off
- also note can use trace mode to display a
parameter value (such as elapsed time)
33Activate/Deactivate Building Blocks
Some building blocks, once you activate their On,
the BB stays active until they are explicitly
turned off by activated their Off Examples
Switch On Key BB Chrono BB (above).
34On/Off Details
- BB is inactive.
- The user presses the 1 key. On is activated, the
BB performs an action and activates the Out On
output (violet link). The BB is now active and
will call itself every frame and perform an
action until the Off input is activated. - The user presses the 2 key. Off is activated, the
BB performs an action and activates the Out Off
output (pink link). The BB is now inactive. Go
back to 1.
35Graphical Flags
36Construct
- v flag variable number of inputs/outputs
- To add a bIn/bOut or pIn/pOut, right-click in the
BB and select Construct - Example Switch On Key BB
37File Types
- .cmo
- - full composition with both objects scripts
- - FileSave Composition
- .vmo
- - full composition without scripting
- - cannot be loaded by Dev
- - used by Web Player or standalone app
- - FileExport to Virtools Player
38File Types, cont.
- .nmo
- - 1 or more objects, with or without scripts
- - can be imported into the current composition
- - ResourcesImport File or Import File As
- - Useful for dynamic loading
- .nms
- - contain either a graph or a script
- - to save a script, select it, right click,
select save as give directory name, in the
Behavior Graph directory of your resources
folder give description, version, author name to
appear in the resource window