9 Introduction To Virtual Reality

Computer Graphics · Unit 9 · 2 hrs

Introduction to Virtual Reality

Exam-focused notes for Introduction to Virtual Reality (Computer Graphics, CSC214): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.

Introduction to Virtual Reality in short

Virtual reality applies everything covered so far, transformations, viewing, rendering and shading, to a scene that responds to the user in real time and is presented so convincingly that the user accepts it as an actual environment. This chapter introduces the concept, its components, and where it is applied.

Introduction to Virtual Reality: notes

Concept of Virtual reality

Virtual reality (VR) is the use of computer technology to create a simulated, three-dimensional environment that a user can perceive and interact with as if it were real, generated entirely by software rather than photographed from an existing place. Unlike a traditional graphical interface, where the user manipulates a picture displayed on a screen in front of them, VR places the user inside the generated world, simulating as many of the senses (chiefly vision and hearing, and increasingly touch) as the hardware allows, so that the user's own sense of "where I am" shifts into the virtual space. VR applications broadly split into two purposes: simulating a real environment, for training and education (flight simulators, surgical training), where the value lies in practising real procedures safely and cheaply, and constructing an imagined environment, for games or interactive stories, where the value lies in the experience itself.

Virtual reality systems are described by five components that together determine how convincing the experience is: dimensionality (the environment is modelled and rendered in three dimensions, not as a flat picture); motion or animation (objects and the viewpoint itself can move continuously through time); interaction (the user's actions have an effect on the virtual world, not just on a fixed viewpoint); viewpoint (the scene is rendered from the position and orientation of the user's own simulated eyes, updating as the user moves or turns); and immersion, achieved through enhanced multi-sensory experience, meaning the generation of images and sound that appear to fully surround the user rather than sit inside a bounded window.

VR offers real advantages: it creates a convincingly realistic simulated world, lets a user experiment safely with an artificial environment that would be costly or dangerous to try in reality, and is a more personal, embodied way to communicate or learn than text-based media such as email or instant messaging. It also has real limitations: the underlying technology, tracking, rendering and display hardware working together in real time, is complex; the equipment (head-mounted displays, motion tracking rigs) is expensive; and, unlike the real world, a user's own physical movement is constrained, typically to the size of a room or a stationary rig, which the software has to work around with techniques such as teleportation or virtual locomotion.

What this unit covers

  • Concept of Virtual reality
  • Virtual Reality Components of VR System, Types of VR System, 3D Position Trackers, Navigation and Manipulation Interfaces
  • Application of VR

Concept of Virtual reality

2080 · 5 marks

What is virtual reality? Explain some form of virtual reality. [5]

Virtual Reality (VR) is an artificial environment that is created with software and presented to the user in such a way that the user suspends belief and accepts it as a real environment. In other words, VR is the use of computer technology to create a simulated environment that feels realistic t...

Open this answer on its own page →

Application of VR

2078 · 10 marks

List some significance of virtual reality. Differentiate between virtual reality and augmented reality with example. Demonstrate how a polygon can be created using OpenGL.[10]

Show solved answer

Virtual Reality: Significance, VR vs AR, and Polygon Creation in OpenGL


1. Significance of Virtual Reality (4 marks)

Virtual Reality (VR) is an artificial environment created with software and presented to the user in such a way that the user suspends belief and accepts it as a real environment. It uses computer technology to create a simulated, interactive 3D environment.

The key significances of Virtual Reality are:

  1. Education and Training: VR provides a safe and controlled simulated environment for training purposes. Medical students can practice surgeries, pilots can practice flying, and soldiers can practice combat scenarios without real-world risk.

  2. Entertainment and Gaming: VR creates fully immersive gaming and entertainment experiences where users feel physically present inside the virtual world, greatly enhancing user experience.

  3. Healthcare and Therapy: VR is used in pain management, rehabilitation, treatment of phobias (exposure therapy), and post-traumatic stress disorder (PTSD) treatment by simulating controlled therapeutic environments.

  4. Architecture and Design: Architects and designers use VR to create virtual walkthroughs of buildings and structures before they are physically built, helping clients visualize the final product.

  5. Scientific Visualization: Scientists use VR to visualize complex data, molecular structures, astronomical phenomena, and simulations that are otherwise impossible to observe directly.

  6. Military and Defense: VR is used for battlefield simulations, vehicle operation training, and strategic planning without putting soldiers in actual danger.

  7. Natural Interaction: VR supports natural input devices such as joysticks, tracking balls, data gloves, and motion platforms, allowing users to interact with the virtual environment in an intuitive and immersive manner.


2. Difference Between Virtual Reality (VR) and Augmented Reality (AR) (3 marks)

Augmented Reality (AR) is the technology that expands our physical world by adding layers of digital information (such as sound, images, and text) on top of the real world we see.

BasisVirtual Reality (VR)Augmented Reality (AR)
DefinitionCreates an entirely virtual world using softwareA mix of the real world and the virtual world
Real WorldCompletely replaces the real world with a simulated environmentSuperimposes digital information on the real world
DistinctionIt is hard to differentiate between what is real and what is not realUsers can clearly distinguish between the real and virtual elements
Hardware UsedGenerally achieved by wearing a helmet or goggles having VR technologyAchieved by holding a smartphone or using AR glasses in front of us
Immersion LevelFully immersive; user is isolated from the real worldPartially immersive; user remains aware of the real world
TypesSingle type of fully simulated environmentMarkerless AR, Marker-based AR, Projection-based AR, Superimposition-based AR

Examples:

  • VR Example: A user wearing an Oculus Rift headset is completely immersed in a virtual game world such as a battlefield or a fantasy land. The user sees nothing of the real world.

  • AR Example: Using the smartphone app Pokemon Go, virtual Pokemon characters are superimposed on the real-world camera view. The user sees both the real street and the virtual Pokemon at the same time.


3. Creating a Polygon Using OpenGL (3 marks)

OpenGL (Open Graphics Library) is a general-purpose graphics programming package that contains graphics functions used with high-level programming languages like C, C++, Java, etc.

In OpenGL, a polygon can be created using the glBegin() and glEnd() functions along with glVertex2f() or glVertex3f() to specify the vertices of the polygon.

Key OpenGL Functions Used:

  • glBegin(GL_POLYGON) - Starts the definition of a polygon
  • glVertex2f(x, y) - Specifies a 2D vertex of the polygon
  • glEnd() - Ends the definition of the polygon
  • glColor3f(r, g, b) - Sets the drawing color
  • glClear(GL_COLOR_BUFFER_BIT) - Clears the screen
  • glFlush() - Forces execution of OpenGL commands

Complete Program to Draw a Triangle (3-sided Polygon):

#include <GL/glut.h>

void display() {
    // Clear the screen with background color
    glClear(GL_COLOR_BUFFER_BIT);

    // Set the drawing color to red (R=1, G=0, B=0)
    glColor3f(1.0, 0.0, 0.0);

    // Begin drawing a polygon (triangle)
    glBegin(GL_POLYGON);
        glVertex2f(0.0, 0.5);    // Top vertex
        glVertex2f(-0.5, -0.5);  // Bottom-left vertex
        glVertex2f(0.5, -0.5);   // Bottom-right vertex
    glEnd();

    // Flush the drawing to the screen
    glFlush();
}

int main(int argc, char** argv) {
    // Initialize GLUT
    glutInit(&argc, argv);

    // Set display mode
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

    // Set window size
    glutInitWindowSize(500, 500);

    // Set window position
    glutInitWindowPosition(100, 100);

    // Create the window with a title
    glutCreateWindow("Polygon using OpenGL");

    // Set background color to white
    glClearColor(1.0, 1.0, 1.0, 0.0);

    // Register display callback function
    glutDisplayFunc(display);

    // Enter the GLUT event loop
    glutMainLoop();

    return 0;
}

Explanation of Steps:

StepFunctionPurpose
1glutInit()Initializes the GLUT library
2glutInitDisplayMode()Sets single buffer and RGB color mode
3glutInitWindowSize()Sets the width and height of the display window
4glutInitWindowPosition()Fixes the position of the window on the screen
5glutCreateWindow()Creates the window and gives it a title
6glClearColor()Sets the background colour of the window
7glutDisplayFunc()Registers the callback function that draws the scene
8glutMainLoop()Enters the event loop so the window stays on screen

Running this program draws a solid red triangle on a white background, which is the simplest polygon OpenGL can render. Adding further glVertex2f() calls between glBegin(GL_POLYGON) and glEnd() produces a polygon with as many sides as vertices supplied, and the vertices must be given in order around the boundary so that the polygon stays simple and convex.

Open this answer on its own page →

2075 · 5 marks

List some applications of VR. What might be the possible navigation techniques and manipulating interfaces in virtual reality? Justify. [5]

Virtual Reality creates an entirely immersive virtual world where it becomes hard to differentiate between what is real and what is not real (typically achieved by wearing a helmet or goggles with VR technology). Its major applications include: 1. Education and Training - Medical students can pra...

Open this answer on its own page →

Virtual Reality Components of VR System, Types of VR System, 3D Position Trackers, Navigation and Manipulation Interfaces

2077 · 5 marks

How virtual realities differ with our real world? Describe some components of VR system. [5]

Virtual Reality is an artificial environment created with software and presented to the user in such a way that the user suspends belief and accepts it as a real environment. It is the use of computer technology to create a simulated, interactive environment. --- Aspect Virtual Reality Real World...

Open this answer on its own page →