Building Collaborative Virtual Spaces with Distributed Software Components and Locally Rendered Objects Víctor S. Theoktisto USB, Universidad Simón Bolivar Caracas, Venezuela vtheok@usb.ve Abstract This article describes several distributed frameworks for building collaborative virtual environments, and their advantages as teaching tools. The frameworks create and manage interactive virtual universes using an implementation of CORBA distributed object services in C++ and Java, having global state and a local client renderer for either Java3D (DJ3D) or OpenGL (PDVOL-Vision). Virtual spaces are built as common scene graphs called State Universes, visible to all session clients. State Universes can be saved, restored, and restarted. Clients may subscribe and leave without affecting in real time object behavior. Persistent objects are inserted and manipulated in the shared space, while object integrity and coherence are achieved by broadcasting structural and behavioral state changes to all nodes. Multiple renderings may be done locally at each node, varying the camera position and/or the render model. Simultaneous interaction among nodes (“users”) is seen and rendered by all clients in real time, allowing collaboration among actors for building scenes and adding new objects. The framework has been successfully applied in scientific visualizations, stereoscopic views, collaborative assembly and network games. Keywords Distributed Rendering, Software Components, Virtual Spaces, CORBA, OpenGL, Java3D 1 INTRODUCTION The explosive growth in computer graphics techniques and applications has raised the bar on the scope and quantity of topics that can be timely taught at the undergraduate level, needing sophisticated tools for modeling, imaging and rendering that require increasing performance improvements in graphics hardware. Many schools do not have the expensive equipment and applications needed for serious graphics work, and have to share them with competing disciplines in their own campuses. There exists a need for standards-based distributed platform, harnessing spare computing power to reduce problem-solving complexity, where practitioners and apprentices can meet, share knowledge and develop together. 1.1 Distributed Virtual Environments Distributed virtual environments are “meeting points”, allowing several users to collaborate within the realm of a virtual world to achieve a common goal. Inhabitants of virtual worlds must be aware not only of their local surroundings and actions but of other inhabitants presence and interactions [Raposo2001]. Since users are working at geographically separated locations, they should interact in the same environment, so collaboration and shared visualization is a common feature of all distributed virtual environments [Saar1999]. The usual approach for distributed applications is the Client/Server model (there is also the P2P or Peer-to-Peer model). One or more servers create local objects and receive access requests on those objects from remote clients. Some mechanisms must be in place, such as object location in the network, remote communications, and information exchange. Several standards for distributed objects (Java RMI, CORBA, DCOM) have been incorporated in distributed applications for visualization and collaboration [Elvins1996], [Bajaj1999] and [Saar1999]. The VR-Lab distributed environment for educational purposes is described in [Fellner1999]. All these implementations are object based and have their own particular data flow on TCP/IP networks. 2 CORBA SOFTWARE COMPONENTS The Common Object Request Broker Architecture (CORBA) was created by the Object Management Group [OMG1999] with the objective of promoting an objectoriented perspective in distributed communications. This is accomplished by specifying a common standard for the development of distributed applications, relying on the reusability, portability, and interoperability of objects in heterogeneous environments. CORBA describes a threetier specification for dividing functionality in Presentation, Business Logic and Data Storage layers. The CORBA bus defines the components’ structure and manner of interaction (Fig. 1), allowing low-level communications as synchronized remote procedure calls (RPCs). CORBA also allows asynchronous interaction. Clients can continue working after issuing requests without having to wait for an immediate result. Classes can be implemented in several languages, executed on different operating systems and platforms, and dispersed through out a heterogeneous network. which each object is factorized and separated into Model (behavior), View (rendering) and Controller (interaction) related classes. The architecture allows the creation of simple objects with transactional, secure, locked or persistent attributes. These objects are able to interrelate and find themselves within the bus. CORBA specifies an extensive service set for object creation, disposal, name access, storage and retrieval, and how to define relations among them [Orfali1998]. Table 1. The MVC applied to Distributed VR Model Behavior State Universe global View Rendering Visual Universe local Controller Interaction User Interface local In a distributed system, it is desirable to have these classes physically apart, but in constant communication [Beaudouin2000], [Wood1997]. Figure 1. The CORBA Bus Architecture 2.1 CORBA Main Advantages Separation between interface and implementation. All CORBA components are specified by the Interface Definition Language (IDL), a purely declarative language that is implementation independent, with bindings for C++, Java and others languages. Localization Independence. The kernel of the implementation is the Object Request Broker (ORB), a naming service that locates objects transparently. It routes objects petitions across the network. Vendor Interoperability and Systems Integration. The Internet Inter-Operability Protocol (IIOP) specifies how to change the messages from General Inter-ORB Protocol (GIOP) in TCP/IP networks with SSL, making the Internet a giant, secure ORB. The 2.3 standard [OMG1999] defines the Portable Object Adapter (POA), which manages creation, registry, destruction, reference handling, and activation of objects. A definable set of policies specifies each POA’s behavior on its associated objects, which may include policies for threading, life cycle, identity, activation, retention, persistence, request processing and others. 3 THE MODEL-VIEW-CONTROLLER (MVC) PARADIGM FOR USER INTERACTION There is a constant fight for efficiency improvement in all graphics environments, driven by the quest for real time “visual realism”. Complex scenes are difficult or impossible to render in real time because they have many detailed objects in them. Each object must have its state sampled at certain time intervals, which may involve lengthy calculations and interactions with other objects. Finally, resulting state changes must be translated into visual renderings, requiring further computation. Each object may be considered as a class triad using the Model-View-Controller paradigm (MVC, Table 1), in Figure 2. MVC Objects in Distributed VR Environments. Object states are calculated at the distributed state universe (US), interaction (C) is handled at the local Java VM level, and graphics operations are delegated to the chosen graphics environment (UV). Each component then is running in the best environment possible (Fig. 2), with CORBA coordinating communication flow. 4 IMPLEMENTATIONS Practitioners and educators have several options open if they decide on using distributed virtual environments for CG teaching, most of them free, or open source. All server activity is hidden by CORBA. 4.1 DiVE One option is downloading a free VRML visualization package such as DiVE [Frecon1998], with client and server binaries for almost all current CG platforms. Sadly, it is neither OpenGL nor CORBA compliant. 4.2 Pure OpenGL A distributed approach is fraught with incompatibilities of the “Pure OpenGL” rendering option at local clients, since makefiles must be tweaked to account for platform diversity and available compilers. Compliance with OpenGL itself and its varied user interface libraries is also a concern. 4.3 Java3D An homogeneous distributed platform for graphics development is achieved by using some CORBA ORB with the Java IDL binding for communications, the Java3D scene graph description with rendering at the local level [Brown1999], and Java Spaces and Servlets providing the necessary storage and computations. Fig. 5. GL4Java example. Fig. 4. DJ3D object placement example. However, although Java allows for greater user interaction, Java3D has not been implemented for all platforms. We have developed DJ3D [DJ3D2001], a distributed environment based on CORBA, Java3D and the MVC paradigm. In the previous image (Fig. 4), each object exhibits simple behaviors while being manipulated by remote users. The user interface Client part was developed in Java Swing. All interactions are sent to the distributed software component hosting the State Universe, and then broadcasted back to each local Visual Universe as changes to be rendered in Java3D. Other generated examples with DJ3D include a rotating solar system simulation and network chess. 4.4 GL4Java (Java + OpenGL) GL4Java is an open source library that implements a subset of the OpenGL specification within Java. It maps Java methods to their corresponding OpenGL calls using the Java Native Interface glue (JNI). A Java AWT canvas object is used as the graphics viewport (Fig. 5). GL4Java scenes are call-by-call equivalents of an OpenGL programs. Being implemented in Java, it can be linked to some Java compliant ORB by the Java IDL, and thus render remote GL4Java objects. 4.5 Java-to-OpenGL JNI Bridge Instead of translating every OpenGL call to Java, a better approach is to keep all rendering in OpenGL (with C o C++ bindings) and use the JNI bridge for message passing. Drawing is done on top of a Java AWT canvas object with its own User Interface widgets, but it is OpenGL who does the representation and drawing. The advantage is that a lot of OpenGL code can be imported straight away, taking some care when factoring all user interaction in the Java part of the interface. The following figures are snapshots of the PDVol-Vision developed by us at USB for a local oil company. This application is the front-end visualization software component of a huge reservoir simulation application. [PDVol2002]. Fig. 6. Geometric Rendering of an Oil Resevoir Distributed software components access large databases over high-speed networks and create remote objects representing reservoir properties. It is implemented also following the MVC user interface paradigm. Figure 6 shows a geometric view of a reservoir object, while Figure 7 shows a volumetric rendering of a complex protein. Both share the same Java interface for object and environmental manipulation. 5.3 Distributed Rendering Course participants may divide a scene in zones and render each one at a different workstation. Each partial render is then delivered as a pixel map and sent to another object (a visual monitor), which collects maps and places them appropriately as a partial texture. Since each render may have been done with different parameters, it is possible to render parts of the scene at different color depths, render models and with special effects. Fig. 7. Volumetric Rendering of a Protein The front-end application can be used to render standard volumetric and geometric datasets. A similar nonproprietary version is being developed at the moment. 5 CLASSROOM SCENARIOS There are several classroom approaches that can be applied under the distributed framework, regardless of the local rendering approach used. All of them start from simple distributed state universes, which are shared by all visual clients. 5.1 Object Modeling and Composition Course participants model and place static objects into a scene. Each object has the dual behavior-representation nature. Complex visual detail and behavior is progressively added to objects, such as hierarchy, surface detail. Environmental parameters control the scene through a very simple user interface (in Java). By opening several views on the same workstation, each with its own camera model, location and rendering model, it is very easy to visualize different concepts and algorithms. User interaction is implemented at the Java front end. One premier example was a collaborative effort in building a shared structure made of virtual LEGOs, created locally at each client and placed in the distributed scene. 5.2 Animation and Object Interaction Course participants model behavior and animation among objects, including collision detection. All manipulate objects and observe the effect on the scene, from their own particular point of view. When any object goes through a state change, all objects reflect that change on the visualization are immediately and continuously updated to the global CORBA environment, where it is picked up by all shared scenes. User interaction is passed thru form the Java AWT canvas to the State Universe and reflected back. A typical use is free navigation with particle systems, such as network games. 5.4 Scripting, Recording and State recovery Since all state and behavior reside in the State Universe, universes can be saved and restored at will. A simple script can be devised specifying state changes in some scheduled time, which can be replayed for a “live, repeatable performance”. All state changes are logged, so they can be recorded as time dependent transformation sequence that may be replayed later as programmed interaction. 6 CONCLUSIONS The independence provided by the CORBA three-tier architecture, combined with the ubiquitous Java platform, and choosing Java3D or OpenGL as the 3D standard of choice greatly reduce the issue of platform incompatibility, allowing for scalability and efficiency. Since Java objects can communicate with other objects, avoids the bottlenecks of a client-server approach. Given that the State Universe does no rendering at all, it can keep track of more objects and behaviors. Each local Visual Universe does not compute behavior, so it can render more objects at higher frame rates, thus enhancing the perceived graphic performance. Synchronization among clients is maintained by a common clock in the State Universe. Collaboration and user direct manipulation cause a negligible performance penalty, since the parametric state changes form very small packets, and only when a multitude of clients are interacting is that potential network slowdowns may occur. However, this would be in excess of the usual classroom size. REFERENCES [Bajaj1999] Bajaj, C., and Cutchin, S.: Web based Collaborative Visualization of Distributed and Parallel Simulation. IEEE Symposium on Parallel Visualization and Graphics, pp. 47-54, (October 1999). [Beaudouin2000] Beaudouin-Lafon, M.: Instrumental interaction: an interaction model for designing postWIMP user interfaces. Proceedings of the CHI 2000 Conference, pp. 446 - 453. ACM Press (2000) [Brose2001] Brose, G., Duddy, K., and Vogel A.: Java Programming with CORBA, 3rd Edition, John Wiley & Sons, Inc. (2001) [Brown1999] Brown, K. and Petersen, D.: Ready to Run Java3D. New York, USA. Wiley Computer Publishing. (1999) [Curtis1997] Curtis, D.: Java, RMI and CORBA. Object Management Group (1997) [Horstmann1998] Cornell. Horstmann. Core Java 1. USA. Sun Microsystems Press. (1998). [DJ3D2001] Bulgaris, A., and Power, R.: DJ3D: Espacios Virtuales en un Motor 3D. Undergraduate Thesis, Universidad Metropolitana, Víctor Theoktisto, tutor (Caracas, March 2001) [Lewis1998] G. Lewis, S. Barber, and Siegel, E.: Programming with Java IDL. John Wiley & Sons, Inc. USA (1998) [ElSaddik2001] El Saddik, A., Fischer, S., & Steinmetz, R., Reusability and adaptability of interactive resources in Web-based educational systems. Journal of Educational Resources in Computing (JERIC), vol. 1, n. 1, ACM Press (2001) [Frecon1998] Frécon, E., Stenius, M.: DIVE: A scaleable network architecture for distributed virtual environments, Distributed Systems Engineering Journal, Special Issue on Distributed Virtual Environments, n. 5 pp. 91-100, (1998) http://www.sics.se/dive/ [Elvins1996] Elvins, T.: Volume Visualization in a Collaborative Computing Environment. Computers & Graphics, 20 (2), pp. 219-222, (March 1996) [Fellner1999] Fellner, D., and Hopp, A.: VR-LAB--a distributed multi-user environment for educational purposes and presentations. ACM SIGCOMM, vol. 29, n. 1, pp. 121-132, (February 1999) [Goethel2000] Goethel, S.: GL4Java Documentation. www.jausoft.com/gl4java. (2000). [OMG1999] Object Management Group. The Common Object Request Broker: Architecture and Specification, [CORBA 2.3], (1999) [Orfali1998] Orfali, R., and Harkey, D.: Client/Server Programming with Java and CORBA (2nd ed.) New York. Wiley Computer Publishing (1998) [PDVOL2002] Del Moral, D., Jiménez, L., Perricone, V., and Ye, Y.: PDVOL-Vision: Librerías de Visualización Geométrica y Volumétrica. Graduate Thesis, Universidad Simón Bolívar, Víctor Theoktisto, tutor, (Caracas, February 2002) [Raposo2001] Raposo, A., da Cruz, A., Adriano, C., Magalhães, L., Coordination Components for Collaborative Virtual Environments. Computers & Graphics, 25 (6), pp. 1025-1039, Pergamon Press, (December 2001) [Saar1999] Saar, Kurt: VIRTUS: a collaborative multiuser platform. ACM SIGCOMM, vol. 29, n. 1, pp. 141-152, (February 1999) [Wood1997] Wood, J., Wright, H., & Brodlie, Ken: Collaborative Visualization, IEEE Visualization '97, pp. 253-260, (November 1997) [Wright1997] Richard, S., Sweet, M., and Wright, J.: OpenGL SuperBible. (2nd ed.). USA. Waite Group Press (1997)