Notes
Slide Show
Outline
1
3D Visualisation of Simulation Data.
2
Why Visualise?
  • More meaningful than lists of numbers.
  • People have good visual intuition of dynamics.
  • Visual check that simulation is correct.
  • Easier to communicate interesting features of the simulation to others.
3
Methods for 3D Output.

  • Projection of 3D image onto 2D plane.


  • 3D libraries such as OpenGL or DirectX.
4
Projection of 3D onto 2D
  • This can be accomplished by using a matrix to project the 3D data onto a 2D plane, which can be varied to change the viewpoint.
  • For a viewing plane defined as follows we get a transformation matrix:
5
Advantages/Disadvantages of 3D Projection
  • +Easy to implement on any platform with raster graphics.
  • -Objects drawn as 2D.
  • -Hard to determine depth from viewer, (front objects do not obscure rear objects).
  • -Hard to implement perspective.
  • -Hard to apply textures.
  • -Slow as pixel driven.


6
Advantages/Disadvantages of 3D Libraries
  • -Hard initial implementation.
  • +All methods of depth/ perspective/ texturing looked after.
  • +Hardware support for drawing so fast.
  • +Libraries exist for many different platforms.
7
OpenGL
  • OpenGL is a cross-platform 3D graphics and modelling library with extremely good hardware support.
  • OpenGL is a procedural graphics API containing over 200 commands and functions.
  • OpenGL works in conjunction with other libraries, such as GLUT, for easier implementation.
8
OpenGL basics, Vertex Transformation
  • Vertices are transformed according to the following pipeline:
9
OpenGL basics, Initialisation.
  • Typical C++ initialisation commands:





  • Typical C++ re-draw commands:


10
OpenGL View/Perspective
  • The viewing Frustum parameters are set using the command:


  • According to the diagram:


11
OpenGL Drawing Objects
  • All OpenGL objects are constructed from polygons by defining the vertices:





  • or by using GLUT more complex shapes:


  • Example of unlit sphere.


12
OpenGL Lighting
  • Both ambient and point source lighting can be defined:




  • Example of lit sphere.
13
OpenGL Textures
  • Textures can be mapped onto objects according to their vertex positions:







  • Example of textured sphere.
14
OpenGL Translate/Rotate Object
  • OpenGL objects can be translated:



  • and rotated:
15
OpenGL Solar System Model
  • The Solar System model is a 10 body model designed to test the long term stability of different integrators and uses the previous OpenGL techniques to generate the graphics.


16
References/Acknowledgments
  • The following book provides a good reference to OpenGL with examples in C/C++: OpenGL SuperBible by R.S.Wright, M.Sweet (No relation!).


  • The following online tutorial covers most aspects of OpenGL programming: http://nehe.gamedev.net/