3d visualisation of simulation data

20
3D Visualisation of 3D Visualisation of Simulation Data. Simulation Data. Informal Seminar 08/03/2004. By Chris Sweet.

Upload: macy

Post on 25-Feb-2016

58 views

Category:

Documents


5 download

DESCRIPTION

Informal Seminar 08/03/2004. By Chris Sweet. 3D Visualisation of Simulation Data. Why Visualise?. More meaningful than lists of numbers. People have good visual intuition of dynamics. Visual check that simulation is correct. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 3D Visualisation of Simulation Data

3D Visualisation of Simulation Data.3D Visualisation of Simulation Data.Informal Seminar 08/03/2004.

By Chris Sweet.

Page 2: 3D Visualisation of Simulation Data

Why Visualise?Why Visualise?

More meaningful than lists of numbers.More meaningful than lists of numbers. People have good visual intuition of People have good visual intuition of

dynamics.dynamics. Visual check that simulation is correct.Visual check that simulation is correct. Easier to communicate interesting features Easier to communicate interesting features

of the simulation to others.of the simulation to others.

Page 3: 3D Visualisation of Simulation Data

Methods for 3D Output.Methods for 3D Output.

Projection of 3D image onto 2D plane.Projection of 3D image onto 2D plane.

3D libraries such as OpenGL or DirectX.3D libraries such as OpenGL or DirectX.

Page 4: 3D Visualisation of Simulation Data

Projection of 3D onto 2DProjection of 3D onto 2D This can be accomplished by using a matrix to project the This can be accomplished by using a matrix to project the

3D data onto a 2D plane, which can be varied to change 3D data onto a 2D plane, which can be varied to change the viewpoint.the viewpoint.

For a viewing plane defined as follows we get a For a viewing plane defined as follows we get a transformation matrix:transformation matrix:

Page 5: 3D Visualisation of Simulation Data

Example of 2D rendering of objects in 3D.Example of 2D rendering of objects in 3D.Projection of 3D onto 2DProjection of 3D onto 2D

Page 6: 3D Visualisation of Simulation Data

Example of 3D surface rendering.Example of 3D surface rendering.

Projection of 3D onto 2DProjection of 3D onto 2D

Page 7: 3D Visualisation of Simulation Data

Advantages/Disadvantages of 3D Advantages/Disadvantages of 3D ProjectionProjection

+Easy to implement on any platform with +Easy to implement on any platform with raster graphics.raster graphics.

-Objects drawn as 2D.-Objects drawn as 2D. -Hard to determine depth from viewer, -Hard to determine depth from viewer,

(front objects do not obscure rear objects).(front objects do not obscure rear objects). -Hard to implement perspective.-Hard to implement perspective. -Hard to apply textures.-Hard to apply textures. -Slow as pixel driven.-Slow as pixel driven.

Page 8: 3D Visualisation of Simulation Data

Advantages/Disadvantages of 3D Advantages/Disadvantages of 3D LibrariesLibraries

-Hard initial implementation.-Hard initial implementation. +All methods of depth/ perspective/ texturing +All methods of depth/ perspective/ texturing

looked after.looked after. +Hardware support for drawing so fast.+Hardware support for drawing so fast. +Libraries exist for many different platforms.+Libraries exist for many different platforms.

Comparison: 3D projection of Solar System.Comparison: 3D projection of Solar System. 3D library rendering of Solar System.3D library rendering of Solar System.

Page 9: 3D Visualisation of Simulation Data

Advantages/Disadvantages of 3D Advantages/Disadvantages of 3D LibrariesLibraries

Comparison: 3D projection of Solar System.Comparison: 3D projection of Solar System.

Page 10: 3D Visualisation of Simulation Data

Advantages/Disadvantages of 3D Advantages/Disadvantages of 3D LibrariesLibraries

3D library rendering of Solar System.3D library rendering of Solar System.

Page 11: 3D Visualisation of Simulation Data

OpenGLOpenGL OpenGL is a cross-platform 3D graphics OpenGL is a cross-platform 3D graphics

and modelling library with extremely good and modelling library with extremely good hardware support.hardware support.

OpenGL is a procedural graphics API OpenGL is a procedural graphics API containing over 200 commands and containing over 200 commands and functions.functions.

OpenGL works in conjunction with other OpenGL works in conjunction with other libraries, such as GLUT, for easier libraries, such as GLUT, for easier implementation.implementation.

Page 12: 3D Visualisation of Simulation Data

OpenGL basics, Vertex OpenGL basics, Vertex TransformationTransformation

Vertices are transformed according to the Vertices are transformed according to the following pipeline:following pipeline:

Page 13: 3D Visualisation of Simulation Data

OpenGL basics, Initialisation.OpenGL basics, Initialisation. Typical C++ initialisation commands:Typical C++ initialisation commands:

Typical C++ re-draw commands:Typical C++ re-draw commands:

Page 14: 3D Visualisation of Simulation Data

OpenGL View/PerspectiveOpenGL View/Perspective

The viewing Frustum parameters are set The viewing Frustum parameters are set using the command:using the command:

According to the diagram:According to the diagram:

Page 15: 3D Visualisation of Simulation Data

OpenGL Drawing ObjectsOpenGL Drawing Objects All OpenGL objects are constructed from All OpenGL objects are constructed from

polygons by defining the vertices:polygons by defining the vertices:

or by using GLUT more complex shapes:or by using GLUT more complex shapes:

Page 16: 3D Visualisation of Simulation Data

OpenGL LightingOpenGL Lighting Both ambient and point source lighting can Both ambient and point source lighting can

be defined:be defined:

Page 17: 3D Visualisation of Simulation Data

OpenGL TexturesOpenGL Textures Textures can be mapped onto objects Textures can be mapped onto objects

according to their vertex positions:according to their vertex positions:

Page 18: 3D Visualisation of Simulation Data

OpenGL Translate/Rotate ObjectOpenGL Translate/Rotate Object OpenGL objects can and rotated:OpenGL objects can and rotated:

be translated:be translated:

Page 19: 3D Visualisation of Simulation Data

OpenGL Solar System ModelOpenGL Solar System Model The Solar System The Solar System

model is a 10 body model is a 10 body model designed to model designed to test the long term test the long term stability of different stability of different integrators and uses integrators and uses the previous OpenGL the previous OpenGL techniques to techniques to generate the generate the graphics.graphics.

Page 20: 3D Visualisation of Simulation Data

References/AcknowledgmentsReferences/Acknowledgments

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

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