Fluid Surface Rendering in CUDA Andrei Monteiro Marcelo Gattass Assignment 4 June 2010.

Slides:



Advertisements
Similar presentations
Reconstruction from Voxels (GATE-540)
Advertisements

Christopher McCabe, Derek Causon and Clive Mingham Centre for Mathematical Modelling & Flow Analysis Manchester Metropolitan University MANCHESTER M1 5GD.
Graphics Pipeline.
Text Scaffolds for Effective Surface Labeling Gregory Cipriano and Michael Gleicher.
Piecewise Convex Contouring of Implicit Functions Tao Ju Scott Schaefer Joe Warren Computer Science Department Rice University.
CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2013.
CDS 301 Fall, 2009 Scalar Visualization Chap. 5 September 24, 2009 Jie Zhang Copyright ©
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Information Visualization.
HCI 530 : Seminar (HCI) Damian Schofield.
lecture 4 : Isosurface Extraction
Surface Reconstruction from 3D Volume Data. Problem Definition Construct polyhedral surfaces from regularly-sampled 3D digital volumes.
Particle-based fluid simulation for interactive applications
Introduction to Volume Rendering Presented by Zvi Devir.
(conventional Cartesian reference system)
Introduction to Volume Visualization Mengxia Zhu Fall 2007.
Tetra-Cubes: An algorithm to generate 3D isosurfaces based upon tetrahedra BERNARDO PIQUET CARNEIRO CLAUDIO T. SILVA ARIE E. KAUFMAN Department of Computer.
Accelerating Marching Cubes with Graphics Hardware Gunnar Johansson, Linköping University Hamish Carr, University College Dublin.
Seminar 1 Surface Rendering, Decimation Presented By Sonali Barua Date:10/31/2005.
Modeling Fluid Phenomena -Vinay Bondhugula (25 th & 27 th April 2006)
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
ITUppsala universitet Data representation and fundamental algorithms Filip Malmberg
Marching Cubes A High Resolution 3D Surface Construction Algorithm.
Continuous Scatter Plot Paper by: Sven Bachthaler and Daniel Weiskopf Presented by: Ayan Biswas.
Marching Cubes: A High Resolution 3D Surface Construction Algorithm
Volumetric and Blobby Objects Lecture 8 (Modelling)
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Procedural terrain on the GPU Chalmers University of Technology Advanced computer graphics – DAT205 David Sundelius Adam Scott.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Scalar Visualization Chap. 5 September 23, 2008 Jie Zhang Copyright ©
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Definitions Spectral Elements – data structures that contain information about data at points within each geometric entity. Finite elements only hold information.
19/18/ :34 Graphics II Volume Rendering Session 10.
COMPUTATIONAL FLUID DYNAMICS IN REAL-TIME An Introduction to Simulation and Animation of Liquids and Gases.
Dynamic Meshing Using Adaptively Sampled Distance Fields
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Exploitation of 3D Video Technologies Takashi Matsuyama Graduate School of Informatics, Kyoto University 12 th International Conference on Informatics.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
University of Coimbra Reconstruction of Voxels from Sensor Data Ricardo Martins Coimbra, 19 th January 2010 Doctoral Programme in Electrical Engineering.
Surface Modeling Visualization using BrainVISA Bill Rogers UTHSCSA – Research Imaging Center.
Marching Cubes: A High Resolution 3D Surface Construction Algorithm William E. Lorenson Harvey E. Cline General Electric Company Corporate Research and.
CMSC 635 Volume Rendering. Volume data  3D Scalar Field: F(x,y,z) = ?  Implicit functions  Voxel grid  Scalar data  Density  Temperature  Wind.
Volume Rendering CMSC 491/635. Volume data  3D Scalar Field: F(x,y,z) = ?  Implicit functions  Voxel grid  Scalar data  Density  Temperature  Wind.
3D Volume Visualization. Volume Graphics  Maintains a 3D image representation that is close to the underlying fully-3D object (but discrete)  경계표면 (Boundary.
Volume Visualization Presented by Zhao, hai. What’ volume visualization Volume visualization is the creation of graphical representations of data sets.
CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CHAPTER 5 CONTOURING. 5.3 CONTOURING Fig 5.7. Relationship between color banding and contouring Contour line (isoline): the same scalar value, or isovalue.
Smoothed Particle Hydrodynamics Matthew Zhu CSCI 5551 — Fall 2015.
Advisor : Ku-Yaw Chang Speaker : Ren-Li Shen /6/12.
CDS 301 Fall, 2008 Domain-Modeling Techniques Chap. 8 November 04, 2008 Jie Zhang Copyright ©
APE'07 IV INTERNATIONAL CONFERENCE ON ADVANCES IN PRODUCTION ENGINEERING June 2007 Warsaw, Poland M. Nowakiewicz, J. Porter-Sobieraj Faculty of.
1 Interactive Volume Isosurface Rendering Using BT Volumes John Kloetzli Marc Olano Penny Rheingans UMBC.
Computer Graphics Lecture 26 Mathematics of Lighting and Shading Part II Taqdees A. Siddiqi
Visualization of Scanned Cave Data with Global Illumination
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CSc4730/6730 Scientific Visualization
ATCM 6317 Procedural Animation
Domain-Modeling Techniques
Volume Rendering (2).
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Lecture 3 : Isosurface Extraction
Volume Graphics (lecture 4 : Isosurface Extraction)
Procedural Animation Lecture 10: Volume simulation
Three Step Geometric Pipeline
Presentation transcript:

Fluid Surface Rendering in CUDA Andrei Monteiro Marcelo Gattass Assignment 4 June 2010

Topics Introduction Related Work Algorithm CUDA Implementation Shading Results Conclusion References

Introduction Fluids are part of our daily lives. Difficult to reproduce Simulations are expensive Water Smoke Explosions It is typically simulated off-line and then visualized. In this work we are focusing in rendering the fluid in real time.

Introduction Fluids are simulated using particle system using the Smoothed-Particle Hydrodynamics (SPH) method It is made up of thousands to millions of particles (in a large scale simulation) The objective is to extract the isosurface from this cluster of particles.

Introduction 262,144 particles

Introduction Surface Rendering techniques Marching Cubes Point Splatting Surfels In this work, we use the Marching Cubes tecnique which is faster than the others.

Related Work NVIDIA´s Notes on Parallel Marching Cubes Algorithm Screen Space Fluid Rendering with Curvature Flow, Simon Green, NVIDIA LORENSEN, W. E., AND CLINE, H. E Marching cubes: A high resolution 3d surface construction algorithm. SIGGRAPH, Comput. Graph. 21, 4, 163–169. Real-Time Animation of Water, Takashi Amada.

Algorithm Marching Cubes Is based on a grid method where it evaluates a scalar field on the vertices. We take advantage of the Uniform Grid already implemented in our SPH simulation. If the scalar field on a vertex is less than a threshold (isosurface value), the vertex is inside the isosurface / fluid and outside otherwise. The most difficult part of the algorithm is to obtain a good scalar field function as the smoothness of the surface generated depends greatly on it. We then use these information to triangulate the surface. Normals are also calculated using, for example, the gradient of the scalar field.

Algorithm outside inside isosurface

Algorithm outside inside

Algorithm Same algorithm applies in 3D, but the there are 256 voxel-triangle configurations: 8 vertices per voxel Total number of configurations is 2 8 = 256. However, if we rotate and/or reflect the 15 cases below, we obtain 256 configurations. In this work we use all 256 configurations.

CUDA Implementation Triangle configurations (number of vertices, triangles) are stores in tables and written in textures. 1. Calculate number of vertices needed per voxel. 2. Count number of occupied voxels (excluding empy voxels with which do not contain the isosurface). 3. Compact the occupied voxels to be tightly packed. 4. Count the total number of vertices used to generate the surface. 5. Generate the triangles.

CUDA Implementation 1. Calculate number of vertices needed per voxel. 1 thread per voxel Check if 8 corners have scalar fields less than the isosurafce value. If so, increment voxel vertex counter. Use the vertex counter to access the Vertices Table, which contains the number of vertices with that specific configuration.

CUDA Implementation 2. Count number of occupied voxels The previous step returns an array with the number of vertices per voxel and an array indicating if each voxel is occupied (1) or not (0). Scan this array and return the number of occupied voxels. Array elements with 0 indicates an unoccupied voxel. Use the cudppScan from SDK, a fast scan function.

CUDA Implementation 3. Compact the occupied voxels to be tightly packed The previous step returns an array of occupied scan where elements = 1 (occupied) have their values changed to the occupied index (0,1,2,3...), and elements = 0 have their values unchanged. This kernel compacts the occupied voxels indices by looking at the occupied scan array values. int index = current Thread; if (voxelOccupied[index] ) { compactedVoxelArray[ voxelOccupiedScan[index] ] = index; } Occupied Array Scanned Occupied Array Compacted Voxel Array

CUDA Implementation 4. Count the total number of vertices used to generate the surface. Same idea of step 2. Use cudppScan to accumulate the number of vertices in each voxel position in the array.

CUDA Implementation 5. Generate Triangles Use all information obtained in the previous steps. 1 thread per occupied voxel. Each thread obtains the current voxel index from the compacted voxel Array and use it to access the data such as number of vertices and scalar fields. Linearly interpolate vertices and normals from each voxel edge:

CUDA Implementation f0 = scalar field´s value and gradient from one edge vertex; f1 = scalar field´s value and gradient from other edge vertex; float t = (isolevel - f0.w) / (f1.w - f0.w); p = lerp(p0, p1, t); n.x = lerp(f0.x, f1.x, t); n.y = lerp(f0.y, f1.y, t); n.z = lerp(f0.z, f1.z, t); f0 f1 f0 f1 f0 f1

CUDA Implementation Scalar Field: Use density as scalar field Normals are obtained by: Density in a position r Kernel function ρ i,j+1 ρ i+1,j ρ i,j-1 ρ i-1,j ρ i,j Grid ρsρsρsρs

Shading Use Fresnel Environment Mapping Use Cube Texture Reflection Cube Mapping texture acces Refraction Cube Mapping texture access a = refracted color b = reflected scene color T = thickness function

Results - Particles

Results - Mesh

Results - Phong

Results - Reflection

Results - Refraction

Results – Refraction and Reflection Mixed

Results – Final Rendering

Conclusion The user was able to render a fluid with physical effects. CUDA marching cubes proved to be fast. Difficulty in obtaining a scalar field. Can calculate normals per vertex.

References NVIDIA´s Notes on Parallel Marching Cubes Algorithm. Screen Space Fluid Rendering with Curvature Flow, Simon Green, NVIDIA. Retrieved Jun 25, LORENSEN, W. E., AND CLINE, H. E Marching cubes: A high resolution 3d surface construction algorithm. SIGGRAPH, Comput. Graph. 21, 4, 163–169. Real-Time Animation of Water, Takashi Amada. NVIDIA CUDA Programming Guide. V. 2.0, Retrieved Mar 29, 2010.