Introduction to the XVR technology: the basic framework Franco Tecchia franco@sssup.it
Why you should NOT use XVR • It only works under Windowz It only works under Windowz • The kernel of XVR is closed source The kernel of XVR is closed source • Being developed around a scripting language, XVR is Being developed around a scripting language, XVR is much slower than C++ for hard-core tasks (array sorting) much slower than C++ for hard-core tasks (array sorting) • If you are writing some special module and need hard-core If you are writing some special module and need hard-core access to the Win32API you need C/C++ access to the Win32API you need C/C++ XVR has (yet) very poor debugging tools compared to C++ XVR has (yet) very poor debugging tools compared to C++ • • Documentation is still weak Documentation is still weak • You are in love with C no matter what You are in love with C no matter what 06/20/06 2
Why you should try XVR • It’s free It’s free • It drastically and consistently reduce development time of It drastically and consistently reduce development time of an application an application • It lower the cultural barrier usually associated to develop It lower the cultural barrier usually associated to develop VR applications. VR applications. • It’s self-sufficient, very simple to install, very simple to use It’s self-sufficient, very simple to install, very simple to use It’s a good common platform to work in teams It’s a good common platform to work in teams • • You can show your applications on the web You can show your applications on the web • Your students will love it Your students will love it 06/20/06 3
Please note: there are alternatives VirTools (Dassault Systems) Quest 3D (Act – 3D) •VirTools (Dassault Systems) Quest 3D (Act – 3D) • • 06/20/06 4
XVR: An IDE for VR applications 06/20/06 5
XVR Architecture HI- Audio – Video Performance Library Real-Time Virtual Machine Scene-Graph Bytecode execution (Multi-Threaded) VR Real- Device Time Handling Physics Network Network Renderer Manager 06/20/06 6
XVR Workflow Dedicated scripting Output language Binary ByteCode Interpreter Compiler (Virtual Machine) 06/20/06 7
What does XVR provide • A complete and very fast 3D Scene Graph Manager A complete and very fast 3D Scene Graph Manager • Low level OpenGL wrapping for added flexibility Low level OpenGL wrapping for added flexibility Vertex and pixel-shaders (OpenGL2.0 GLSL) Vertex and pixel-shaders (OpenGL2.0 GLSL) • • Basic GDI and 2D GUI functions (menus, text) Basic GDI and 2D GUI functions (menus, text) • Sound management: MIDI, MP3, 3D Positional Sound Sound management: MIDI, MP3, 3D Positional Sound • Collision detection & Real-time Physics Collision detection & Real-time Physics • Haptic devices control Haptic devices control Network data management Network data management • • Basic streaming support Basic streaming support • Support for advanced devices: Trackers, Stereo Support for advanced devices: Trackers, Stereo projection, HMDs, Haptic Interfaces, CAVE projection, HMDs, Haptic Interfaces, CAVE 06/20/06 8
Why: from demos to complex applications • Demos as single-minded applications Demos as single-minded applications • Very limited interaction Very limited interaction • Problems can be ignored or postponed Problems can be ignored or postponed • Most of the work to pass from concept Most of the work to pass from concept demo to application stage demo to application stage • We learn from our work and our students We learn from our work and our students Features VS. Complexity Features VS. Complexity Linear increase Exponential grow Linear increase Exponential grow 06/20/06 9
The simplest architecture: the single loop One loop to manage everything: One loop to manage everything: - Graphic Rendering Graphic Rendering - User Input User Input ~ 60 Hz - Animation Animation - Collision detection Collision detection - Physical simulation Physical simulation Refresh rate is usually the upper bound Refresh rate is usually the upper bound Collision and physics can give troubles Collision and physics can give troubles 06/20/06 10
Second option: separate rendering from the rest - Animation independent from frame rate - Animation independent from frame rate - No more missed collisions! - No more missed collisions! 100-200 Hz ~ 60 Hz - Variables need to be shared between processes - Variables need to be shared between processes - Atomicity should be carefully addresses Atomicity should be carefully addresses - Two threads, one rendering context? Two threads, one rendering context? 06/20/06 11
Third step: Haptic Devices get into the picture - The Haptic Loop is *very* fast - The Haptic Loop is *very* fast - More representations for the same objects - More representations for the same objects >1kHz ~ 60 Hz 100-200 Hz - Problem: How does Haptics influence Physics? - Problem: How does Haptics influence Physics? 06/20/06 12
Going further: loops are everywhere - Network lag and dead reckoning - Network lag and dead reckoning ~10Hz >1kHz ~ 60 Hz 100-200 Hz ~30Hz - Can’t you poll for your - Can’t you poll for your tracking? tracking? 06/20/06 13
Events: loops can’t solve everything VR_EVENT_2 VR_EVENT_2 VR_EVENT_1 VR_EVENT_1 VR_EVENT_4 VR_EVENT_4 VR_EVENT_3 VR_EVENT_3 ~30Hz 06/20/06 14
The XVR approach: simple but not too simple 3 Main Call-backs 3 Main Call-backs OnTimer() OnFrame() OnTimer() OnFrame() ~ 60 Hz 100-1000 Hz All variables are shared shared All variables are VR_EVENT_1 VR_EVENT_1 VR_EVENT_2 VR_EVENT_2 OnEvent() OnEvent() VR_EVENT_3 VR_EVENT_3 VR_EVENT_4 VR_EVENT_4 06/20/06 15
Why is XVR useful in VR development • It’s a complete programming environment It’s a complete programming environment • A good implementation of what we need in our daily work A good implementation of what we need in our daily work • One single programming language (and it’s VR-oriented) One single programming language (and it’s VR-oriented) • Automatic handling of the infrastructure stuff Automatic handling of the infrastructure stuff Plenty of built-in advanced function (Including GLSL Plenty of built-in advanced function (Including GLSL • support) and low-level OpenGL support for Graphics support) and low-level OpenGL support for Graphics Hackers Hackers • It’s extendable: If you have special need, you can easily It’s extendable: If you have special need, you can easily load and use external DLLs load and use external DLLs 06/20/06 16
The Language 06/20/06 17
The XVR scripting language (.S3D) •It’s the fundamental glue that It’s the fundamental glue that keeps everything together keeps everything together • Similar syntax to JAVA and Similar syntax to JAVA and BASIC BASIC • Byte code – virtual machine Byte code – virtual machine model model Type less Type less • • Object oriented Object oriented 06/20/06 18
Does it have an impact on performances? • No scripting language is as fast as C or C++ No scripting language is as fast as C or C++ • XVR uses bytecode generation/execution –speed similar to XVR uses bytecode generation/execution –speed similar to JAVA JAVA A script-only function (es Quicksort) is about 20 times A script-only function (es Quicksort) is about 20 times • slower than a C++ equivalent slower than a C++ equivalent • Most of CPU/GPU workload outside the scripting language Most of CPU/GPU workload outside the scripting language anyway anyway • In practical application we experimented very small to no In practical application we experimented very small to no impact impact • A detailed overview of the virtual machine later A detailed overview of the virtual machine later 06/20/06 19
But there are advantages • Simplified syntax: script constructs tailored on VR needs Simplified syntax: script constructs tailored on VR needs • Light, self sufficient development environment -> easy to Light, self sufficient development environment -> easy to set-up set-up Not much framework jargon: straight to the business Not much framework jargon: straight to the business • • VERY fast compilation time (almost 0) VERY fast compilation time (almost 0) • Compact bytecode, web - enabled Compact bytecode, web - enabled • Dominant technologies are doing the same: see VirTools Dominant technologies are doing the same: see VirTools 06/20/06 20
S3D Statements IF..ELSE WHILE DO..WHILE FOR BREAK CONTINUE SWITCH..CASE SET SCENE_FOV Field of view SCENE_NEAR Near clipping plane distance SCENE_FAR Far clipping plane distance AUDIO_MODE 3d Audio Setup mode 06/20/06 21
Recommend
More recommend