The XVR project – Rapid development of VR applications Franco Tecchia PERCRO Scuola Superiore S.Anna (ex-UCL)
Background / Recap 03/26/07
What is a “state” for a VR application? • In theory: a collection of information about the virtual world In theory: a collection of information about the virtual world • • In practice: a collection of data structures and variables In practice: a collection of data structures and variables • 3D 3D Forces Forces meshes meshes Speed Speed Positions VR World Positions “state” Accelerations Accelerations Orientations Orientations 03/26/07 3
The state evolves over time… The computer simulation makes the state evolving, The computer simulation makes the state evolving, advancing in a discrete sequence of steps advancing in a discrete sequence of steps … … t 0 t 1 t 2 t 3 Fundamental question: how frequently should the : how frequently should the Fundamental question state get updated? state get updated? Depends on the tasks performed! Depends on the tasks performed! 03/26/07 4
The simplest VR architecture: a 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 03/26/07 5
But things are really not that simple Trying to use a single loop to manage everything is bad Trying to use a single loop to manage everything is bad practice practice • Some activities need to be performed at different rates Some activities need to be performed at different rates • • Easy to get stuck. Adding features can be a nightmare Easy to get stuck. Adding features can be a nightmare • An overall idea of what could be involved helps making An overall idea of what could be involved helps making the right design choices the right design choices 03/26/07 6
The visualisation loop The state of a VR simulation need to be displayed (on a The state of a VR simulation need to be displayed (on a monitor, HMD, CAVE, etc) monitor, HMD, CAVE, etc) ~ 60 Hz State(t) Update frequency = monitor refresh Update frequency = monitor refresh rate is all we need, anything more rate is all we need, anything more would be wasted would be wasted 03/26/07 7
The Visualisation loop Real- -time computer graphics: the mother of all the VR time computer graphics: the mother of all the VR Real tasks! tasks! Sutherland, Ivan E., 1968 " A Head-Mounted Three Dimensional Display " • VR applications and systems are very often built about the VR applications and systems are very often built about the • rendering framework. rendering framework. • Beware: Beware: this can be very limiting in the long run! this can be very limiting in the long run! • 03/26/07 8
The collision detection loop Checking if moving objects collide with each other Checking if moving objects collide with each other Depends on State(t) objects speed If collision checking rate is not “fast If collision checking rate is not “fast enough”, some collision could occur enough”, some collision could occur undetected undetected 03/26/07 9
Collision detection It used to be a “big thing” in VR. It used to be a “big thing” in VR. • Algorithms are almost optimal Algorithms are almost optimal – – very very • mature research field mature research field • There is little point in collision detection • There is little point in collision detection without physic simulation without physic simulation • Revived a bit lately: GPU • Revived a bit lately: GPU- -based collision based collision detection detection • RAPID RAPID • • I I- -Collide Collide • • V V- -Collide Collide • Same names: Same names: • OPCODE OPCODE • • QuickCD QuickCD • • … … • 03/26/07 10
The physical simulation loop Objects responds to physical laws and interact Objects responds to physical laws and interact >= 100 Hz State(t) Update frequency need to be at Update frequency need to be at least the same as display rate, but least the same as display rate, but stability issues often require much stability issues often require much higher speeds higher speeds 03/26/07 11
Real-time physics Simulating the effects of objects interaction Simulating the effects of objects interaction • A proper VR world needs A proper VR world needs • physical laws physical laws • Objects should react to stimulus Objects should react to stimulus • (gravity, external forces, (gravity, external forces, collisions) collisions) •• Improved realism Improved realism • Using scripted behaviour Using scripted behaviour • becomes a daunting task when becomes a daunting task when scenario gets complex scenario gets complex 03/26/07 12
Real-time physics in practice (I) • A world is a collection of bodies • Bodies from different worlds never interact • Each rigid body has: • a mass (and moment of inertia) � needed for motion calculation � obtainable by composing elementary solids • a shape or “geometry” � needed for collision detection � obtainable by composing elementary solids Note: we are considering rigid we are considering rigid- -bodies physics bodies physics Note: 03/26/07 13
Real-time physics in practice (II) • Physics materials are used to describe surface properties of objects var material = sim.getMaterial(idx); material.restitution = 0.1; material.staticFriction = 0.8; material.dynamicFriction = 0.5; material.apply(); 03/26/07 14
Real-time physics in practice (III) •• Simple objects are connected Simple objects are connected using a collection of physical using a collection of physical joints joints • Many types of joints are Many types of joints are • available available •Sometimes joints can be Sometimes joints can be • broken broken 03/26/07 15
Real-time physics in practice (IV) The physics loop: The physics loop: 1 2 3 1) Apply all the external forces to the objects Apply all the external forces to the objects 1) 2) Ask the Physics engine to compute the evolution of Ask the Physics engine to compute the evolution of 2) the scene during a certain time interval the scene during a certain time interval 3) Get the results back Get the results back 3) • Update the scene- -graph graph • Update the scene • Control some external device • Control some external device Warning: This must be frequent to avoid instability (>=60Hz) This must be frequent to avoid instability (>=60Hz) Warning: 03/26/07 16
Haptics Making the user touch the virtual world Making the user touch the virtual world 03/26/07 17
The haptic interaction loop Haptic interaction: the user interact with the environment Haptic interaction: the user interact with the environment and experience force feedback and experience force feedback >500 Hz State(t) Haptic refresh rate is much higher Haptic refresh rate is much higher that graphics refresh rate! that graphics refresh rate! 03/26/07 18
Haptics Very simple development paradigm: Very simple development paradigm: Force Force Position Position (fx,fy,fz) (fx,fy,fz) (x,y,z) (x,y,z) 1 2 3 1) Read the haptic current position Read the haptic current position 1) 2) Depending on the position compute a force Depending on the position compute a force 2) 3) Ask the haptic to generate that force Ask the haptic to generate that force 3) The problem is doing this at >=500 Hz! The problem is doing this at >=500 Hz! 03/26/07 19
The network communication loop “No man is an island”: communication between remote No man is an island”: communication between remote “ VR nodes can be very important VR nodes can be very important Depends on State(t) the task Update frequency depends on the Update frequency depends on the type of communication: graphical type of communication: graphical only, interaction, with haptics or not, only, interaction, with haptics or not, etc… etc… 03/26/07 20
Conclusions: loops are everywhere! ~10Hz >1kHz ~ 60 Hz 100-200 Hz ~30Hz 03/26/07 21
Events: not everything is a loop 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 03/26/07 22
A better general overview ~10Hz >1kHz ~ 60 Hz 100-200 Hz ~30Hz ~10Hz ~ 60 Hz >1kHz 100-200 Hz ~30Hz ~10Hz >1kHz ~ 60 Hz 100-200 Hz ~30Hz 03/26/07 23
So, let’s recap… • VR applications are a collection of interconnected, time VR applications are a collection of interconnected, time- - • critical and high performance task critical and high performance task • Both loops and events are important! Both loops and events are important! • • Integration can be difficult because of shared data Integration can be difficult because of shared data • • A global overview of the problem helps developing (or A global overview of the problem helps developing (or • choosing) the right framework choosing) the right framework 03/26/07 24
XVR 03/26/07
Recommend
More recommend