Speakers
Mr
Emanuele Ruffaldi
(PERCRO Lab, Scuola S.Anna, Pisa)Mr
Walter Aprile
(PERCRO Lab, Scuola S.Anna, Pisa)
Description
In this talk we present the embedding of Python inside the eXtreme Virtual
Reality (XVR) Engine. XVR is an advanced and lightweight system for the development
of Virtual Reality applications both for the Web and for 3D Immersive systems.
This system has been extensively used in European Projects for the construction of
high quality 3D graphic applications enhanced with VR devices. XVR applications are
written in the S3D scripting language and compiled into a bytecode representation
executed by the XVR Virtual Machine. The scripting language and the virtual machine
are specialized and optimized for the manipulation of 3D entities and efficient
object oriented programming.
The XVR system allows to develop and deploy 3D application easily by asking
the developer only to write the core rendering loop and place the application in a
Web page. The XVR Engine provides natively a set of classes for creating Virtual
Reality applications ranging from 3D graphics (both high level classes and low level
OpenGL functions), 3D sound and physics. Moreover it is possible to extend such
features with external native modules providing the support for new devices,
simulation engines or rendering techniques. At runtime the external modules are
loaded and their classes integrated in the system namespace.
PYXVR is a XVR extension that allows to embed a Python script inside a XVR
application or, putting it in another way, write a Virtual Reality application using
the XVR Engine features. Typically the XVR application loads the PYXVR extension,
executes the scripts and invokes Python in response to the rendering (OnFrame) and
animation (OnTimer) events of the XVR Engine.
The result is a dual script environment in which the two scripting engines cooperate
for providing the best of the two worlds. The Python scripts are able to access all
the functions and classes defined by XVR (both scripted and native), while the XVR
script accesses the Python scripts through the eval and callback functions
There are some advantages to using Python inside a XVR application. First there is
the possibility of modifying and extending the application using the script, because
the XVR application is completely defined at compilation time. Then there is the
possibility of using the Python libraries and multi-threading for enhancing the
XVR application. Despite the advantages there are some drawbacks that should be
taken into account. First there is the aspect of security. XVR applications are
typically executed in the Web Browser and the XVR classes respect the security
requirements of this environment. The PYXVR extension allows the unrestricted import
of modules and for this reason it is currently limited to local XVR applications. The
second disadvantage of PYXVR for 3D Web application is the weight of the Python
engine whose core shared library is in the order of one megabyte, a size that is
equivalent to the whole XVR engine comprising the Virtual Reality features.
With regards to the execution speed, the S3D scripts are faster than
the Python ones in managing objects and external entities because during the
off-line compilation of the script all the names and functions are known and encoded
in the byte-code. The simpler type space of S3D provides also additional
optimizations when dealing with 3D entities.
The talk discusses the overall PYXVR extension, the aspects of integration
between the two environments, the multi-threaded features and finally a performance
evaluation of this solution.
Concluding, the PYXVR extension presented in this talk can be used by XVR
developers for enhancing their XVR applications and at the same time by Python
developers for the fast prototyping of Virtual Reality applications.
Information about XVR can be found at http://www.vrmedia.it
More information on PYXVR will be shortly provided on:
http://wiki.vrmedia.it/index.php?title=PYXVR
Summary
eXtreme Virtual Reality (XVR) is a system for the development of Virtual
Reality applications based on a specialized scripting language and Virtual Machine.
In this talk we discuss the PYXVR extension for XVR that allows to enhance
XVR applications using Python for providing more flexibility or accessing
existing Python libraries.
The result is a Dual Scripting environment in which the two virtual machine cooperates.
Authors
Mr
Emanuele Ruffaldi
(PERCRO Lab, Scuola S.Anna, Pisa)
Dr
Marcello Carrozzino
(PERCRO Lab, Scuola S.Anna, Pisa)
Mr
Sandro Bacinelli
(PERCRO Lab, Scuola S.Anna, Pisa)
Mr
Walter Aprile
(PERCRO Lab, Scuola S.Anna, Pisa)
Co-authors
Dr
Franco Tecchia
(SSSA, Pisa - Laboratorio PERCRO)
Prof.
Massimo Bergamasco
(SSSA, Pisa - Laboratorio PERCRO)