Title: Development of Simulation and
1Development of Simulation and Virtual
Reality CM30008-2
School of Computing Staffordshire University
Introduction to Development of Simulation and
Virtual Reality
Bob Hobbs
2Outline
- Module Details
- What is VR programming?
- Typical Processing Steps
- Modelling and Rendering
- Applications
- Summary
3Module Details
- Teaching Team
- Bob Hobbs r.g.hobbs_at_staffs.ac.uk
- Dr. Len Noriega l.a.noriega_at_staffs.ac.uk
- Sam Wane s.o.wane_at_staffs.ac.uk
- 2 Semesters 20 cats
- 2 Hours per week
- Semester 1 SoC
- Semester 2 SEAT
4Module Details
- Course Handbook Lecture Notes
- http//www.soc.staffs.ac.uk/cmtrgh
- Assignment Details
- 25 Assignment 1 - practical
- 25 Assignment 2 Report
- 50 Exam
5Hierarchy of Models
Behaviour
Bio-Mechanics
Physics
Geometry
6How does this work ?
- Simulation Loop
- read input sensors
- update objects
- render scene in display
- Uses traditional 3D graphics methods to render or
draw the scene
7Simulation Loop
Read Sensors
Check any defined actions
Update objects with sensor input
Objects perform tasks
Step along any defined paths
Render universe
8Introducing OpenGL
- Graphics basics
- Transform geometry (object ?world, world ?eye)
- Apply perspective projection (eye ?screen)
- Clip to the view frustum
- Perform visible-surface processing (Z-buffer)
- Calculate surface lighting etc.
- Implementing all this is a lot of work (surprise)
- OpenGL provides a standard implementation
- So why study the basics?
9OpenGL Design Goals
- SGIs design goals for OpenGL
- Hardware independence without sacrificing
performance - Natural, concise API with some built-in
extensibility - OpenGL has become a standard because
- It doesnt try to do too much
- Only renders the image, doesnt manage windows,
etc. - No high-level animation, modeling, sound (!),
etc. - It does enough
- Useful rendering effects high performance
- It is promoted by SGI ( Microsoft,
half-heartedly)
10OpenGL Conventions
- Functions in OpenGL start with gl
- Functions starting with glu are utility functions
(i.e., gluLookAt()) - Functions starting with glx are for interfacing
with the X Windows system (i.e., in gfx.c) - Function names indicate argument type/
- Functions ending with f take floats
- Functions ending with i take ints, functions that
end with v take an array, with b take byte, etc. - Ex glColor3f() takes 3 floats, but glColor4fv()
takes an array of 4 floats
11OpenGL Specifying Geometry
- Geometry in OpenGL consists of a list of vertices
in between calls to glBegin() and glEnd() - A simple example telling GL to render a triangle
- glBegin(GL_POLYGON)
- glVertex3f(x1, y1, z1)
- glVertex3f(x2, y2, z2)
- glVertex3f(x3, y3, z3)
- glEnd()
- Usage glBegin(geomtype) where geomtype is
- Points, lines, polygons, triangles,
quadrilaterals, etc...
12What is 3D rendering?
Generally deals with graphical display of 3D
objects as seen by viewer
13What is 3D Computer Graphics?
- 3D graphics generation of graphical display
(rendering) of 3D object(s) from specification
(model(s))
Modelling
14Typical Processing Steps
Wireframe polygonal model
Solid object
15Typical Processing Steps
Modelling numerical description of scene
objects, illumination, and viewer
Rendering operations that produce view of scene
projected onto view surface
16Modelling
1438 facets
Human Head Model
17Modelling
7258 facets
Human Head Model
18Modelling
2074 facets
Teacher and Board Model
19Rendering
1438 facets
Shaded Human Head
20Rendering
7258 facets
Shaded Human Head
21Rendering
Shaded Teacher and Board
22Scene Graphs
- In VR programming the structure used is a scene
graph which is special tree structure designed to
store information about a scene. - Typical elements include
- geometries
- positional information
- lights
- fog
23Simple scene graph
Root node
Fog node
Light node
Group node
Geom node
Xform node
24Scene Graph Nodes
- Content Nodes
- contain basic elements of a scene
- geometry
- light
- position
- fog
- Group Nodes
- no content
- link the hierarchy
- allow grouping of nodes sharing a common state
Parent
Child 1
Child 2
25Example Hierarchy
Group Lampost
26Applications
- VR programming is used in many applications, e.g.
- Entertainment (computer games, movie special
effects, ...) - Human computer interaction (GUI, ...)
- Science, education, medicine (visualisation )
- Business (marketing, ...)
- Art
27Summary
- Simulation consists of a series of scenes
- Objects defined as Scenes in a scene graph which
may be one object or a related collection of
objects - Each iteration of the simulation loop determines
actions, translations(along paths) and other
inputs which affect properties of the objects - NOT animation !!!
- The world is redrawn using rendering process