Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
RESEARCH PAPER
Shri Dadasaheb Gavai Charitable Trust Vikramshila Polytechnic, Amravati, Maharashtra, INDIA.
*Corresponding Author: dipakshirbhate@gmail.com
ABSTRACT
We present utilization of VRML language as a tool for interactive visualisation of physical simulations. Techniques for creating
interactive and visual simulations are analysed and practically implemented in form of a VRML library. Primary effort is focused to
the real-time interactive work, but the off-line visualization of large data sets obtained from other simulation systems is allowed as
well. Examples show that the proposed approach is easy to use, flexible and powerful enough to visualize both simple and more
complex processes.
Each part of simulation is discussed in following. second part is related to control the run of simulation. It
changes visual representation of simulation based on
Visual Model: Objective of all simulations is to present simulation parameters supplied from mathematical model
results of mathematical computations (generated from an (previously presented on-line type of simulation), or from
experimental theory or from an observation of real other simulation program (off-line type of simulation).
phenomena) to a user in a readable and understandable Particular properties of this division are discussed in next
form. Primarily it is in form of tables of numbers, graphs two points.
or animated visualisation of simulation. The focus is set
on the third form of visualisation, which enables creating Off-line Simulation: This set of simulations uses an
applications in an interesting visual form, understandable independent program, which can implement sophisticated
also for users that are not theoretically familiar with algorithms and procedures for precise creation,
presented problems. representation and problem solution. Problems solved by
this program can be so complex, that the results cannot be
Graphical User Interface: Main task of GUI is to create computed in real time. Then the computed data are
a visual interface between a user and a simulation control. preprocessed and finally sent to the simulation control.
This represents a set of visual displays that show actual The off-line simulation presents them to a user. The
state of simulation and simulated phenomena (e.g. advantage of this approach is precision of computation
different types of indicators, such as digital displays), and model, which is based on program dedicated to solve
a set of control elements that allows interactively interfere simulation problems. This program can compute large
with simulation (e.g. different types of buttons, simulation problems independently on user's machine,
controllers). which is used only for presenting results to a user. In this
case the visualisation is almost independent on
Simulation Control: The tasks of simulation control can mathematical model previously used. On the other hand
be divided into two parts, each communicating with the the user is not able to view result dependency on change
other. The first part is the simulation control related to in input parameters in real-time (e.g. immediately). The
GUI. It traces user requests to change simulation Figure 2 represents block diagram of off-line simulations.
parameters and supplies values for displays in GUI. The
On-line Simulation: For primitive simulations, which do visualisation engine. The second disadvantage can be the
not need complex computations, the solving of problem implementation of simulation solving engine directly in
can be incorporated into simulation control. This type of simulation model. For new algorithms used for solving
simulation can reflect user's changes of input values of the same problem it is needed to change simulation
simulation immediately (or almost immediately, control. This type of simulations can be divided into two
depending on implementation of simulation computation groups; each of them is applicable for different tasks:
algorithm). Main disadvantage is restriction to Passive On-Line Simulations: Simulation solving
mathematical or algorithmic simple simulations, because engine computes behaviour of visualisation model
computation must be performed in real time, during once for one change of input values and then it
simulation presentation. Simulation is limited to user's "sleeps" until input values are changed again. This
computer resources, which are already used in group is analogy of off-line simulations with the
Dipak VInayak Shirbhate, Dilip Sahebrao Ingole and Uday Ashokrao Mehare VSRDIJMCAPE, Vol. IV (VIII) August 2014 / 121
exception, that off-line simulations do not contain position based on actual time of simulation. This sort
solving engine inside simulation. Passive simulations of simulations assumes knowledge of the solution
can be also used for simulating phenomena, which based on time, and it must be sufficiently simple to
are independent of time (e.g. simulation of non- be computed in real time. Active simulations
kinetic models). One good example can be implement only simple simulations; main advantage
simulation of reflection or refraction of rays inside a of this solution is immediate response to user
user defined and modified environment. changes of input values. An example can be
Active On-Line Simulations: Simulation solving simulation of pendulum, based on all the parameters
engine computes continuously behaviour of defined by the user (e.g. gravity).
visualisation model based on current state of input
values and on current time inside simulation. Such Figure 3 shows block diagram of both on-line simulation
models can have kinetic equations implemented in groups.
simulation solving engine, which computes e.g.
3. VRML
The Virtual Reality Modeling Language (VRML) is a file VRML is capable of representing static and animated
format for describing interactive 3D objects and worlds. dynamic 3D and multimedia objects with hyperlinks to
Now it is defined as ISO standard ISO/IEC 14772-1; other media such as text, sounds, movies, and images.
1997, for further information look at web site VRML browsers, as well as authoring tools for the
http://www.vrml.org/Specifications/VRML97/index.html. creation of VRML files, are widely available for many
VRML is designed to be used on the Internet, intranets, different platforms. VRML supports an extensibility
and local client systems. VRML is also intended to be a model that allows new dynamic 3D objects to be defined
universal interchange format for integrated 3D graphics allowing application communities to develop
and multimedia. VRML may be used in a variety of interoperable extensions to the base standard. There are
application areas such as engineering and scientific mappings between VRML objects and commonly used
visualization, multimedia presentations, entertainment 3D application programmer interface (API) features.
and educational titles, web pages, and shared virtual Each VRML file:
worlds. VRML has been designed to fulfill several implicitly establishes a world coordinate space for all
requirements: objects defined in the file, as well as all objects
Enable the development of computer programs included by the file
capable of creating, editing, and maintaining VRML explicitly defines and composes a set of 3D and
files, as well as automatic translation programs for multimedia objects
converting other commonly used 3D file formats into can specify hyperlinks to other files and applications
VRML files. can define object behaviours
Provide the ability to use and combine dynamic 3D
objects within a VRML world and thus allow re- Main structure of language is based on object oriented
usability. programming concepts. All parts of VRML scene are
Provide the ability to add new object types not defined by group of object definitions in the source text
explicitly defined in VRML. of scene. It is defined by "nodes"; in OOP terminology
Capable of implementation on a wide range of they can be called objects. Nodes have defined internal
systems. data - "fields" with default initial value, which can be
Emphasize scalable, interactive performance on a redefined. Each node can contain input and output fields,
wide variety of computing platforms. called event In and event Out. They generate or receive
Enable arbitrarily large dynamic 3D worlds. events to/from other nodes. These events are for example
Dipak VInayak Shirbhate, Dilip Sahebrao Ingole and Uday Ashokrao Mehare VSRDIJMCAPE, Vol. IV (VIII) August 2014 / 122
changes of object position or node's field value. For ScalarInterpolator), time generator
passing events between nodes mechanism of routes is (TimeSensor) and script nodes containing
created. ROUTE keyword defines interconnection programming code in Java or JavaScript (Script).
between eventIn of one node (destination of event) and Browser Communication: Nodes used for interaction
eventOut of second node (source of event). with host browser (NavigationInfo) or used for
creating links to other HTML or VRML documents
Nodes are grouped by their functionality into several
(Anchor).
categories:
Special Nodes: Nodes used for grouping other
Visible Geometry Nodes: Nodes representing basic
children nodes thus enabling creation of hierarchical
geometric primitives (Box, Sphere, Cone,
structure of nodes in scene (Group, Transform,
Cylinder), extended geometric primitives
Billboard, Collision, Switch, LOD). Sound
(IndexedFaceSet, Extrusion, Text), special
emitting node (Sound). Node changing style of text
objects (IndexedPointSet,
nodes (FontStyle).
IndexedLineSet). Nodes used for changing
visual representation of geometry by defining its VRML and Simulation: Basic structure of interaction
colour (Material) and textures (ImageTexture, process in VRML scene is on Fig. 4.
MovieTexture). Nodes used for changing
background of scene (Background) and nodes
adding special visual effects (Fog).
Invisible Geometry Nodes: These nodes are not
directly visible, but they can affect visual Fig. 4: Scheme of Interaction Process in VRML
representation of other visible nodes in scene. A node
used for defining lights (PointLight, SpotLight) A user does some interaction with VRML scene,
belongs in this category. Node used for predefining affecting Sensor node. Sensor node then generates an
starting location of viewer (Viewpoint) event, which is processed through Script and is sent to
Sensors: Invisible nodes which enables direct Time Sensor. TimeSensor starts generating time events,
interaction with user (TouchSensor, used for interpolating in Interpolator node. Output of
PlaneSensor, CylinderSensor). Nodes Interpolator node is routed to Geometry or other node.
detecting movement of user (ProximitySensor) This is a very basic concept, some of described nodes can
or other events created by user movement be bypassed or some other can be inserted into the event
(VisibilitySensor). route. In the VRML scene more of these event routes can
be used independently or they can affect each other.
Control Nodes: Nodes used for interpolating values
between defined set of key-values Simulation parts described in point 2 can be implemented
(ColorInterpolator, in VRML in the way schematically described on Fig. 5.
PositionInterpolator,
RotationInterpolator,
Simulation control part controls operation of the whole VRML scene. It is implemented by Script node. Script
Dipak VInayak Shirbhate, Dilip Sahebrao Ingole and Uday Ashokrao Mehare VSRDIJMCAPE, Vol. IV (VIII) August 2014 / 123
gets input values from input GUI nodes, creates values visible geometry, used in conjunction with VRML
for output GUI nodes and communicates with scene sensors and control script to convert user input to VRML
geometry. In off-line simulations Script does not compute data. Data types supported by STB library for input
any new values for scene geometry, it controls only components are following:
"playback" of precomputed values stored in interpolator SFBoolean: Implemented by set of buttons
nodes. Scripts in on-line simulations are more complex, (inpButton).
they must compute actual values of simulation based on SFInt32: Implemented by switches
values from input GUI nodes. Script node is (inpMultiSwitch).
interconnected with TimeSensor node, which is used for
SFFloat: Implemented by set of scrollbars, knobs a
generation of simulation time.
digital calculator (inpScrollBar, inpKnob,
GUI is divided into two parts: input components (nodes inpFloatDigitalCalc).
used for user input) and output components - displays
(nodes presenting data to user). These components can Other data inputs can be done by using standard types and
contain sensors (input components only), visible converting components (e.g. three SFFloat data inputs
geometry and control scripts implementing behaviour of can be converted to one SFColor data value).
component. Input and output events from them are then
routed to control script. Output GUI components utilize scripts. They then control
visible geometry, used for displaying data values. Data
Simulation geometry contains geometry used for types supported by STB library for output components
visualization of simulation subject. For off-line are following:
simulations there is also an interpolator node, used in SFBoolean: Implemented by indicators
conjunction with TimeSensor for playback of (disShowBool).
precomputed key values of simulation. SFInt32: Implemented by indicators with multiple
shapes or colours (disShowInt32).
The Simulation Tool Box: Based on concepts introduced SFFloat: Implemented by set of scrollbars and
in Point 3.1, library of basic elements is proposed. It
knobs (disShowFloat, disShowFloatKnob)
contains basic components used for building simple
or by digital display (disShowFloatDigital).
simulations. This library is called Simulation tool box or
STB. It is created using concept of external VRML SFString: Components used for creating text
prototypes (EXTERNPROTO), which enable to create labels (disTextLabel).
new types of nodes. The nodes are defined outside main
simulation VRML file and they are imported using Other VRML types can be converted to supported data
EXTERNPROTO keywords. Main simulation file then types (e.g. SFColor converted to three SFFloat
contains only references to used external nodes, geometry values can be displayed by three scrollbars).
used for visualization of simulation and main simulation
script. Auxiliary components are various data converters used
for converting simple VRML data types (SFBoolean,
STB library is divided into three parts: SFInt32, SFFloat) from/to other data types (e.g.
Input GUI components - Components used for data SFColor). They contain only a converting script, which
input; this part implements set of buttons, scrollbars, converts input data types to different output data types.
knobs etc. During conversion it is possible to adjust input value (e.g.
Output GUI components - Components used for by linear scaling). Examples of these conversion
displaying data; this part implements set of components in STB library are:
indicators, gaugers, displays etc. conBoolInt32: Converts SFBoolean to two
Other components - Set of auxiliary components, possible SFInt32 values.
designated for simplifying common tasks (e.g. conFloatVec2: Converts two SFFloat values to
steppable TimeSensor or components used for data one SFVec2f value.
conversions between different VRML data types). conColFloat: Converts SFColor value to its
three SFFloat components.
4. EXAMPLES
For demonstration purposes few simple examples of Next set of auxiliary components are supporting scripts,
simulations in VRML are created. In this point like steppable TimeSensor and script implementing
implementation of STB library from Point 3.2 and its simple control panel. Steppable TimeSensor component
utilization in a pendulum example is presented. (stepTimeSensor) is able to generate time events like
standard TimeSensor, or time can be stepped by defined
Simple STB Library Implementation: Example of time slice forward or backward. Generated time can be
simple STB library contains set of usable components, also accelerated or decelerated with respect to real time
implementing GUI components and simple auxiliary (e.g. one second in simulation can be 10 seconds in real
components. time).
Input GUI components in library are constructed from Table 1 shows program interface (EXTERNPROTO) of
Dipak VInayak Shirbhate, Dilip Sahebrao Ingole and Uday Ashokrao Mehare VSRDIJMCAPE, Vol. IV (VIII) August 2014 / 124
a component from STB library. This EXTERPROTO is component is used in the same way as standard nodes that
included in source code of VRML scene. Then the are by its name and definition of new values.
Implementation of each component is divided into four Experimental Model: We have developed several
parts, each part has following meaning: experimental simulations using STB library presented
Component header - contains VRML file header and previously in Point 4.1. One of them is simple
definition of PROTO header, in which all public data mathematical pendulum, implementing well-known
fields and events of component are defined. simplified kinetic equation (see Figure 7).
Component geometry - contains sensor and geometry
of component. This part of component is visible to a
user.
Component control script - contains script, which is
controlling behaviour of component, controls data
input, output and changes to component geometry. Fig. 7: Kinetic Equation of Mathematical Pendulum
Component routes - this part defines ROUTEs used
for linking geometry and script of component. The equation is implemented in simulation's control
script. The script receives time events from TimeSensor,
Figure 6 shows some examples of GUI components. computes new actual position (rotation) of a pendulum
and updates corresponding geometry. The user can
change the gravity, the length and the starting angle of the
pendulum. Example of screen with simulation in phase of
setting input values is in Fig. 8.
The simulation VRML program consists of 5 parts: EXTERNPROTOs for components included from STB
VRML file header - contains VRML header and library.
Dipak VInayak Shirbhate, Dilip Sahebrao Ingole and Uday Ashokrao Mehare VSRDIJMCAPE, Vol. IV (VIII) August 2014 / 125