3D Scientific Visualization Using OPENGL And The Dividing-cubes Method : 3D Scientific Visualization Using OPENGL And The Dividing-cubes Method Shangli Ou
March 5, 2004
Acknowledgements : Acknowledgements I would like to thank the following LSU professors for their help, encouragement and patience during the course of this work.
John M. Tyler, Joel E. Tohline,
Bijaya Karki , Aiichiro Nakano,
Rajiv Kalia, Jianhua Chen
I would also thank my family, especially my wife for their consistent support and understanding.
Outlines : Outlines Background of scientific visualization and this work
Introduction to OPENGL
Original iso-surfacing method and its result
The dividing-cubes method and its result
Conclusions
Background: Scientific Computing : Background: Scientific Computing From a traditional astronomer to a modern computational astrophysicist
LSU’s Wonderful Opportunity : LSU’s Wonderful Opportunity Physicist Computational
Physicist Computer
Scientist
System Science Project : System Science Project This project is part of the requirements of the Master degree in System Science.
Specialize on 3D visualization.
Use OPENGL and two iso-surfacing techniques to visualize our data from astrophysical simulations.
Visualization & Computational Science : Visualization & Computational Science 3D Visualization helps scientists to diagnose and better understand the result of scientific computation.
Challenging Task: Create Movie!!! : Challenging Task: Create Movie!!! 3D simulation requires large scale parallel computing and generates huge amount of data (several hundred GBs per simulation).
Use iso-surfacing techniques to find the iso-surfaces from the 3D density files:
Marching-Cubes and Dividing-Cubes
Use OPENGL to render movies.
A brief introduction to OPENGL : A brief introduction to OPENGL OPENGL (Open Graphic Library) is an industry foundation for high-performance graphics. It is free and can be downloaded from http://www.opengl.org
OPENGL provides users with a set of powerful library functions that can generate 2D and 3D primitives, lighting conditions, etc.
We use glut library, easily portable.
Some Important Functions in OPENGL : Some Important Functions in OPENGL glutInit(&argc, argv);
glutInitDisplayMode(..);
glutInitWindowSize(x, y);
glutCreateWindow(“Hello world!”);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(evolve);
glutMainLoop();
Astrophysical simulations: dynamical bar-mode instability in astrophysical fluid system (Tohline, Ou & Cazes) : Astrophysical simulations: dynamical bar-mode instability in astrophysical fluid system (Tohline, Ou & Cazes) Top View: Side View: High rotation Spheroid (pinecake) Ellipsoid (football)
Physical Equations for a fluid system : Physical Equations for a fluid system
Original iso-surfacing technique: : Original iso-surfacing technique: We use a cylindrical grid with a resolution of 130*130*128 in radial, vertical and azimuthal directions respectively.
The computation is done on LSU Casper and Blue Horizon in San Diego Supercomputing Center.
The object of interest can be thought of a football tumbling around its shortest axis.
Original iso-surfacing technique: make use of the special configuration of the system : Original iso-surfacing technique: make use of the special configuration of the system Shown is one horizontal slice of the 3D density array.
We start from the center of the grid, proceed along any radial direction as shown by the red arrow, we are guaranteed to intersect its surface at some point.
We can get a set of such points by looping over the azimuthal direction
Slide15 : Vertex order for the GL_TRIANGLE_STRIP option. For simplicity only part of two sets of vertices belonging to two neighboring horizontal slices is shown.
Slide16 : Treatment of the top of the iso-surface. The upper slice has no vertex, the lower slice has a set of vertices, we use GL_TRIANGLE_FAN to connect point O, the center of the upper slice, to every two neighboring vertices in the lower slice to form a cap of the iso-surface.
Original Method: animation & code : Original Method: animation & code OPENGL also provides a gluLookAt() function, which can change the instantaneous view point, thus it enables a fly through animation of the rendered object.
The original code is written in C language and compiled on a SGI octane machine with 300 MHz CPU. After development, we then port it to a Windows PC.
Results of the original method: top view of the initial spheroidal state : Results of the original method: top view of the initial spheroidal state Axis-symmetric structure
Z-axis points out
The corresponding density level is 0.3.
Results of the original method: side view of the initial spheroid state : Results of the original method: side view of the initial spheroid state Oblate when viewed from side.
Z-axis points to the left.
The corresponding density level is 0.3.
Results of the original method: the final bar configuration : Results of the original method: the final bar configuration 3D image of the rotating bar
some unphysical polygons appear.
The corresponding density level is 0.3.
Drawbacks of the original method : Drawbacks of the original method This method only works if the iso-surface behaves smoothly,
Spurious polygons appear when the surface becomes irregular
The Dividing-Cubes method : The Dividing-Cubes method The essence of this method is to divide each cube into small cubes as possible, when the cubes are small enough, we assume that the iso-surface crosses the cube at the middle point of its two neighboring vertices and one of them has a larger density value than the desired level yet the other one has a smaller value.
We use a cluster of such points to replace the iso-surface. As long as these points are dense enough, they describe the shape of the surface very accurately.
Illustration of 2D Dividing-Cubes method : Illustration of 2D Dividing-Cubes method The coarser grid is divided into finer grids, linear interpolation is used to get the density values on the finer grids.
The iso-line can be replaced by a series of points where the iso-line intersects the finer grids.
The Dividing-Cubes Method: division : The Dividing-Cubes Method: division In use, because our 3D density array already has a very large resolution of 130*130*128, we chose to divide each cube into 8 small cubes (2x2x2 in three directions) in consideration of storage space and memory
Results of the Dividing-Cubes method : Results of the Dividing-Cubes method We successfully removed the artifacts.
The shock waves can be seen very clearly.
The corresponding density level is 0.3.
Results of the Dividing-Cubes method : Results of the Dividing-Cubes method These two images are from the 3D animation. Two density levels are shown here.
Conclusions : Conclusions We made use of two different techniques to render iso-surfaces out of the density files for our 3D numerical simulation.
We successfully removed the artifacts from the original method by implementing the Dividing-Cubes Method
Our code based on the new method can be applied to the general case.
Reference: : Reference: Lorensen, W. E. and H. E. Cline, "Marching Cubes: A High Resolution 3D Surface Construction Algorithm," Computer Graphics, vol. 21, no. 3, pp. 163-169, July 1987.
Cazes, J. E. and J. E. Tohline, (2000), "Self-Gravitating Gaseous Bars. I. Compressible Analogs of Riemann Ellipsoids with Supersonic Internal Flows.", The Astrophysical Journal, 532, 1051 - 1068.
http://www.opengl.org
http://www.phys.lsu.edu/~ou/movie/bar_mode/index.html
Thank you! : Thank you!